Docsity
Docsity

Prepara tus exámenes
Prepara tus exámenes

Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity


Consigue puntos base para descargar
Consigue puntos base para descargar

Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium


Orientación Universidad
Orientación Universidad

Conceptos de Sistemas Operativos, Apuntes de Sistemas Operativos

Silberschatz - Manual de sistemas operativos

Tipo: Apuntes

2022/2023

Subido el 24/09/2023

bruno-3yx
bruno-3yx 🇦🇷

1 documento

1 / 1251

Toggle sidebar

Esta página no es visible en la vista previa

¡No te pierdas las partes importantes!

bg1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Vista previa parcial del texto

¡Descarga Conceptos de Sistemas Operativos y más Apuntes en PDF de Sistemas Operativos solo en Docsity!

OPERATING SYSTEM CONCEPTS with JAVA

ABRAHAM SILBERSCHATZ

Yale University

PETER BAER GALVIN

Corporate Technologies, Inc.

GREG GAGNE

Westminster College

SIXTH EDITION

JOHN WILEY & SONS, INC.

ACQUISITIONS EDITOR

Paul Crockett

MARKETING MANAGER

Ilse Wolfe

SENIOR PRODUCTION EDITOR

Ken Santor

COVER DESIGNER

Madelyn Lesure

To my parents, Marlene and Roland, my wife, Pat, and my sons, Tom and Jay

Greg Gagne

PREFACE

PART ONE OVERVIEW

An operating system is a program that acts as an intermediary between the user of a computer and the computer hardware. The purpose of an operating system is to provide an environment in which a user can execute programs in a convenient and efficient manner.

Understanding the evolution of operating systems gives us an appreciation for what an operating system does and how it does it. We trace the development of operating systems from the first hands-on systems, through multiprogrammed and time-shared systems, to current handheld and real-time systems.

The operating system must ensure the correct operation of the computer system. The hardware must provide appropriate mechanisms to prevent user programs from interfering with the proper operation of the system. We describe the basic computer architecture taht makes it possible to write a correct operating system.

The operating system provides certain services to programs and to the users of those programs in order to make their tasks easier. The services differ from one operating system to another, but we identify and explore some common classes of these services.

Chapter 1 INTRODUCTION

Chapter 2 COMPUTER-SYSTEM STRUCTURES

Chapter 3 OPERATING-SYSTEM STRUCTURES

PART TWO PROCESS MANAGEMENT

A process can be thought of as a program in execution. A process will needcertain resources - such as CPU time, memory files, and I/O devices - to accomplish its task. These resources are allocated to the process either when it is created or while it is executing.

A process is the unit of work in most systems. Such a system consists of a collection of processes: Operating-system processes execute system code, and user processes execute user code. All these processes may execute concurrently.

Although traditionally, a process contained only a single thread of control as it ran, most modern operating systems now support processes that have multiple threads.

the operating system is responsible for the following activities in connection with process and thread management: the creation and deletion of both user and system processes; the scheduling of processes; and the provision of mechanisms for synchronization, communication, and deadlock handling for processes.

Chapter 4 PROCESSES

Chapter 5 THREADS

by the operating system onto physical devices. Files are normally organized into directories to ease their use.

Chapter 9 MEMORY MANAGEMENT

Chapter 10 VIRTUAL MEMORY

Chapter 11 FILE-SYSTEM INTERFACE

Chapter 12 FILE-SYSTEM IMPLEMENTATION

PART FOUR I/O SYSTEMS

The devices that attach to a computer vary in many aspects. Some devices transfer a character or a block of characters at a time. Some can be accessed only sequentially, others randomly. Some transfer data synchronously, others asynchronously. Some are dedicated, some shared. They can be read-only or read-write. they vary greatly in speed. In many ways they are also the slowest major component of the computer.

