Case Study 1: LINUX: Modern Operating Systems
Case Study 1: LINUX: Modern Operating Systems
Third Edition
ANDREW S. TANENBAUM
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
HISTORY of Unix (1)
• MULTICS (M.I.T., Bell Labs, & GE)
– MULTiplexed Information and Computing Service
• Bell Labs pulls out and Ken Thompson looks for something to do
– Writes a stripped down version of MULTICS by himself for a PDP-7.
• Brian Kernighan names it UNICS
– UNiplexed Information and Computing Service
• Dennis Ritchie joins the effort and UNIX is ported to PDP-11/45 and
PDP-11/70 (dominate minicomputers of 1970’s)
• UNIX is rewritten in high-level language
– B was simplified version of BCPL (Basic CPL), a descendent of CPL (Combined
Programming Language). (Alternate version: B was derived from Bon an earlier
language that Thompson wrote which, in turn, was named after his wife, Bonnie.)
– Dennis Ritchie designed a successor to B and named it C.
2
HISTORY of Unix (2)
• AT&T (owner of Bell Labs) distributes UNIX
to universities for a modest fee.
• University of California at Berkeley ports
UNIX to the VAX (4BSD) and implements
virtual memory, long filenames, a better file
system, the network protocol TCP/IP, a new
editor (vi), a new shell (csh), and new
compilers (Pascal & Lisp).
• In 1987, Andrew Tanenbaum releases a
new stripped-down version called MINIX
that could be used by O.S. classes.
• In 1991, Finnish student, Linus Torvalds,
added features to MINIX and releases a full-
blown UNIX clone named Linux.
3
Unix / Linux Goals
– Designed by programmers for programmers
“What they want is a servant, not a nanny.”
– Simple, elegant, and consistent design
“Principle of least surprise”
– Power and Flexibility
Commands should do just one thing and do it well
– Avoid useless redundancy
use cp instead of copy
4
Interfaces to Linux
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
UNIX Shells
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Linux Utility Programs (2)
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Signals in Linux (1)
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Process Management
System Calls in Linux
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
A Simple Linux Shell
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Process Zombie States
• When a child process exits, it sends a message to its parent containing its exit
status.
• If the parent isn’t waiting for this message (or if the parent is no longer present),
the child enters the zombie state.
14
Implementation of Processes and Threads
Categories of information in the process descriptor:
• Scheduling parameters
• Memory image
• Signals
• Machine registers
System call state
• File descriptor table
• Accounting
• Kernel stack
• Miscellaneous
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Implementation of Exec
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Scheduling in Linux (1)
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Scheduling in Linux (2)
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Booting Linux
Figure 10-12. (a) Process A’s virtual address space. (b) Physical
memory. (c) Process B’s virtual address space.
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Memory Management in Linux (2)
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Memory Management
System Calls in Linux
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Physical Memory Management (1)
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Physical Memory Management (2)
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Memory Allocation Mechanisms
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The Page Replacement Algorithm
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Networking (2)
Types of networking:
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Input/Output System Calls in Linux
Figure 10-20. The main POSIX calls for managing the terminal.
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The Major Device Table
Figure 10-22. The Linux I/O system showing one file system
in detail.
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The Linux File System (1)
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The Linux File System (3)
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The Linux File System (4)
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
File System Calls in Linux (2)
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
File System Calls in Linux (3)
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The Linux Virtual File System
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The Linux Ext2 File System (1)
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The Linux Ext2 File System (2)
Figure 10-32. (a) A Linux directory with three files. (b) The same
directory after the file voluminous has been removed.
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The Linux Ext2 File System (3)
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
The Linux Ext2 File System (4)
Figure 10-34. The relation between the file descriptor table, the
open file description table, and the i-node table.
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
NFS Protocols
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
Security System Calls in Linux
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639