Title: Tanenbaum
1OPERATING SYSTEMSDESIGN AND IMPLEMENTATIONThird
EditionANDREW S. TANENBAUMALBERT S.
WOODHULLChapter 1Introduction
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
2The Modern Computer System
Figure 1.1 A computer system consists of
hardware, system programs, and application
programs.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
3What Is an Operating System?
- Two basic functions of the OS
- Extended machine or virtual machine
- Easier to program than the underlying hardware
- Resource manager
- Shares resources in time and space
- User interface to OS is what we see,
- But really it is just another program.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
4Operating System Generations(Tannenbaum H/W)
- Generation 1 (1945 55) Vacuum tubes and
plugboards - Generation 2 (1955 65)Transistors and batch
systems - Generation 3 (1965 80)ICs and multiprogramming
- Generation 4 (1980 Present)Personal computers
- (My gen 5 multicore systems pervasive
computing)
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
5Remmington Rand 409 (Univac)
Program is in plugboard!!!
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
6IBM 650
card sorter (L) reader/punch (C), computer (R)
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
7IBM 650
front panel (L) drum (B), tubes (TL)
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
8Vacuum Tube (IBM 650)
IBM 650 announced1953, sold until1962
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
9Sperry-Univac AN-UYK/20
Program from toggle switches on front panel Note
64K of core memory (bottom half)
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
10Operating System Generations(Silberschatz and
others S/W)
- Generation 1 (50s on) Resident Monitor user
operator - Single application program at a time
- Generation 2 (late 50s 60s)Batch systems
user not operator, JCL - 2a uniprogrammed batch
- 2b multiprogrammed batch
- Generation 3 (1960s on)Timesharing systems
- Generation 4 (1980 Present)Personal computers
user operator
Did they improved productivity?
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
11Operating System Generations(Silberschatz and
others S/W)
- Generation 5 (1980 present) Network Operating
Systems - Remote commands, interoperability key
- Generation 6 (late 80s present)Distributed
Operating Systems - Transparency key homogenous systems
- Generation 7 (1990s on)Cooperative Autonomous
Systems independent systems integration key - Resource discovery, negotiation, etc.
- e.g., Service Oriented Architectures
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
12Resident Monitor
- Users reserved time on machine (hour scale)
- If not done when time up, too bad try again
later - Useful to have a user interface and RM to allow
you to - Read program and data in from card reader, tape
drive, etc. - Run program
- Print results
- Also had utility programs
- Compiler
- Linker
- Loader
- Editor
- Also had librariesSets of convenient procedures
reused often - Math functions
- Print formatting
- I/O access
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
13Early Batch System (1)
Figure 1-2. An early batch system. (a)
Programmers bring cards to 1401. (b)1401 reads
batch of jobs onto tape.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
14Early Batch System (2)
Figure 1-2. An early batch system. (c) Operator
carries input tape to 7094. (d) 7094 does
computing.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
15Early Batch System (3)
Figure 1-2. An early batch system. (e) Operator
carries output tape to 1401. (f) 1401 prints
output.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
16Early Batch System (4)
Figure 1-3. Structure of a typical FMS job.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
17Uniprogrammed Batch System
User Program
Fence register
Operating System/RM
Uniprogramming single process runs at a
time Protect OS/RM using fence register test
vs. address
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
18Uniprogrammed Batch System
Job 1
Job 2
Job N
OS
OS
OS
time
While there is another job Read control card for
next job Load job Run job
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
19Uniprogrammed Batch System
I/O
CPU-bound job
CPU
activity
CPU burst
I/O burst
I/O
I/O-bound job
CPU
time
I/O-bound jobs underutilize CPU Even CPU-bound
jobs use little CPU when doing I/O Desirable to
overlap CPU use of one job with I/O of other
job(s)
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
20Multiprogramming
Figure 1-4. A multiprogramming system with three
jobs in memory.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
21Multiprogrammed Batch System
I/O-3
CPU-3
activity
I/O-2
CPU-2
I/O-1
CPU-1
OS
time
Doing I/O (3 channels)
Has CPU Waiting for CPU or event
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
22Processes
Figure 1-5. A process tree. Process A created two
child processes, B and C. Process B created
three child processes, D, E, and F.
How to create a child process?
Where does the first process come from?
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
23File Systems (1)
Figure 1-6. A file system for a university
department.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
24File Systems (2)
- Figure 1-7.
- Before mounting, the files on drive 0 are not
accessible. - After mounting, they are part of the file
hierarchy.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
25File Systems (3)
Figure 1-8. Two processes connected by a pipe.
What is a pipe, anyway?
Not that kind of pipe!
A pipe is a character stream one process can
write to it, the other one reads from it.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
26System Calls (1)
Process Management
Figure 1-9. The MINIX system calls. pid is
process ID statloc and status return exit
status name is filename argv is argument list
envp is environment pointer.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
27System Calls (2)
Signals
Figure 1-9. The MINIX system calls. sig is signal
number, act and oldact are procedures, how says
what to do, old allows old signal mask to be
remembered.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
28System Calls (3)
File Management
Figure 1-9. The MINIX system calls. fd is a file
descriptor mode determines access mode nbytes
is a byte count buf holds status info.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
29System Calls (4)
Directory File System Mgmt.
Figure 1-9. The MINIX system calls. s is return
status namex, dirname, and special are
file/directory names mode is protection mode.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
30System Calls (5)
Protection
Figure 1-9. The MINIX system calls. name is
file/directory name mode is protection mode,
complmode is its inverse uid and owner are user
ID gid and group are group ID.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
31System Calls (6)
Time Management
Figure 1-9. The MINIX system calls. tp and timep
are pointers to time variable file is filename.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
32The fork Call in the Shell
Figure 1-10. A stripped-down shell. Throughout
this book, TRUE is assumed to be defined as 1.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
33Processes
Activation frames with non-persistent variables
Stack and data grow and shrink
Persistent variables, constants
Instructions
Figure 1-11. Processes have three segments text,
data, and stack. In this example, all three are
in one address space, but separate instruction
and data space is also supported.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
34Processes
Used stack space
Free stack space
Free heap space
Return from first procedure
Return from second procedure
Used heap space
Call a procedure
Call another procedure
Activation frames with non-persistent variables
Stack and data grow and shrink
Allocate another var
Persistent variables, constants
Allocate a variable
Free a variable
Instructions
A process uses up space in data segment as
objects are allocated, must increase space if
none left.
A process grows the stack as procedures/methods
are called, shrinks it as they return.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
35System Calls for File Management (1)
Figure 1-12. The structure used to return
information for the stat and fstat system calls.
In the actual code, symbolic names are used for
some of the types.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
36I/O Redirection
In the shell cat - lt file.txt grep foo
sort gt silly.txt The 'lt' character redirects
input to come from a file The '' characters
indicate pipes The 'gt' character redirects the
output to a file cat with the '-' option reads
from stdin, and by default it writes to stdout.
Both grep and sort read from stdin and write to
stdout (cin and cout in C) Pipes allow linking
a sequence of operations together without having
to make temporary files between each step
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
37System Calls for File Management (2)
NB need two file descriptors read (0) and
write (1)
Figure 1-13. First part of a skeleton for setting
up a two-process pipeline.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
38System Calls for File Management (3)
Frees slot 0 in PFT
Copies read end of pipe to slot 0 in PFT
Figure 1-13. Last part of a skeleton for setting
up a two-process pipeline.
Now when process1 writes to STDOUT, it appends to
pipe And when process2 reads from STDIN, it
dequeues from pipe
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
39System Calls for Directory Management (1)
file name
i-node number
link(/usr/jim/memo,/usr/ast/note)
Figure 1-14. (a) Two directories before linking
/usr/jim/memo to asts directory. (b) The same
directories after linking.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
40System Calls for Directory Management (2)
mount(/dev/cdrom0,/mnt,0)
Figure 1-15. (a) File system before the mount.
(b) File system after the mount.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
41Operating System Structure
Figure 1-16. The 11 steps in making the system
call read(fd, buffer, nbytes).
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
42Basic Structure for Operating System
- A main program that invokes the requested service
procedure - A set of service procedures that carry out the
system calls - A set of utility procedures that help the service
procedures
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
43Layered Systems (1)
Figure 1-17. A simple structuring model for a
monolithic system.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
44Layered Systems (2)
Figure 1-18. Structure of the THE operating
system.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
45Virtual Machines
Figure 1-19. The structure of VM/370 with CMS.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
46Client-Server Model (1)
Figure 1-20. The client-server model.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
47Client-Server Model (2)
Figure 1-21. The client-server model in a
distributed system.
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
48Client-Server Model (3)
wait for request
Server
request
reply
reply
request
wait for reply
Client
wait
time
Client-server synchronous communication
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8
49Summary
- OS definition(s) and functions
- OS history, functionalities
- OS components
- System calls
- OS Architectures
Tanenbaum Woodhull, Operating Systems Design
and Implementation, (c) 2006 Prentice-Hall, Inc.
All rights reserved. 0-13-142938-8