Title: Operating Systems Tim Ji Lecture 1
1Operating SystemsTim JiLecture 1
- Outline
- Course Information
- History of Operating Systems
- Basic Components of OS
- Lab 1
- Become familiar with Linux
- Readings
- Chapter 1
-
21 Course Information
- Official Course Outline
- On course webpage, MS Word document
- Course Objectives/Learning Outcomes
- Understand OS algorithms
- Be able to write multitasking programs with a
variety of inter-process communication methods - Be able to write scheduling, paging algorithms
- Textbook Tanenbaum, Modern Operating Systems
2nd Edition, Prentice Hall
3(No Transcript)
4Course Information (2)
- Instructor
- Name Tim Ji
- Email tji AT conestogac.on.ca
- Office 2A503, x2230
- Office hour Drop by my office or by appointment
- Grading
- 3 tests, 20 each 60
- Assignments Labs 40
- Assignments
- Due in class at the end of lecture, 20 reduction
in the assignment mark for each school day it is
late. - The assignments must be your own work.
Cheating/copying other peoples files will result
in both papers receiving zero.
5Course Information (3)
- Labs
- Lab tasks will be demonstrated in the following
week lab, and lab reports must be submitted by
the end of the lab. You have 1 week to finish the
lab task. - Course website
- http//www.conestogac.on.ca/tji/os
- Announcements, assignments, lecture handouts,
etc. - Check it out at least once per day.
- Study to pass
- You have to pass both the tests portion and the
assignments portion - Assignments/Labs marking
- Demonstrate your task in lab
- Answer questions regarding to your own task
- Programming style of printouts of your source
code, for programming assignments/labs
6Introduction to Operating Systems
- Topics
- Role and purpose of the operating system
- History of operating system development
- Functionality of a typical operating system
- Learning Objectives
- Explain the objectives and functions of modern
operating systems. - Describe how operating systems have evolved over
time from primitive batch systems to
sophisticated multiuser systems. - Describe the functions of a contemporary
operating system with respect to convenience,
efficiency, and the ability to evolve.
7Early Computers
- First Computer
- Charles Babbage (1791-1871) designed the first
true digital computer called the analytical
engine. - That was purely mechanical and intended to do
math operations - The engine was supposed to be made of brass, and
steam powered - He did not actually built the machine but
inspired others in the field.
8Early Computers
- Babbage also thought of the concept of software
- And hired the first programmer (Lady Ada,
Countess of Lovelace) for his analytical engine
9Current Computer Systems
- A computer system consists of
- hardware
- system programs
- application programs
10What is an Operating System (1)
- Microsoft Glossary
- The software that controls the allocation and
usage of hardware resources such as memory,
central processing unit (CPU) time, hard disk
space, and peripheral devices (like speakers or a
mouse). - The operating system is the foundation software
on which programs, such as Word or Excel, depend.
- An example of an operating system is Microsoft
Windows XP.
11What is an Operating System (2)
- Provide a service for clients - a virtual machine
(top-down view) - An operating system is a layer of the computer
system (a virtual machine) between the hardware
and user programs. - Multiple processes
- Multiple address spaces
- File system
12What is an Operating System (3)
- Resource manager (bottom-up view)
- An operating system is a resource manager.Â
Resource management includes - Transforming resources - to provide an easier to
use version of a resource - Multiplexing resources - create the illusion of
multiple resources - Scheduling resources - when and who gets a
resource - The hardware resources it manages include
- Processors - process management system
- Memory - memory management system
- I/O devices - I/O system
- Disk space - file system
13What is an Operating System (4)
- The hardware resources are transformed into
virtual resources so that an operating system may
be viewed as providing a virtual computers, one
to each user. A virtual machine (top down view)
consists of - Processes - virtualization of the computer
including a virtual processor that abstracts the
cpu - user mode instruction set system calls - Virtual memory - virtualization of physical
memory - Logical devices - virtualization of physical
devices - Files - virtualization of disk space
14What is an Operating System (5)
- The general functions of an operating system
- Allocation - assigns resources to processes
needing the resource - Accounting - keeps track of resources - knows
which are free and which process the others are
allocated to. - Scheduling - decides which process should get the
resource next. - Protection - makes sure that a process can only
access a resource when it is allowed - Basic Functions
- Process management
- Resource management
- Device managment
- Memory management
- File management
15History of Operating Systems (1)
- First generation 1945 - 1955
- Technology vacuum tubes plugboards
- Programming setting some switches
- Programming language machine language
- Tasks tables of sine, cosine, logarithms
- OS none
16A Famous Remark
- "I think there is a world market for maybe five
computers." - Thomas Watson, chairman of IBM - 1943
17History of Operating Systems (2)
- Second generation 1955 1965
- Technology Transistors
- Programming Punched cards
- Programming languages FORTRAN Assembly
- Tasks Scientific
- Computer Mainframes
- OS Batch system
- Universities started to buy computers (millions )
18Early Batch System
- bring cards to IBM 1401 machine (good at card
reading) - read cards to tape
- put tape on IBM 7094 which does computing
- put tape on IBM 1401 which prints output offline
19Famous Remarks
- "I have traveled the length and breadth of this
country and talked with the best people, and I
can assure you that data processing is a fad that
won't last out the year. - The editor in charge of business books for
Prentice Hall - 1957
20History of Operating Systems (3)
- Third generation 1965 1980
- Technology ICs
- Programming Punched cards
- Programming languages FORTRAN Assembly
- Tasks Scientific commercial
- Computers IBM 360, DEC PDPs
- OS Multiprogramming/timesharing, spooling
- OSes Developed
- MULTICS (father of all modern OSes)
- UNIX (System V, BSD)
- POSIX (by IEEE)
- MINIX (by Tanenbaum)
- Linux (derived from MINIX)
21Famous Remark
- There is no reason anyone would want a computer
in their home. - Ken Olson, president, chairman and founder of
Digital Equipment Corp. - 1977
22History of Operating Systems (4)
- Fourth generation 1980-Present
- Technology VLSI
- Programming High level
- Programming languages C/C, Java,
- Computer PC
- OS Windows, MacOS, Linux
- Cheap PCs
23Famous Remark
- We don't see Windows as a long-term graphical
interface for the masses. - A Lotus Software Development official, while
demonstrating a new DOS version - 1989
24The Operating System Zoo (1)
- Mainframe operating systems
- Room-size computers
- High I/O capacity
- Offers
- Batch processing (no interaction, such as large
reports) - Transaction processing (large number of small
requests) - Timesharing (multiple users sitting in front of
clients)
25Famous Forcast
- "Computers in the future may weigh no more than
1.5 tons." - Popular Mechanics, forecasting the relentless
march of science, 1949
26The Operating System Zoo (2)
- Server operating systems
- Offer services like print, file, or web
- UNIX, Windows 2000, Linux
- Multiprocessor operating systems
- Parallel computing
- Personal computer operating systems
- Single user with a good GUI, such as Windows 98,
Windows 2000, Macintosh OS, Linux
27The Operating System Zoo (3)
- Real-time operating systems
- E.g. industrial process control systems where
each job must be completed in the specified time. - Hard real-time (nuclear reactor control systems)
or soft-real time systems (e.g multimedia
systems) depending on the acceptance of missing
deadlines - Embedded operating systems
- Real-time systems with some resource constraints
like memory, CPU, power. - Smart card operating systems
- Extremely primitive OS running on credit card
sized devices with a CPU.
28Computer Hardware
Monitor
Bus
- Components of a simple personal computer
29CPU
- Brain of the computer
- ALU (Arithmetical- Logical Unit)
- CU (Control Unit, fetch-execute-decode
instructions) - Has a certain set of instructions it can
recognize and execute - Basic CPU cycle
- Fetch the next instruction
- Decode it to determine its type and operands
- Execute it
- ..
- Programs are list of instructions executed by the
CPU - When the computer powers up, CU of CPU starts the
fetch-decode-execute cycle - Instructions may be OS instructions or other
programs
30CPU Modes
- A bit in PSW controls the mode
- Kernel Mode
- CPU can execute every instruction in its
instruction set - CPU can use every feature of the hardware
- OS runs in kernel mode
- User Mode
- Only a subset of instructions can be run
- And a subset of hardware features are accessed
- Generally all instructions involving I/O and
Memory protection are disallowed in that mode - To obtain OS services, a user program must make a
system call that traps into kernel mode and
invokes the OS - Trap instruction switches from user mode to
kernel mode and starts the operating system
(system calls and errors such as division by zero
causes trap instructions)
31Pipelining
- Parallelize the fetch, decode, execute sequence
- Three stage pipeline While executing
instruction N, decode instruction N1, and fetch
instruction N2 - What happens when a conditional branch occurs in
an instruction?
32CPU Pipeline
- (a) A three-stage pipeline (three instructions
processed in 1 cycle) - (b) A superscalar CPU (with multiple execution
units)
33Pipelining
Execute N Decode N1 Fetch N2
Fetch N
Execute N1 Decode N2 Fetch N3
Decode N Fetch N1
Execute N2 Decode N3 Fetch N4
Instruction N
Instruction N 1
Instruction N2
Instruction N3
Instruction N 4
One CPU Cycle
34Memory Hierarchy (1)
- Typical memory hierarchy
- numbers shown are rough approximations
35Memory Hierarchy
- Magnetic Tape
- Backup purposes and for storing very large data
sets. - One dimensional, only sequential access is
possible - Reliable (no tape crashes, or time based data
corruption) - Was the main data storage medium of the past
- Optic CDs
- Faster than tape
- Used for permanent storage (now rewritable)
36Memory Hierarchy
- Magnetic disks
- Are faster than tapes and CDs
- They are the main storage medium these days
- Data stored in concentric cylinders
- Disk head moves in discrete steps
- Each position of the disk head identifies a track
(divided into multiple sectors, typically 512
bytes) - Rotates continuously with a certain speed (e.g.
7200 rpm)
37Memory Hierarchy
- Disks and tapes are mechanical devices, therefore
they are slow compared to (RAM and Cache) - Main Memory (Random Access Memory)
- Volatile
- Much Much faster than magnetic disks but more
expensive too - Cache
- Faster than RAM and more expensive
- CPU requests first go to cache, and if they are
there (cache hit) then fine, if not there (cache
miss) then RAM is accessed - There can be multiple cache levels
- Cache is divided into cache lines (usually 64
bytes at each line)
38Memory Hierarchy
- Registers
- They are the fastest accessible memory locations
- Placed at the CPU.
- They are usually of size 32 bits, or 64 bits
depending on the CPU type
39Memory Hierarchy
- Read Only Memory (ROM)
- Write once, read many times
- Low level I/O cards
- Code for starting the computer
- Electrically Erasable Rom (EEPROM)
- Non volatile
- Flash RAM
- Non volatile
40Memory Hierarchy
- CMOS (Complementary Metal Oxide Semiconductor)
- Volatile but can be sustained with mother board
battery for years. - May give checksum errors when being corrupted
- Very small, 64 bytes.
- Holds the current time and date, configuration
parameters (like which disk to boot from etc.)
41Yet another famous quote!
- "640K ought to be enough for anybody."
- Bill Gates, 1981
42I/O Devices
- An input device transfers data from a mechanism
like keyboard, mouse, touch screen, or microphone
into a CPU register. CPU will then store the data
into Main Memory - For output devices, CPU fetches the information
from main memory to its registers and transfers
this information via the bus to an output device
like screen, speaker, or printer. - Communication devices serial and parallel
ports, infrared transmitter/receivers, wireless
network cards, network interface cards
43DISK
PRINTER
PRINTER CONTROLLER
DISK CONTROLLER
CPU
MEMORY CONTROLLER
- Device controllers have microprocessors.
- They can work in parallel.
- They can tell CPU when they are done.
MEMORY
44How I/O Can Be Done
- Three methods
- Busy waiting through system call
- Interrupt
- DMA (Direct Memory Access)
45Lab 1 Get Familiar with Linux
- Introduction to Linux
- Lab material is available on the course webpage
- Follow the lab task specifications -- your marks
depend on it.
46Readings