OPERATING SYSTEMS
Internais and Design Principles
F O U R T H E D I T I O N
William Stallings, P h . D .
Prentice Hall
CONTENTS
Web Site for Operating Systems: Internais and Design Principles, vi Preface, ix
Chapter 0 Reader's Guide, 1
0.1 Outline of the Book, 2 0.2 Topic Ordering, 3
0.3 Internet and Web Resources, 4
PART ONE BACKGROUND, 7
Chapter 1 Computer System Overview, 9
1.1 Basic Elements, 10 1.2 Processor Registers, 11 1.3 Instruction Execution, 14 1.4 Interrupts, 17
1.5 The Memory Hierarchy, 28 1.6 Cache Memory, 31
1.7 I/O Communication Techniques, 35 1.8 Recommended Reading, 38
1.9 Problems, 39
Appendix 1A Performance Characteristics of Two-Level Memory, 41
Appendix 1B Procedure Control, 48
Chapter 2 Operating System Overview, 53
2.1 Operating System Objectives and Functions, 54 2.2 The Evolution of Operating Systems, 58 2.3 Major Achievements, 68
2.4 Characteristics of Modern Operating Systems, 80 2.5 Windows 2000 Overview, 83
XIV CONTENTS
2.6 Traditional UNIX Systems, 93 2.7 Modern UNIX Systems, 96 2.8 Recommended Reading, 100 2.9 Problems, 101
PART T W O PROCESSES, 103
Chapter 3 Process Description and Control, 107
3.1 Process States, 108 ,3.2 Process Description, 124
3.3 Process Control, 133
3.4 UNIX SVR4 Process Management, 142
3.5 Summary, Key Terms, and Review Questions, 147 3.6 Recommended Reading, 148
3.7 Problems, 149
Chapter 4 Threads, SMP, and Microkernels, 153
4.1 Processes and Threads, 154 4.2 Symmetrie Multiprocessing, 169 4.3 Microkernels, 172
4.4 Windows 2000 Thread and SMP Management, 179 4.5 Solaris Thread and SMP Management, 184
4.6 Linux Process and Thread Management, 190 4.7 Summary, Key Terms, and Review Questions, 192 4.8 Recommended Reading, 193
4.9 Problems, 194
Chapter 5 Concurrency: Mutual Exclusion and Synchronization,
5.1 Principles of Concurrency, 199
5.2 Mutual Exclusion: Software Approaches, 208 5.3 Mutual Exclusion: Hardware Support, 212 5.4 Semaphores, 217
5.5 Monitors, 234 5.6 Message Passing, 241
5.7 Readers/Writers Problem, 248
5.8 Summary, Key Terms, and Review Questions, 253 5.9 Recommended Reading, 254
5.10 Problems, 255
Chapter 6 Concurrency: Deadlock and Starvation, 265
6.1 Principles of Deadlock, 266 6.2 Deadlock Prevention, 273 6.3 Deadlock Avoidance, 275
C O N T E N T S XV
6.4 Deadlock Detection, 280
6.5 An Integrated Deadlock Strategy, 282 6.6 Dining Philosophers Problem, 283 6.7 UNIX Concurrency Mechanisms, 285
6.8 Solaris Thread Synchronization Primitives, 287 6.9 Windows 2000 Concurrency Mechanisms, 291 6.10 Summary, Key Terms, and Review Questions, 293 6.11 Recommended Reading, 293
6.12 Problems, 294
PART THREE MEMORY, 299
Chapter 7 Memory Management, 301
7.1 Memory Management Requirements, 302 7.2 Memory Partitioning, 305
7.3 Paging, 317 7.4 Segmentation, 321
7.5 Summary, Key Terms, and Review Questions, 323 7.6 Recommended Reading, 323
7.7 Problems, 324
Appendix 7A Loading and Linking, 325
Chapter 8 Virtual Memory, 333
8.1 Hardware and Control Structures, 334 8.2 Operating System Software, 353
8.3 UNIX and Solaris Memory Management, 372 8.4 Linux Memory Management, 378
8.5 Windows 2000 Memory Management, 380
8.6 Summary, Key Terms, and Review Questions, 382 8.7 Recommended Reading, 383
8.8 Problems, 384
Appendix 8A Hash Tables, 387
P A R T F O U R SCHEDULING, 391
Chapter 9 Uniprocessor Scheduling, 393
9.1 Types of Scheduling, 394 9.2 Scheduling Algorithms, 398 9.3 Traditional UNIX Scheduling, 422
9.4 Summary, Key Terms, and Review Questions, 424 9.5 Recommended Reading, 425
x v i CONTENTS
9.6 Problems, 426
Appendix 9A Response Time, 428 Appendix 9B Queuing Systems, 431
Chapter 10 Multiprocessor and R e a l - T i m e Scheduling, 437
10.1 Multiprocessor Scheduling, 438 10.2 Real-Time Scheduling, 450 10.3 Linux Scheduling, 462 10.4 UNIX SVR4 Scheduling, 463 « 10.5 Windows 2000 Scheduling, 465
'10.6 Summary, Key Terms, and Review Questions, 468 10.7 Recommended Reading, 469
10.8 Problems, 469
PART FIVE INPUT/OUTPUT AND FILES, 471
Chapter 11 I / O Management and Disk Scheduling, 473
11.1 I/O Devices, 474
11.2 Organization of the I/O Function, 475 11.3 Operating System Design Issues, 480 11.4 I/O Buffering, 483 11.5 Disk Scheduling, 486 11.6 RAID, 493 11.7 Disk Cache, 502 11.8 UNIX SVR4 I/O, 506 11.9 Windows 2000 I/O, 509
11.10 Summary, Key Terms, and Review Questions, 511 11.11 Recommended Reading, 513
11.12 Problems, 514
Appendix I I A Disk Storage Devices, 515
Chapter 12 File Management, 525
12.1 Overview, 526
12.2 File Organization, 531 12.3 File Directories, 536 12.4 File Sharing, 539 12.5 Record Blocking, 541
12.6 Secondary Storage Management, 543 12.7 UNIX File Management, 552
12.8 Windows 2000 File System, 554
C O N T E N T S XVÜ 12.10 Recommended Reading, 561 12.11 Problems, 562
PART SIX
Chapter 13 Chapter 14DISTRIBUTED SYSTEMS, 565
Distributed Processing, Client/Server, and Clusters,
13.1 13.2 13.3 13.4 13.5 13.6 13.7 13.8 13.9 13.10 Client/Server Computing, 571 Distributed Message Passing, 583 Remote Procedure Calls, 586 Clusters, 590
Windows 2000 Cluster Server, 596 Sun Cluster, 598
Beowulf and Linux Clusters, 601
Summary, Key Terms, and Review Questions, 603 Recommended Reading, 604
Problems, 605
Distributed Process Management, 607
14.1 14.2 14.3 14.4 14.5 14.6 14.7 Process Migration, 608 Distributed Global States, 615 Distributed Mutual Exclusion, 620 Distributed Deadlock, 631
Summary, Key Terms, and Review Questions, 643 Recommended Reading, 643
Problems, 644
PART SEVEN SECURITY, 645
Chapter 15 Computer Security, 647
15.1 15.2 15.3 15.4 15.5 15.6 15.7 15.8 15.9 Security Threats, 648 Protection, 653 Intruders, 657 Malicious Software, 669 Trusted Systems, 679 Windows 2000 Security, 683
Summary, Key Terms, and Review Questions, 687 Recommended Reading, 689
Problems, 690
XVÜi CONTENTS
APPENDICES
Appendix A T C P / I P , 699
A.l The Need for a Protocol Architecture, 699 A.2 The TCP/IP Protocol Architecture, 700
Appendix B Object-Oriented Design, 709
B.l Motivation, 709
, B.2 Object-Oriented Concepts, 709
B.3 Benefits of Object-Oriented Design, 714 B.4 CORBA, 715
Appendix C Programming and Operating System Projects, 719
C.l Projects for Teaching Operating Systems, 719 C.2 Nachos, 720
C.3 Research Projects, 721 C.4 Programming Projects, 722 C.5 Reading/Report Assignments, 722
Appendix D OSP: A n Environment for Operating System Projects, 723
D.l Overview, 723
D.2 Innovative Aspects of OSP, 726
D.3 Comparison with Other Operating System Courseware, 728 D.4 The OSP Software Distribution, 729
D.5 OSP Mailing List, 729 D.6 Future Plans, 730
Appendix E BACI: The Ben-Ari Concurrent Programming System, 731
E.l Introduction, 731 E.2 BACI, 732
E.3 Examples of BACI Programs, 735 E.4 BACI Projects, 739
E.5 Enhancements to the BACI System, 742
Glossary, 743 References, 757 Index, 771