logo资料库

Operating Systems: Principles and Practice.pdf

第1页 / 共469页
第2页 / 共469页
第3页 / 共469页
第4页 / 共469页
第5页 / 共469页
第6页 / 共469页
第7页 / 共469页
第8页 / 共469页
资料共469页,剩余部分请下载后查看
Cover
Preface
Introduction
What is an operating system?
Evaluation Criteria
A brief history of operating systems
I Kernels and Processes
The Kernel Abstraction
The process concept
Dual-mode operation
Safe control transfer
Case Study: Booting an operating system kernel
Case Study: Virtual machines
Conclusion and future directions
The Programming Interface
Process management
Input/output
Case Study: Implementing a shell
Case Study: Interprocess communication
Operating system structure
Conclusion and future directions
II Concurrency
Concurrency and Threads
Threads: Abstraction and interface
Simple API and example
Thread internals
Implementation details
Asynchronous I/O and event-driven programming
Conclusion and future directions
Synchronizing Access to Shared Objects
Challenges
Shared objects and synchronization variables
Lock: Mutual Exclusion
Condition variables: Waiting for a change
Implementing synchronization objects
Designing and implementing shared objects
Conclusions
Advanced Synchronization
Multi-object synchronization
Deadlock
Alternative approaches to synchronization
Conclusion
Scheduling
Uniprocessor scheduling
Multiprocessor scheduling
Energy-aware scheduling
Real-time scheduling
Queuing theory
Case Study: data center servers
III Memory Management
Address Translation
Address translation concept
Segmentation and Paging
Efficient address translation
Software address translation
Conclusions and future directions
Caching and Virtual Memory
Cache concept: when it works and when it doesn't
Hardware cache management
Memory mapped files and virtual memory
Conclusions and future directions
Applications of Memory Management
Zero copy input/output
Copy on write
Process checkpointing
Recoverable memory
Information flow control
External pagers
Virtual machine address translation
Conclusions and future directions
IV Persistent Storage
File Systems: Introduction and Overview
The file system abstraction
API
Software layers
Conclusions and future directions
Storage Devices
Magnetic disk
Flash storage
Conclusions and future directions
Files and Directories
Accessing files: API and caching
Files: Placing and finding data
Directories: Naming data
Putting it all together: File access in FFS
Alternatives to file systems
Reliable Storage
Transactions: Atomic updates
Error detection and correction
Conclusion and future directions
V Index
Index
Operating Systems Principles and Practice Anderson and Dahlin v. 0.22
Operating Systems: Principles and Practice Base revision e8814fe, Fri Jan 13 14:51:02 2012 -0600. Version 0.22 Copyright c2011-2012 by Thomas Anderson and Michael Dahlin, all rights reserved.
Contents Preface 1 Introduction 1.1 What is an operating system? 1.2 Evaluation Criteria 1.3 A brief history of operating systems I Kernels and Processes 2 The Kernel Abstraction 2.1 The process concept 2.2 Dual-mode operation 2.3 Safe control transfer 2.4 Case Study: Booting an operating system kernel 2.5 Case Study: Virtual machines 2.6 Conclusion and future directions 3 The Programming Interface Input/output 3.1 Process management 3.2 3.3 Case Study: Implementing a shell 3.4 Case Study: Interprocess communication 3.5 Operating system structure 3.6 Conclusion and future directions II Concurrency 4 Concurrency and Threads 4.1 Threads: Abstraction and interface 4.2 Simple API and example 4.3 Thread internals 4.4 4.5 Asynchronous I/O and event-driven programming Implementation details v 1 4 20 28 39 41 45 47 61 89 91 94 101 107 114 119 121 124 130 135 137 138 145 149 155 172
Contents 4.6 Conclusion and future directions 5 Synchronizing Access to Shared Objects Lock: Mutual Exclusion 5.1 Challenges 5.2 Shared objects and synchronization variables 5.3 5.4 Condition variables: Waiting for a change 5.5 5.6 Designing and implementing shared objects 5.7 Conclusions Implementing synchronization objects 6 Advanced Synchronization 6.1 Multi-object synchronization 6.2 Deadlock 6.3 Alternative approaches to synchronization 6.4 Conclusion 7 Scheduling 7.1 Uniprocessor scheduling 7.2 Multiprocessor scheduling 7.3 Energy-aware scheduling 7.4 Real-time scheduling 7.5 Queuing theory 7.6 Case Study: data center servers III Memory Management 8 Address Translation 8.1 Address translation concept 8.2 Segmentation and Paging 8.3 Efficient address translation 8.4 Software address translation 8.5 Conclusions and future directions 9 Caching and Virtual Memory 9.1 Cache concept: when it works and when it doesn’t 9.2 Hardware cache management 9.3 Memory mapped files and virtual memory 9.4 Conclusions and future directions 10 Applications of Memory Management 10.1 Zero copy input/output 10.2 Copy on write 10.3 Process checkpointing 10.4 Recoverable memory 10.5 Information flow control ii 175 179 182 189 192 199 212 224 245 251 253 260 278 287 291 294 306 311 312 312 315 317 319 319 320 320 320 320 321 321 322 322 322 323 323 323 323 323 323
iii CONTENTS 10.6 External pagers 10.7 Virtual machine address translation 10.8 Conclusions and future directions IV Persistent Storage 11 File Systems: Introduction and Overview 11.1 The file system abstraction 11.2 API 11.3 Software layers 11.4 Conclusions and future directions 12 Storage Devices 12.1 Magnetic disk 12.2 Flash storage 12.3 Conclusions and future directions 13 Files and Directories 13.1 Accessing files: API and caching 13.2 Files: Placing and finding data 13.3 Directories: Naming data 13.4 Putting it all together: File access in FFS 13.5 Alternatives to file systems 14 Reliable Storage 14.1 Transactions: Atomic updates 14.2 Error detection and correction 14.3 Conclusion and future directions V Index Index 323 324 324 325 327 332 339 343 351 353 354 369 376 385 386 388 393 394 394 397 401 421 447 453 455
Contents iv
Preface Why We’re Writing This Book There has been a huge amount of innovation in both the principles and practice of operating systems over the past two decades. The pace of innovation in operating systems has, if anything, increased over the past few years, with the introduction of the iOS and Android operating systems for smartphones, the shift to multicore computers, and the advent of cloud computing. Yet many operating systems textbooks treat the field as if it is static — that almost everything we need to cover in our classes was invented in the 60’s and 70’s. No! We strongly believe that students both need to, and can, understand modern operating systems concepts and modern implementation techniques. At Texas and Washington, we have been teaching the topics covered in this textbook for years, winning awards for our teaching. The approach in this book is the same one we use in organizing our own courses: that it is essential for students to learn both principles and practice, that is, both concepts and implementation, rather than either alone. Although this book focuses on operating systems, we believe the concepts and principles are important for anyone getting a degree in computer science or computer engineering. The core ideas in operating systems — protection, con- currency, virtualization, resource allocation, and reliable storage — are widely used throughout computer science. Anyone trying to build resilient, secure, flexible computer systems needs to have a deep grounding in these topics and to be able to apply these concepts in a variety of settings. This is especially true in a modern world where nearly everything a user does is distributed, and nearly every computer is multi-core. Operating systems concepts are popping up in many different areas; even web browsers and cloud computing platforms have become mini-operating systems in their own right. Precisely because operating systems concepts are among the most difficult in all of computer science, it is also important to ground students in how these ideas are applied in practice in real operating systems of today. In this book, we give students both concepts and working code. We have designed the book to support and be complemented with a rigorous operating systems course project, v
Contents vi such as Nachos, Pintos, JOS, or Linux. Our treatment, however, is general — it is not our intent to completely explain any particular operating system or course project. Because the concepts in this textbook are so fundamental to much of the practice of modern computer science, we believe a rigorous operating systems course should be taken early in an undergraduate’s course of study. For many students, an operating systems class is the ticket to an internship and even- tually to a full-time position. We have designed this textbook assuming only that students have taken a class on data structures and one on basic machine structures. In particular, we have designed our book to interface well if students have used the Bryant and O’Halloran textbook on machine structures. Since some schools only get through the first half of Bryant and O’Halloran in their machine structures course, our textbook reviews and covers in much more depth the material from the second half of that book. An Overview of the Content The textbook is organized to allow each instructor to choose an appropriate level of depth for each topic. Each chapter begins at a conceptual level, with implementation details and the more advanced material towards the end. A more conceptual course will skip the back parts of several of the chapters; a more advanced or more implementation-oriented course will need to go into chapters in more depth. No single semester course is likely to be able to cover every topic we have included, but we think it is a good thing for students to come away from an operating systems course with an appreciation that there is still a lot for them to learn. Because students learn more by needing to solve problems, we have inte- grated some homework questions into the body of each chapter, to provide students a way of judging whether they understood the material covered to that point. A more complete set of sample assignments is given at the end of each chapter. The book is divided into five parts: an introduction (Chapter 1), kernels and processes (Chapters 2-3), concurrency, synchronization and scheduling (Chap- ters 4-7), memory management (Chapters 8-10), and persistent storage (Chap- ters 11-13). The goal of chapter 1 is to introduce the recurring themes found in the later chapters. We define some common terms, and we provide a bit of the history of the development of operating systems. Chapter 2 covers kernel-based process protection — the concept and imple- mentation of executing a user program with restricted privileges. The concept of protected execution and safe transfer across privilege levels is a key concept to most modern computer systems, given the increasing salience of computer security issues. For a quick introduction to the concepts, students need only
分享到:
收藏