Professional Documents
Culture Documents
Modern Operating Systems
Modern Operating Systems
Chapter 1
Introduction
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
What Is An Operating System?
Lots of hardware !!
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Where is the software?
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The Operating System as an Extended
Machine
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The Operating System as a Resource
Manager
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
History of Operating Systems
Generations:
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Transistors and Batch Systems (1)
• Multics
• Unix
• Linux
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Fourth generation
• PCs
• Network Operating Systems
• Distributed Operating
Systems
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Computer Hardware Review
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Memory Hierarchy
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The 4 Cache Questions
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Multithreaded and Multicore Chips
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Disks
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Device Driver
Tanenb aum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
I/O by polling device
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
I/O by Interrupts
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
I/O by DMA
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The bus hierarchy
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Pentium System Buses
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The Operating System Zoo
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The Operating System Zoo
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The Operating System Zoo
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Processes
• Program in execution
• Lives in address space
• Process table
• Keeps info about process
• Used to re-start process
• Example Shell (command interpreter) reads
commands from terminal
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
A Process Tree
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Process
• Have UID’s and group ID’s (GID)
• Can communicate with one another (IPC)
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
File directory
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Special files
• Special files are provided in order to make I/O
devices look like files.
• OS treats them as files.
• Block special files (disks)
• Character special files (line printers,
modems)
• Kept in /dev directory, e.g. /dev/lp is line
printer
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Unix Pipe
Processes communicate by writing into/reading from a
file in Unix
A and B write into the pipe and read from the pipe.
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
I/O, Protection/Shell
• I/O-big part of OS
• Protection-UNIX uses rwx bits for each file
• 3 bits for owner, 3 for group, 3 for everyone else
• Shell (command interpreter)
• UNIX
• Has lots of flavors-sh,bash,csh,ssh…..
• Sort <file1 >file2
• Cat file1 file2 file3 | sort > /dev/lp
• Cat file1 file2 file3 | sort > /dev/lp &
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
System Calls
• Interface between user programs and OS
• Varies from OS to OS
• System call issued by user program
• Call uses a library call of the same name
• Library routine puts machine into kernel modes
(by issuing a special instruction)
• Finds actual routine for system call in a table
• Does the work involved in the call
• Returns to user program
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Unix Read System Call
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
System Calls
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Memory Layout
Processes have three segments:
text, data, and stack.
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Shell
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Fork
• Pid=fork( )
• Duplicates parent process completely
Everything duplicated -data,registers,fd’s
• Fork returns a value (pid)
• Zero in child
• Child’s PID in parent
• Used to differentiate child from parent
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Execve
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Excve (example)
• cp f1 f2 is located by execve and parameters
are passed to it by execve
• Execve call main function of cp
• Main(argc, argv, envp) is main prog in cp
• Argc is #items on command line (=3 in cp)
• Argv points to array (arg[0] points to cp, arg[1] points to f1,
• Envp points to environment, an array of name=value with
info like terminal type
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
System Calls for File Management
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
File Status Information
• Regular, special
• Date of creation
• Size
• Access status of file via stat command
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
System Calls for Directory and File
Management
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Linking
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Mount System Call
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Other System Calls
chdir("/usr/ast/test");
chmod("file", 0544);
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Windows Win32 API
The Win32 API calls that roughly correspond to the UNIX calls
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Operating Systems Structure
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Monolithic systems
• 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.
Layered Systems-THE operating system
the THE system built at the Technische Hogeschool Eindhoven in the Netherlands by E. W. Dijkstra
(1968) and his students
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Microkernels
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Microkernels
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Client-Server Model
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Virtual Machines (1)
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Virtual Machines (2)
• In practice, the real distinction between a type 1 hypervisor and a type 2 hypervisor is that
• A type 2 makes uses of a host operating system and its file system to create processes, store files,
and so on.
• A type 1 hypervisor has no underlying support and must perform all these functions itself.
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Virtual Machines (3)
The Java Virtual Machine
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Exokernels
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The Model of Run Time