Because of all this device variation, the operating system needs to provide a wide range of functionality to applications, to alllow them to control all aspects of the devices. One key goal of an operating system's I/O subsystem is to provide the simplest interface possible to the rest of the system. Because devices are a performance bottleneck, another key is to optimize I/O for maximum concurrency. We initially describe the myriad variations of I/O devices and the ways in which ooperating systems control them. Afterwards we discuss the more complicated I/O devices used for secondary and tertiary storage, and we explain the special attention that operating systems muct give them.

Chapter 13 I/O Systems

Chapter 14 MASS-STORAGE STRUCTURE

PART FIVE DISTRIBUTED SYSTEMS

A distributed system is a collection of processors that do not share memory or a clock. Instead, each processor has its own local memory, and the processors communicate well with each other through communication lines such as local- or wide-area networks. The processors in a distributed system vary in size and function. Such systems may include small handheld or real-time devices, personal computers, workstations, and large mainframe computer systems.

The benefits of a distributed system include user access to the resources maintained by the system and therefore computation speedup and improved data availability and reliability. A distributed file system is a file-service system whole users, servers, and storage devices are dispersed among the sites of a distributed system. Accordingly, service activity has to be carried outacross the network; instead of a single centralized data repository, there are multiple and independent storage devices.

Because a system is distributed, however, it must provide mechanisms for process synchronization and communication, for dealing with the deadlock problems, and for dealing with failures that are not encountered in a centralized system.

Chapter 15 DISTRIBUTED SYSTEM STRUCTURES

Chapter 16 DISTRIBUTED FILE SYSTEMS

Chapter 18 PROTECTION

Chapter 19 SECURITY

PART SEVEN CASE STUDIES

We can now integrate the concepts described in this book by describing real operating systems. Two such systems are covered in great detail—Linux and Windows XP. We chose Linux for several reasons: it is popular, it is freely available, and it has a representation of a full-featured UNIX system. This provides a student of operating systems an opportunity to read—and modify — real operating system source code.

We also cover Windows XP in great detail. This recent operating system from Microsoft is gaining popularity, not only for the stand-alone-machine market, but also in the workgroup–server market. We chose Windows XP because it provides an opportunity for us to study a modern operating system that has a design and implementation drastically different from those of UNIX.

In addition, we briefly discuss other highly influential operating systems. We have chosen the order of presentation to highlight the similarities and differences among the systems; it is not strictly chronological and does not reflect the relative importance of the system.

Finally, we provide on-line coverage of three other systems. The FreeBSD system is another UNIX system. However, whereas Linux adopted the approach of combining

features from several UNIX systems, FreeBSD is based upon the BSD model of UNIX. Like Linux, FreeBSD source code is freely available. The Mach operating system is a modern operating system that provides compatibility with BSD UNIX. Windows 2000 is another modern operating system from Microsoft for Intel Pentium and later microprocessors, which is compatible with MS-DOS and Microsoft Windows applications.

Chapter 20 THE LINUX SYSTEM

Chapter 21 WINDOWS XP

Chapter 22 INFLUENTIAL OPERATING SYSTEMS

Back Matter

Appendix A THE FREEBSD SYSTEM

Appendix B THE MACH SYSTEM

Appendix C WINDOWS 2000

Appendix D DISTRIBUTED COMMUNICATION

Appendix E JAVA PRIMER

BIBLIOGRAPHY

CREDITS

Content of this Book

