Beruflich Dokumente
Kultur Dokumente
Silberschatz, Galvin, Gagne - Operating System Concepts, Sixth Edition, John Willey & Sons, 2003
1
1.1 1.1.1 1.1.2 1.1.3 1.2 1.2.1 1.2.2 1.2.3 1.3 1.4 1.5 1.5.1 1.5.2 1.6 1.7 1.8 1.9 1.10 1.10.1 1.10.2 1.10.3 1.11
INTRODUCTION
What Is an Operating System? User View System View System Goals Mainframe Systems Batch Systems Multiprogrammed Systems Time-Sharing Systems Desktop Systems Multiprocessor Systems Distributed Systems Client-Server Systems Peer-to-Peer Systems Clustered Systems Real-Time Systems Handheld Systems Feature Migration Computing Environments Traditional Computing Web-Based Computing Embedded Computing Summary
2
2.1 2.2 2.2.1 2.2.2 2.3 2.3.1 2.3.2 2.3.3 2.4 2.4.1 2.4.2 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.6 2.6.1 2.6.2 2.7
COMPUTER-SYSTEM STRUCTURES
Computer-System Operation I/O Structure I/O Interrupts DMA Structure Storage Structure Main Memory Magnetic Disks Magnetic Tapes Storage Hierarchy Caching Coherency and Consistency Hardware Protection Dual-Mode Operation I/O Protection Memory Protection CPU Protection Network Structure Local-Area Networks Wide-Area Networks Summary
3
3.1 3.1.1 3.1.2 3.1.3 3.1.4
OPERATING-SYSTEM STRUCTURES
System Components Process Management Main-Memory Management File Management I/O-System Management
importanta . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 . . . 2 3 3 2 2 2 2 2 2 2 2 3 3 3 3 3 1 1 1 . . . 1 1 1 1 1
3.1.5 3.1.6 3.1.7 3.1.8 3.2 3.3 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.4 3.5 3.5.1 3.5.2 3.5.3 3.6 3.6.1 3.6.2 3.6.3 3.7 3.7.1 3.7.2 3.7.3 3.8 3.9
Secondary-Storage Management Networking Protection System Command-Interpreter System Operating-System Services System Calls Process Control File Manipulation Device Management Information Maintenance Communication System Programs System Structure Simple Structure Layered Approach Microkernels Virtual Machines Implementation Benefits Java System Design and Implementation Design Goals Mechanisms and Policies Implementation System Generation Summary
4
4.1 4.1.1 4.1.2 4.1.3 4.1.4 4.2 4.2.1 4.2.2 4.2.3 4.3 4.3.1 4.3.2 4.4 4.5 4.5.1 4.5.2
4.5.2.1 4.5.2.2
PROCESSES
Process Concept The Process Process State Process Control Block Threads Process Scheduling Scheduling Queues Schedulers Context Switch Operations on Processes Process Creation Process Termination Cooperating Processes Interprocess Communication Message-Passing System Naming
Direct Communication Indirect Communication
Synchronization Buffering An Example: Mach An Example: Windows 2000 Communication in Client-Server Systems Sockets Remote Procedure Calls Remote Method Invocation Summary
5
5.1 5.1.1 5.1.2 5.1.3 5.2
THREADS
Overview Motivation Benefits User and Kernel Threads Multithreading Models
1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 3 3 3 2 1 1 3 1 1 . . . 3 3 3 3 3 2 2 2 3 3 3 3 2 2 2 2 2 2 2 2 0 1 2 1 3 2 . . . 3 3 3 3 3
5.2.1 5.2.2 5.2.3 5.3 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.4 5.5 5.6 5.7 5.8 5.8.1 5.8.2 5.9
Many-to-One Model One-to-One Model Many-to-Many Model Threading Issues The fork and exec System Calls Cancellation Signal Handling Thread Pools Thread-Specific Data Pthreads Solaris 2 Threads Windows 2000 Threads Linux Threads Java Threads Thread Creation The JVM and the Host Operating System Summary
6
6.1 6.1.1 6.1.2 6.1.3 6.1.4 6.2 6.3 6.3.1 6.3.2 6.3.3 6.3.4 6.3.5 6.3.6 6.4 6.5 6.6 6.6.1 6.6.2 6.6.3 6.6.4 6.7 6.7.1 6.7.2 6.7.3 6.8
CPU SCHEDULING
Basic Concepts CPU-I/O Burst Cycle CPU Scheduler Preemptive Scheduling Dispatcher Scheduling Criteria Scheduling Algorithms First-Come, First-Served Scheduling Shortest-Job-First Scheduling Priority Scheduling Round-Robin Scheduling Multilevel Queue Scheduling Multilevel Feedback Queue Scheduling Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation Deterministic Modeling Queueing Models Simulations Implementation Process Scheduling Models An Example: Solaris 2 An Example: Windows 2000 An Example: Linux Summary
7
7.1 7.2 7.2.1
7.2.1.1 7.2.1.2 7.2.1.3
PROCESS SYNCRONIZATION
Background The Critical-Section Problem Two-Process Solution
Algorithm 1 Algorithm 2 Algorithm 3
7.2.2 7.3 7.4 7.4.1 7.4.2 7.4.3 7.4.4 7.5 7.5.1 7.5.2
Multiple-Process Solution Synchronization Hardware Semaphores Usage Implementation Deadlock and Starvation Binary Semaphores Classical Problems of Synchronization The Bounded-Buffer Problem The Readers-Writers Problem
3 3 3 2 2 2 1 3 2 2 0 1 2 1 1 3 . . . 3 3 3 3 3 3 3 3 3 3 3 2 2 2 3 1 1 1 1 1 2 0 3 3 . . . 3 3 3 3 3 3 2 2 3 3 3 3 0 3 3 3
7.5.3 7.6 7.7 7.8 7.8.1 7.8.2 7.9 7.9.1 7.9.2 7.9.3 7.9.4
7.9.4.1 7.9.4.2 7.9.4.3
The Dining-Philosophers Problem Critical Regions Monitors OS Synchronization Synchronization in Solaris Synchronization in Windows 2000 Atomic Transactions System Model Log-Based Recovery Checkpoints Concurrent Atomic Transactions
Serializability Locking Protocol Timestamp-Based Protocols
7.10
Summary
8
8.1 8.2 8.2.1 8.2.2 8.3 8.4 8.4.1 8.4.2 8.4.3 8.4.4 8.5 8.5.1 8.5.2 8.5.3
8.5.3.1 8.5.3.2 8.5.3.3
DEADLOCKS
System Model Deadlock Characterization Necessary Conditions Resource-Allocation Graph Methods for Handling Deadlocks Deadlock Prevention Mutual Exclusion Hold and Wait No Preemption Circular Wait Deadlock Avoidance Safe State Resource-Allocation Graph Algorithm Banker's Algorithm
Safety Algorithm Resource-Request Algorithm An Illustrative Example
Deadlock Detection Single Instance of Each Resource Type Several Instances of a Resource Type Detection-Algorithm Usage Recovery from Deadlock Process Termination Resource Preemption Summary
9
9.1 9.1.1 9.1.2 9.1.3 9.1.4 9.1.5 9.2 9.3 9.3.1 9.3.2 9.3.3 9.4 9.4.1 9.4.2 9.4.3 9.4.4
9.4.4.1 9.4.4.2
MEMORY MANAGEMENT
Background Address Binding Logical- Versus Physical-Address Space Dynamic Loading Dynamic Linking and Shared Libraries Overlays Swapping Contiguous Memory Allocation Memory Protection Memory Allocation Fragmentation Paging Basic Method Hardware Support Protection Structure of the Page Table
Hierarchical Paging Hashed Page Tables
3 0 0 1 0 1 3 3 3 3 3 3 3 3 . . . 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 . . . 3 3 3 2 2 2 2 2 2 2 2 3 3 3 3 3 3 2
9.4.4.3
Shared Pages Segmentation Basic Method Hardware Protection and Sharing Fragmentation Segmentation with Paging Summary
10
10.1 10.2 10.2.1 10.2.2 10.3 10.3.1 10.3.2 10.4 10.4.1 10.4.2 10.4.3 10.4.4 10.4.5
10.4.5.1 10.4.5.2 10.4.5.3
VIRTUAL MEMORY
Background Demand Paging Basic Concepts Performance of Demand Paging Process Creation Copy-on-Write Memory-Mapped Files Page Replacement Basic Structure FIFO Page Replacement Optimal Page Replacement LRU Page Replacement LRU Approximation Page Replacement
Additional-Reference-Bits Algorithm Second-Chance Algorithm Enhanced Second-Chance Algorithm
10.4.6 10.4.7 10.5 10.5.1 10.5.2 10.5.3 10.6 10.6.1 10.6.2 10.6.3 10.7 10.7.1 10.7.2 10.8 10.8.1 10.8.2 10.8.3 10.8.4 10.8.5 10.8.6 10.8.7 10.9
Counting-Based Page Replacement Page-Buffering Algorithm Allocation of Frames Minimum Number of Frames Allocation Algorithms Global versus Local Allocation Thrashing Cause of Thrashing Working-Set Model Page-Fault Frequency Operating-System Examples Windows NT Solaris 2 Other Considerations Prepaging Page Size TLB Reach Inverted Page Table Program Structure I/O Interlock Real-Time Processing Summary
12
12.1 12.2 12.2.1 12.2.2 12.2.3 12.3 12.3.1 12.3.2 12.4 12.4.1 12.4.2
FILE-SYSTEM IMPLEMENTATION
File-System Structure File-System Implementation Overview Partitions and Mounting Virtual File Systems Directory Implementation Linear List Hast Table Allocation Methods Contiguous Allocation Linked Allocation
2 3 2 2 2 2 2 3 . . . 3 3 3 3 2 2 2 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 0 1 1 1 1 1 3 3 3 . . . 2 2 2 2 2 2 2 2 3 3 3
12.4.3 12.4.4 12.5 12.5.1 12.5.2 12.5.3 12.5.4 12.6 12.6.1 12.6.2 12.7 12.7.1 12.7.2 12.8 12.9 12.9.1 12.9.2 12.9.3 12.9.4 12.9.5 12.10
Indexed Allocation Performance Free-Space Management Bit-Vector Linked List Grouping Counting Efficiency and Performance Efficiency Performance Recovery Consistency Checking Backup and Restore Log-Structured File System NFS Overview The Mount Protocol The NFS Protocol Path-Name Translation Remote Operations Summary
3 3 3 3 3 3 3 2 2 2 3 3 3 3 2 2 2 2 2 2 .
Andrew S. Tanenbaum - Modern Operating Systems, Second Edition, Prentice Hall, 2001
7
7.1 7.2 7.2.1 7.2.2 7.3 7.3.1 7.3.2 7.4 7.4.1 7.4.2 7.4.3 7.4.4 7.5 7.5.1 7.5.2 7.5.3 7.6 7.6.1 7.6.2 7.6.3 7.6.4 7.6.5 7.7 7.7.1 7.7.2 7.8 7.8.1 7.8.2 7.9 7.10
. . 3 3 2 2 3 2 3 2 2 2 2 2 3 3 3 3 3 3 2 3 3 3 3 2 2 2 2 2 1 .
SO 3C sem 2 2011-2012 Silberschatz, Galvin, Gagne - Operating System Concepts, Sixth Edition, John Willey & Sons, 2003
1
1.1 1.1.1 1.1.2 1.1.3 1.2 1.2.1 1.2.2 1.2.3 1.3 1.4 1.5 1.5.1 1.5.2 1.6 1.7 1.8 1.9 1.10 1.10.1 1.10.2 1.10.3 1.11
INTRODUCTION
What Is an Operating System? User View System View System Goals Mainframe Systems Batch Systems Multiprogrammed Systems Time-Sharing Systems Desktop Systems Multiprocessor Systems Distributed Systems Client-Server Systems Peer-to-Peer Systems Clustered Systems Real-Time Systems Handheld Systems Feature Migration Computing Environments Traditional Computing Web-Based Computing Embedded Computing Summary 3.2 3.3 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.4 3.5 3.5.1 3.5.2 3.5.3 3.6 3.6.1 3.6.2 3.6.3 3.7 3.7.1 3.7.2 3.7.3 3.8 3.9 Operating-System Services System Calls Process Control File Manipulation Device Management Information Maintenance Communication System Programs System Structure Simple Structure Layered Approach Microkernels Virtual Machines Implementation Benefits Java System Design and Implementation Design Goals Mechanisms and Policies Implementation System Generation Summary
2
2.1 2.2 2.2.1 2.2.2 2.3 2.3.1 2.3.2 2.3.3 2.4 2.4.1 2.4.2 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.6 2.6.1 2.6.2 2.7
COMPUTER-SYSTEM STRUCTURES 4
Computer-System Operation I/O Structure I/O Interrupts DMA Structure Storage Structure Main Memory Magnetic Disks Magnetic Tapes Storage Hierarchy Caching Coherency and Consistency Hardware Protection Dual-Mode Operation I/O Protection Memory Protection CPU Protection Network Structure Local-Area Networks Wide-Area Networks Summary 4.1 4.1.1 4.1.2 4.1.3 4.1.4 4.2 4.2.1 4.2.2 4.2.3 4.3 4.3.1 4.3.2 4.4 4.5 4.5.1 4.5.2
4.5.2.1 4.5.2.2
PROCESSES
Process Concept The Process Process State Process Control Block Threads Process Scheduling Scheduling Queues Schedulers Context Switch Operations on Processes Process Creation Process Termination Cooperating Processes Interprocess Communication Message-Passing System Naming
Direct Communication Indirect Communication
3
3.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 5.1.2
4.5.3 4.5.4 4.5.5 OPERATING-SYSTEM STRUCTURES 4.5.6 System Components 4.6 Process Management 4.6.1 Main-Memory Management 4.6.2 File Management 4.6.3 I/O-System Management 4.7 Secondary-Storage Management Networking 5 Protection System 5.1 Command-Interpreter System 5.1.1 Benefits 7.4.4
Synchronization Buffering An Example: Mach An Example: Windows 2000 Communication in Client-Server Systems Sockets Remote Procedure Calls Remote Method Invocation Summary
THREADS
Overview Motivation Binary Semaphores
5.1.3 5.2 5.2.1 5.2.2 5.2.3 5.3 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.4 5.5 5.6 5.7 5.8 5.8.1 5.8.2 5.9
User and Kernel Threads Multithreading Models Many-to-One Model One-to-One Model Many-to-Many Model Threading Issues The fork and exec System Calls Cancellation Signal Handling Thread Pools Thread-Specific Data Pthreads Solaris 2 Threads Windows 2000 Threads Linux Threads Java Threads Thread Creation The JVM and the Host Operating System Summary
7.5 7.5.1 7.5.2 7.5.3 7.6 7.7 7.8 7.8.1 7.8.2 7.9 7.9.1 7.9.2 7.9.3 7.9.4
7.9.4.1 7.9.4.2 7.9.4.3
Classical Problems of Synchronization The Bounded-Buffer Problem The Readers-Writers Problem The Dining-Philosophers Problem Critical Regions Monitors OS Synchronization Synchronization in Solaris Synchronization in Windows 2000 Atomic Transactions System Model Log-Based Recovery Checkpoints Concurrent Atomic Transactions
Serializability Locking Protocol Timestamp-Based Protocols
7.10
Summary
8 6
6.1 6.1.1 6.1.2 6.1.3 6.1.4 6.2 6.3 6.3.1 6.3.2 6.3.3 6.3.4 6.3.5 6.3.6 6.4 6.5 6.6 6.6.1 6.6.2 6.6.3 6.6.4 6.7 6.7.1 6.7.2 6.7.3 6.8
DEADLOCKS
System Model Deadlock Characterization Necessary Conditions Resource-Allocation Graph Methods for Handling Deadlocks Deadlock Prevention Mutual Exclusion Hold and Wait No Preemption Circular Wait Deadlock Avoidance Safe State Resource-Allocation Graph Algorithm Banker's Algorithm
Safety Algorithm Resource-Request Algorithm An Illustrative Example
CPU SCHEDULING
Basic Concepts CPU-I/O Burst Cycle CPU Scheduler Preemptive Scheduling Dispatcher Scheduling Criteria Scheduling Algorithms First-Come, First-Served Scheduling Shortest-Job-First Scheduling Priority Scheduling Round-Robin Scheduling Multilevel Queue Scheduling Multilevel Feedback Queue Scheduling Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation Deterministic Modeling Queueing Models Simulations Implementation Process Scheduling Models An Example: Solaris 2 An Example: Windows 2000 An Example: Linux Summary
8.1 8.2 8.2.1 8.2.2 8.3 8.4 8.4.1 8.4.2 8.4.3 8.4.4 8.5 8.5.1 8.5.2 8.5.3
8.5.3.1 8.5.3.2 8.5.3.3
Deadlock Detection Single Instance of Each Resource Type Several Instances of a Resource Type Detection-Algorithm Usage Recovery from Deadlock Process Termination Resource Preemption Summary
9 7
7.1 7.2 7.2.1
7.2.1.1 7.2.1.2 7.2.1.3
MEMORY MANAGEMENT
Background Address Binding Logical- Versus Physical-Address Space Dynamic Loading Dynamic Linking and Shared Libraries Overlays Swapping Contiguous Memory Allocation Memory Protection Memory Allocation Fragmentation Paging Basic Method Directory Implementation
PROCESS SYNCRONIZATION
Background The Critical-Section Problem Two-Process Solution
Algorithm 1 Algorithm 2 Algorithm 3
Multiple-Process Solution Synchronization Hardware Semaphores Usage Implementation Deadlock and Starvation Hardware Support
9.1 9.1.1 9.1.2 9.1.3 9.1.4 9.1.5 9.2 9.3 9.3.1 9.3.2 9.3.3 9.4 9.4.1 12.3
9.4.3 9.4.4
9.4.4.1 9.4.4.2 9.4.4.3
Shared Pages Segmentation Basic Method Hardware Protection and Sharing Fragmentation Segmentation with Paging Summary
10
10.1 10.2 10.2.1 10.2.2 10.3 10.3.1 10.3.2 10.4 10.4.1 10.4.2 10.4.3 10.4.4 10.4.5
10.4.5.1 10.4.5.2 10.4.5.3
VIRTUAL MEMORY
Background Demand Paging Basic Concepts Performance of Demand Paging Process Creation Copy-on-Write Memory-Mapped Files Page Replacement Basic Structure FIFO Page Replacement Optimal Page Replacement LRU Page Replacement LRU Approximation Page Replacement
Additional-Reference-Bits Algorithm Second-Chance Algorithm Enhanced Second-Chance Algorithm
12.3.1 12.3.2 12.4 12.4.1 12.4.2 12.4.3 12.4.4 12.5 12.5.1 12.5.2 12.5.3 12.5.4 12.6 12.6.1 12.6.2 12.7 12.7.1 12.7.2 12.8 12.9 12.9.1 12.9.2 12.9.3 12.9.4 12.9.5 12.10
Linear List Hast Table Allocation Methods Contiguous Allocation Linked Allocation Indexed Allocation Performance Free-Space Management Bit-Vector Linked List Grouping Counting Efficiency and Performance Efficiency Performance Recovery Consistency Checking Backup and Restore Log-Structured File System NFS Overview The Mount Protocol The NFS Protocol Path-Name Translation Remote Operations Summary
Andrew S. Tanenbaum - Modern Operating Systems, Second Edition, Prentice Hall, 2001
7
7.1 7.2 7.2.1 7.2.2 7.3 7.3.1 7.3.2 7.4 7.4.1 7.4.2 7.4.3 7.4.4 7.5 7.5.1 7.5.2 7.5.3 7.6 7.6.1 7.6.2 7.6.3 7.6.4 7.6.5 7.7 7.7.1 7.7.2 7.8 7.8.1 7.8.2 7.9 7.10
10.4.6 10.4.7 10.5 10.5.1 10.5.2 10.5.3 10.6 10.6.1 10.6.2 10.6.3 10.7 10.7.1 10.7.2 10.8 10.8.1 10.8.2 10.8.3 10.8.4 10.8.5 10.8.6 10.8.7 10.9
Counting-Based Page Replacement Page-Buffering Algorithm Allocation of Frames Minimum Number of Frames Allocation Algorithms Global versus Local Allocation Thrashing Cause of Thrashing Working-Set Model Page-Fault Frequency Operating-System Examples Windows NT Solaris 2 Other Considerations Prepaging Page Size TLB Reach Inverted Page Table Program Structure I/O Interlock Real-Time Processing Summary
12
12.1 12.2 12.2.1 12.2.2 12.2.3
FILE-SYSTEM IMPLEMENTATION
File-System Structure File-System Implementation Overview Partitions and Mounting Virtual File Systems