The text is organized in seven major parts:

  • Overview: Chapters 1 through 3 explain what operating systems are , what they do , and how they are designed and constructed. They explain how the concept of an operating system has developed, what the common features of an operating system are, what an operating system does for the user, and what it does for the computer- system operator. The presentation is motivational, historical, and explanatory in nature. We have avoided a discussion of how things are done internally in these chapters. Therefore, they are suitable for individuals or for students in lower-level classes who want to learn what an operating system is, without getting into the details of the internal algorithms. Chapter 2 covers the hardware topics that are important to an understanding of operating systems. Readers well versed in hardware topics, including I /O , DMA , and hard-disk operation, may choose to skim or skip this chapter.
  • Process management: Chapters 4 through 8 describe the process concept and concurrency as the heart of modern operating systems. A process is the unit of work in a system. Such a system consists of a collection of concurrently executing processes, some of which are operating-system processes (those that execute system code), and the rest of which are user processes (those that execute user code). These chapters cover methods for process scheduling, interprocess communication, process synchronization, and deadlock handling. Also included under this topic is a discussion of threads.
  • Storage management: Chapters 9 through 12 deal with a process in main memory during execution. To improve both the utilization of the CPU and the speed of its response to its users, the computer must keep several processes in memory. There are many different memory-management schemes reflecting various approaches to memory management, and the effectiveness of the different algorithms depends on the situation. Since main memory is usually too small to accommodate all data and programs, and since it cannot store data permanently, the computer system must provide secondary storage to back up main memory. Most modern computer systems use disks as the primary on-line storage medium for information, both programs and data. The file system provides the mechanism for on-line storage of and access to both data and programs residing on the disks. These chapters describe the classic internal algorithms and structures of storage management. They provide a firm practical understanding of the algorithms used— the properties, advantages, and disadvantages.
  • I /O systems: Chapters 13 and 14 describe the devices that attach to a computer and the multiple dimensions on which they vary. Because these devices differ so widely, the operating system needs to provide a wide range of functionality to applications to allow them to control all aspects of the devices. This section discusses system I /O in depth, including I /O system design, interfaces, and internal system structures and functions. In many ways, I /O devices are also the slowest major components of the computer. Because they are a performance bottleneck, performance issues are examined. Matters related to secondary and tertiary storage are explained as well.
  • Distributed systems: Chapters 15 through 17 deal with a collection of processors that do not share memory or a clock—a distributed system. By providing the user with access to the various resources that it maintains, a distributed system can improve computation speed and data availability and reliability. Such a system also provides the user with a distributed file system, which is a file-service system whose users, servers, and storage devices are dispersed among the sites of a distributed system. A distributed system must provide various mechanisms for process synchronization and communication and for dealing with the deadlock problem and the variety of failures that are not encountered in a centralized system.
  • Protection and security: Chapters 18 and 19 discuss the processes in an operating system that must be protected from one another's activities. For the purposes of protection and security, we use mechanisms that ensure that only processes that have gained proper authorization from the operating system can operate on the files, memory segments, CPU, and other resources. Protection is a mechanism for controlling the access of programs, processes, or users to the resources defined by a computer system. This mechanism must provide a means of specifying the controls to be imposed, as well as a means of enforcement. Security protects the information stored in the system (both data and code), as well as the physical resources of the computer system, from unauthorized access, malicious destruction or alteration, and accidental introduction of inconsistency.
  • Case studies: Chapters 20 through 22 in the book, and Appendices A through C on the website, integrate the concepts described in this book by describing real operating systems. These systems include Linux, Windows XP , Windows 2000, F ree BSD, and Mach. We chose Linux and Free BSD because UNIX —at one time—was almost small enough to understand yet was not a "toy" operating system. Most of its internal algorithms were selected for simplicity , rather than for speed or sophistication. Both Linux and F ree BSD are readily available to computer-science departments, so many students have access to these systems. We chose Windows XP
  • Chapter 3, Operating-System Structures, features updated coverage of system structures, including microkernels and loadable modules, as well as updated coverage of virtual machines and the Java virtual machine (JVM ).
  • Chapter 4, Processes, now discusses communication in client-server systems, including sockets, remote procedure calls ( RPCs), and Java's remote method invocation (RMI ). It also has updated coverage of message passing in Windows XP.
  • Chapter 5, Threads, offers new material on Pthreads; threading issues, including cancellation, thread pools, thread-specific data and scheduler activations, and threading in Windows XP and Linux. In addition, new Java programs illustrate thread cancellation and thread-specific data.
  • Chapter 6, CPU Scheduling, has new coverage of the scheduling API in Pthreads and scheduling in Solaris, Windows XP , and Linux.
  • Chapter 7, Process Synchronization, now covers atomic transactions and describes synchronization in Windows XP , Linux, and Pthreads.
  • Chapter 8, Deadlocks, has expanded coverage of deadlock avoidance, including the banker's algorithm.
  • Chapter 9, Memory Management, has updated coverage of paging, including hierarchical and hashed page tables. Also updated is coverage of segmentation on Pentium systems.
  • Chapter 10, Virtual Memory, features new material motivating the use of virtual memory, including copy-on-write, shared memory, and shared libraries. It also has new coverage of memory-mapped files and updated coverage of memory management in Windows XP and Solaris.
  • Chapters 11 and 12, File-System Interface and File-System Implementation, are based on the previous Chapter 11. Coverage of most topics is expanded, and coverage of NFS has been brought forward from the Distributed File System chapter (Chapter 16).
  • Chapter 13, I /O , has a new STREAMS section.
  • Chapter 14, Mass Storage Structure, is based on the previous Chapter 13 but includes new discussions of RAID and disk attachment.
  • Chapter 15, Distributed System Structures, is the previous Chapter 14, with an expanded discussion of topology.
  • Chapter 16, Distributed File Systems, is the previous Chapter 17, with the NFS example replaced by AFS. NFS is now covered in Chapter 12.
  • Chapter 17, Distributed Coordination, is the previous Chapter 16, with added sections on atomicity and concurrency control.
  • Chapter 18, Security, has new coverage of Java security.
  • Chapter 19, Security, features a new section on securing systems and facilities.
  • Case Studies have been reorganized. Older operating systems have been moved to on-line appendices, and the discussion of the Nachos system has been removed from the appendices. For more information on Nachos, please refer to the project web site at http://www.cs.washington.edu/homes/tom/nachos.
  • Java Primer is now an on-line appendix.

Java

This book uses Java to illustrate many operating-system concepts, such as multitasking, CPU scheduling, process synchronization, deadlock, security, and distributed systems. Java is more a technology than a programming language, so it is an excellent vehicle for demonstrations.

Java was originally developed as a language to program microprocessors in consumer devices such as cellular telephones and set-top boxes. The advent of the Web in the mid-1990s showed the Java team at Sun Microsystems the language's potential usefulness across the Internet: Programmers can use Java to write applications and applets —programs that run on web pages. Java also provides support for development of database applications, graphical user interfaces (GUI s), reusable objects, and two-dimensional and three-dimensional modeling, to name a few. All such programs can run on a single computer or on a distributed system across the Internet.

We provide an overview of Java technology in Chapter 3 and illustrate the creation and coordination of multithreaded Java programs in Chapters 5 and 7. In Chapter 4, we use Java to demonstrate how different processes can communicate using shared memory and message passing. In Chapter 6, we use Java to demonstrate (^) CPU - scheduling algorithms; in Chapter 8, we illustrate deadlock and deadlock-recovery methods using Java. Chapters 10 and 11 use Java to demonstrate memory-mapped I /O and file locking, respectively. Java programs are used in Chapter 4 to illustrate

The web page for the book contains such material as a set of slides to accompany the book, model course syllabi, Java source code, and up-to-date errata. The web page also contains the book's three case study appendices, the Java Primer appendix, and the Distributed Communication appendix (Chapter 15 from AOSC. The URL is:

http://www.os-book.com

To obtain restricted supplements, contact your local John Wiley & Sons sales representative. You can find your representative at the "Find a Rep?" web page: http://www.jsw-edcv.wiley.com/college/findarep.

Mailing List

We have switched to the mailman system for communication among the users of Operating System Concepts. If you wish to use this facility, please visit the following URL and follow the instructions there to subscribe:

http://mailman.cs.yale.edu/mailman/listinfo/os-book-list

The mailman mailing list system provides many benefits, such as an archive of postings, and several subscription options, including digest and Web only. To send messages to the list, send e-mail to:

os-book-list@cs.yale.edu

Depending on the message, we will either reply to you personally or forward the message to everyone on the mailing list. The list is moderated, so you will receive no inappropriate mail.

Students who are using this book as a text for class should not use the list to ask for answers to the exercises. They will not be provided.

Suggestions

We have attempted to clean up every error in this new edition, but—as happens with operating systems—a few obscure bugs may remain. We would appreciate hearing from you about any textual errors or omissions that you identify.

If you would like to suggest improvements or to contribute exercises, we would also be glad to hear from you. Please send correspondence to os-book@cs.yale.edu.

Acknowledgments

This book is derived from the previous editions, the first three of which were coauthored by James Peterson. Others who helped us with previous editions include Hamid Arabnia, Rida Bazzi, Randy Bentson, David Black, Joseph Boykin, Jeff Brumfield, Gael Buckley, Roy Campbell, P. C. Capon, John Carpenter, Gil Carrick, Thomas Casavant, Ajoy Kumar Datta, Joe Deck, Sudarshan K. Dhall, Thomas Doeppner, Caleb Drake, M. Raşit Eskicioğlu, Hans Flack, Robert Fowler, G. Scott Graham, Richard Guy, Max Hailperin, Rebecca Hartman, Wayne Hathaway, Christopher Haynes, Mark Holliday, Ahmed Kamel, Richard Kieburtz, Carol Kroll, Morty Kwestel, Thomas LeBlanc, John Leggett, Jerrold Leichter, Ted Leung, Gary Lippman, Carolyn Miller, Michael Molloy, Yoichi Muraoka, Jim M. Ng, Banu Özden, Ed Posnak, Boris Putanec, Charles Qualline, John Quarterman, Gustavo Rodriguez- Rivera, Carolyn J. C. Schauble, Thomas P. Skinner, Yannis Smaragdakis, Jesse St. Laurent, John Stankovic, Adam Stauffer, Steven Stepanek, Hal Stern, Louis Stevens, Pete Thomas, David Umbaugh, Steve Vinoski, Tommy Wagner, Larry L. Wear, John Werth, James M. Westall, J. S. Weston, and Yang Xiang

We thank the following people who contributed to this edition of the book: Bruce Hillyer reviewed and helped with the rewrite of Chapters 2, 12, 13, and 14. Mike Reiter reviewed and helped with the rewrite of Chapter 18. Parts of Chapter 14 were derived from a paper by Hillyer and Silberschatz [1996]. Parts of Chapter 17 were derived from a paper by Levy and Silberschatz [1990]. Chapter 20 was derived from an unpublished manuscript by Stephen Tweedie. Chapter 21 was derived from an unpublished manuscript by Dave Probert, Cliff Martin, and Avi Silberschatz. Appendix C was derived from an unpublished manuscript by Cliff Martin. Cliff Martin also helped with updating the UNIX appendix to cover F ree BSD. Mike Shapiro reviewed the Solaris information, and Jim Mauro answered several Solaris-related questions.

We thank the following people who reviewed this version of the book: Djamel Bouchaffra, Tom Boyd, Daren Che, Robert Chun, John Collins, Douglas Jones, Ben Miller, Paul Lu, Gustavo Rodriguez-Rivera, Carolyn Schauble, Charles Shub, Dan Stanzione, Paul Stelling

Our Acquisitions Editor, Paul Crockett, provided expert guidance as we prepared this edition. Paul was assisted by Simon Durkin, who managed many details of this project smoothly. The Senior Production Editor was Ken Santor. The cover illustrator was Susan Cyr, and the cover designer was Madelyn Lesure. Barbara Heaney was in charge of overseeing the copy editing, and Beverly Peavler copy-edited the