Posted on. Page Count. William Stallings,. Teaching and Learning Experience This program presents a better teaching and learning experience—for you and your students. It will help: Illustrate Concepts with Running Case Studies: To illustrate the concepts and to tie them to real-world design choices that must be made, four operating systems serve as running examples.
In spite of this variety and pace of change, certain fundamental concepts apply consistently throughout. To be sure, the application of these concepts depends on the current state of technology and the particular application requirements. The intent of this book is to provide a thorough discussion of the fundamentals of operating system design, and to relate these to contemporary design issues and to current directions in the development of operating systems.
This text is intended to acquaint the reader with the design principles and implementation issues of contemporary operating systems.
Accordingly, a purely conceptual or theoretical treatment would be inadequate. This operating system incorporates many of the latest developments in operating system technology. In addition, Windows is one of the first important commercial operating systems to rely heavily on object-oriented design principles.
This book covers the technology used in the most recent version of Windows, known as Windows Focusing on the unique requirements of the embedded environment, the book provides details of Android internals.
No preemption: No car is allowed to force another car out of its way. Circular wait: Each car is waiting for a quadrant of the intersection occupied by another car. No preemption approach: releasing an assigned quadrant is problematic, because this means backing up, which may not be possible if there is another car behind this car. Circular-wait approach: assign a linear ordering to the quadrants. Avoidance: The algorithms discussed in the chapter apply to this problem.
Essentially, deadlock is avoided by not granting requests that might lead to deadlock. Detection: The problem here again is one of backup. Q acquires B and A, and then releases B and A. When P resumes execution, it will be able to acquire both resources. Q acquires B and A. P executes and blocks on a request for A. Q releases B and A. Q acquires B and then P acquires and releases A. Q acquires A and then releases B and A.
When P resumes execution, it will be able to acquire B. P acquires A and then Q acquires B. P releases A.
Q acquires A and then releases B. P acquires B and then releases B. P acquires and then releases A. P acquires B. Q executes and blocks on request for B. P releases B. When Q resumes execution, it will be able to acquire both resources. P acquires A and releases A and then acquires and releases B.
However, once P releases A, Q can proceed. Once Q releases B, A can proceed. Running the banker's algorithm, we see processes can finish in the order p1, p4, p5, p2, p3. Change available to 2,0,0,0 and p3's row of "still needs" to 6,5,2,2. Now p1, p4, p5 can finish, but with available now 4,6,9,8 neither p2 nor p3's "still needs" can be satisfied. So it is not safe to grant p3's request. Mark P1; no deadlock detected 6. So P cannot be delayed indefinitely by O.
By examining the resource constraints listed in the solution to problem 6. Procedure returns can take place immediately because they only release resources.
Output consumption can take place immediately after output becomes available. Output production can be delayed temporarily until all previous output has been consumed and made at least reso pages available for further output. Input consumption can take place immediately after input becomes available. Input production can be delayed until all previous input and the corresponding output has been consumed.
Conclusion: the uncontrolled amount of storage assigned to the user processes is the only possible source of a storage deadlock. Creating the process would result in the state: Process Max Hold Claim Free 1 70 45 25 25 2 60 40 20 3 60 15 45 4 60 25 35 There is sufficient free memory to guarantee the termination of either P1 or P2. After that, the remaining three jobs can be completed in any order. Creating the process would result in the trivially unsafe state: Process Max Hold Claim Free 1 70 45 25 15 2 60 40 20 3 60 15 45 4 60 35 25 6.
Most OS's ignore deadlock. But Solaris only lets the superuser use the last process table slot. The buffer is declared to be an array of shared elements of type T. Another array defines the number of input elements available to each process. Each process keeps track of the index j of the buffer element it is referring to at the moment. The notation region v do S means that at most one process at a time can enter the critical region associated with variable v to perform statement S.
Deadlock occurs if all resource units are reserved while one or more processes are waiting indefinitely for more units. But, if all 4 units are reserved, at least one process has acquired 2 units.
Therefore, that process will be able to complete its work and release both units, thus enabling another process to continue. So a deadlock cannot occur. In the state shown in the problem, if one additional unit is available, P2 can run to completion, releasing its resources, making 2 units available.
This would allow P1 to run to completion making 3 units available. But at this point P3 needs 6 units and P4 needs 5 units. If to begin with, there had been 3 units available instead of 1 unit, there would now be 5 units available. This would allow P4 to run to completion, making 7 units available, which would allow P3 to run to completion. In order from most-concurrent to least, there is a rough partial order on the deadlock-handling algorithms: 1.
Their effects after deadlock is detected are harder to characterize: they still allow lots of concurrency in some cases they enhance it , but the computation may no longer be sensible or efficient.
The third algorithm is the strangest, since so much of its concurrency will be useless repetition; because threads compete for execution time, this algorithm also prevents useful computation from advancing. Hence it is listed twice in this ordering, at both extremes. The banker's algorithm prevents unsafe allocations a proper superset of deadlock-producing allocations and resource ordering restricts allocation sequences so that threads have fewer options as to whether they must wait or not.
By reserving all resources in advance, threads have to wait longer and are more likely to block other threads while they work, so the system-wide execution is in effect more linear.
In order from most-efficient to least, there is a rough partial order on the deadlock-handling algorithms: 1. Notice that this is a result of the same static restrictions that made these rank poorly in concurrency. Resource-dependency chains are bounded by the number of threads, the number of resources, and the number of allocations.
First, because threads run the risk of restarting, they have a low probability of completing. Second, they are competing with other restarting threads for finite execution time, so the entire system advances towards completion slowly if at all. This ordering does not change when deadlock is more likely. The algorithms in the first group incur no additional runtime penalty because they statically disallow deadlock-producing execution.
The second group incurs a minimal, bounded penalty when deadlock occurs. The algorithm in the third tier incurs the unrolling cost, which is O n in the number of memory writes performed between checkpoints. The status of the final algorithm is questionable because the algorithm does not allow deadlock to occur; it might be the case that unrolling becomes more expensive, but the behavior of this restart algorithm is so variable that accurate comparative analysis is nearly impossible.
Assume that the table is in deadlock, i. Since Pj clutches his left fork and cannot have his right fork, his right neighbor Pk never completes his dinner and is also a lefty.
Continuing the argument rightward around the table shows that all philosophers in D are lefties. This contradicts the existence of at least one righty. Therefore deadlock is not possible. Assume that lefty Pj starves, i. Suppose Pj holds no fork. Then Pj's left neighbor Pi must continually hold his right fork and never finishes eating. Thus Pi is a righty holding his right fork, but never getting his left fork to complete a meal, i. Now Pi's left neighbor must be a righty who continually holds his right fork.
Proceeding leftward around the table with this argument shows that all philosophers are starving righties. But Pj is a lefty: a contradiction. Thus Pj must hold one fork. As Pj continually holds one fork and waits for his right fork, Pj's right neighbor Pk never sets his left fork down and never completes a meal, i.
If Pk did not continually hold his left fork, Pj could eat; therefore Pk holds his left fork. Carrying the argument rightward around the table shows that all philosophers are starving lefties: a contradiction.
Starvation is thus precluded. The logic is essentially the same. The solution of Figure 6. Therefore, a simple read operation cannot be used, but a special read operation for the atomic data type is needed. For example, c could equal 4 what we expect , yet d could equal 1 not what we expect. Using the mb insures a and b are written in the intended order, while the rmb insures c and d are read in the intended order. This example is from [LOVE04]. In addition, we would like to be able to swap active processes in and out of main memory to maximize processor utilization by providing a large pool of ready processes to execute.
In both these cases, the specific location of the process in main memory is unpredictable. Furthermore, most programming languages allow the dynamic calculation of addresses at run time, for example by computing an array subscript or a pointer into a data structure. Hence all memory references generated by a process must be checked at run time to ensure that they refer only to the memory space allocated to that process.
Also, processes that are cooperating on some task may need to share access to the same data structure. It is possible to provide one or two quite large partitions and still have a large number of partitions. The large partitions can allow the entire loading of large programs. Internal fragmentation is reduced because a small program can be put into a small partition.
External fragmentation is a phenomenon associated with dynamic partitioning, and refers to the fact that a large number of small areas of main memory external to any partition accumulates. A relative address is a particular example of logical address, in which the address is expressed as a location relative to some known point, usually the beginning of the program. A physical address, or absolute address, is an actual location in main memory. Exactly one page can fit in one frame.
In this case, the program and its associated data are divided into a number of segments. It is not required that all segments of all programs be of the same length, although there is a maximum segment length. Eight bits are needed to identify one of the 28 partitions. The probability that a given segment is followed by a hole in memory and not by another segment is 0. It is intuitively reasonable that the number of holes must be less than the number of segments because neighboring segments can be combined into a single hole on deletion.
The worst fit algorithm maximizes the chance that the free space left after a placement will be large enough to satisfy another request, thus minimizing the frequency of compaction.
The disadvantage of this approach is that the largest blocks are allocated first; therefore a request for a large area is more likely to fail. The 40 M block fits into the second hole, with a starting address of 80M. The 20M block fits into the first hole, with a starting address of 20M.
The 10M block is placed at location M. This scheme offers more block sizes than a binary buddy system, and so has the potential for less internal fragmentation, but can cause additional external fragmentation because many uselessly small blocks are created.
However, we wish the program to be relocatable. Therefore, it might be preferable to use relative addresses in the instruction register. Alternatively, the address in the instruction register can be converted to relative when a process is swapped out of memory. Therefore, 26 bits are required for the logical address. A frame is the same size as a page, bytes. So 22 bits is needed to specify the frame. There is one entry for each page in the logical address space.
Therefore there are entries. Segment 0 starts at location Segment 1 has a length of bytes, so this address triggers a segment fault. Observe that a reference occurs to some segment in memory each time unit, and that one segment is deleted every t references. The system's operation time t0 is then the time required for the boundary to cross the hole, i.
The compaction operation requires two memory references—a fetch and a store—plus overhead for each of the 1 — f m words to be moved, i. Virtual memory paging: not all pages of a process need be in main memory frames for the process to run. In general, the principle of locality allows the algorithm to predict which resident pages are least likely to be referenced in the near future and are therefore good candidates for being swapped out.
Its purpose is to avoid, most of the time, having to go to disk to retrieve a page table entry. With prepaging, pages other than the one demanded by a page fault are brought in. Page replacement policy deals with the following issue: among the set of pages considered, which particular page should be selected for replacement. The working set of a process is the number of pages of that process that have been referenced recently. A precleaning policy writes modified pages before their page frames are needed so that pages can be written out in batches.
Split binary address into virtual page number and offset; use VPN as index into page table; extract page frame number; concatenate offset to get physical memory address b. Thus, each page table can handle 8 of the required 22 bits.
Therefore, 3 levels of page tables are needed. Tables at two of the levels have 28 entries; tables at one level have 26 entries. Less space is consumed if the top level has 26 entries. PFN 3 since loaded longest ago at time 20 b. PFN 1 since referenced longest ago at time c.
These two policies are equally effective for this particular page trace. This occurs for two reasons: 1 a user page table can be paged in to memory only when it is needed. Of course, there is a disadvantage: address translation requires extra work. Source: [MAEK87]. The P bit in each segment table entry provides protection for the entire segment. The address space however is bytes. Adding a second layer of page tables, the top page table would point to page tables, addressing a total of bytes.
But only 2 bits of the 6th level are required, not the entire 10 bits. So instead of requiring your virtual addresses be 72 bits long, you could mask out and ignore all but the 2 lowest order bits of the 6th level. Your top level page table then would have only 4 entries. Yet another option is to revise the criteria that the top level page table fit into a single physical page and instead make it fit into 4 pages.
This would save a physical page, which is not much. In that case we pay the 20 ns overhead on top of the ns memory access time. Second, when the TLB does not contain the item. Then we pay an additional ns to get the required entry into the TLB. Snow falling on the track is analogous to page hits on the circular clock buffer.
Note that the density of replaceable pages is highest immediately in front of the clock pointer, just as the density of snow is highest immediately in front of the plow. In fact, it can be shown that the depth of the snow in front of the plow is twice the average depth on the track as a whole. By this analogy, the number of pages replaced by the CLOCK policy on a single circuit should be twice the number that are replaceable at a random time. The analogy is imperfect because the CLOCK pointer does not move at a constant rate, but the intuitive idea remains.
Reading, MA: Addison-Wesley, page The operating system can maintain a number of queues of page-frame tables. A page-frame table entry moves from one queue to another according to how long the reference bit from that page frame stays set to zero. When pages must be replaced, the pages to be replaced are chosen from the queue of the longest-life nonreferenced frames. Use a mechanism that adjusts the value of Q at each window time as a function of the actual page fault rate experienced during the window.
The page fault rate is computed and compared with a system- wide value for "desirable" page fault rate for a job. The value of Q is adjusted upward downward whenever the actual page fault rate of a job is higher lower than the desirable value. Experimentation using this adjustment mechanism showed that execution of the test jobs with dynamic adjustment of Q consistently produced a lower number of page faults per execution and a decreased average resident set size than the execution with a constant value of Q within a very broad range.
The memory time product MT versus Q using the adjustment mechanism also produced a consistent and considerable improvement over the previous test results using a constant value of Q.
If total number of entries stays at 32 and the page size does not change, then each entry becomes 8 bits wide. By convention, the contents of memory beyond the current top of the stack are undefined. On almost all architectures, the current top of stack pointer is kept in a well-defined register.
Therefore, the kernel can read its contents and deallocate any unused pages as needed. The reason that this is not done is that little is gained by the effort. If the user program will repeatedly call subroutines that need additional space for local variables a very likely case , then much time will be wasted deallocating stack space in between calls and then reallocating it later on. If the subroutine called is only used once during the life of the program and no other subroutine will ever be called that needs the stack space, then eventually the kernel will page out the unused portion of the space if it needs the memory for other purposes.
In either case, the extra logic needed to recognize the case where a stack could be shrunk is unwarranted. Source: [SCHI94]. Medium-term scheduling: The decision to add to the number of processes that are partially or fully in main memory. Short-term scheduling: The decision as to which available process will be executed by the processor 9. Response time is the elapsed time between the submission of a request until the response begins to appear as output.
Some systems, such as Windows, use the opposite convention: a higher number means a higher priority 9. Preemptive: The currently running process may be interrupted and moved to the Ready state by the operating system. The decision to preempt may be performed when a new process arrives, when an interrupt occurs that places a blocked process in the Ready state, or periodically based on a clock interrupt.
When the currently- running process ceases to execute, the process that has been in the ready queue the longest is selected for running. When the interrupt occurs, the currently running process is placed in the ready queue, and the next ready job is selected on a FCFS basis. In this case, the scheduler always chooses the process that has the shortest expected remaining processing time.
When a new process joins the ready queue, it may in fact have a shorter remaining time than the currently running process. Accordingly, the scheduler may preempt whenever a new process becomes ready. When a process first enters the system, it is placed in RQ0 see Figure 9.
After its first execution, when it returns to the Ready state, it is placed in RQ1. Each subsequent time that it is preempted, it is demoted to the next lower-priority queue. A shorter process will complete quickly, without migrating very far down the hierarchy of ready queues.
A longer process will gradually drift downward. Thus, newer, shorter processes are favored over older, longer processes. Within each queue, except the lowest-priority queue, a simple FCFS mechanism is used. Once in the lowest-priority queue, a process cannot go lower, but is returned to this queue repeatedly until it completes execution. The proof can be extended to cover later arrivals.
A sophisticated analysis of this type of estimation procedure is contained in Applied Optimal Estimation, edited by Gelb, M. Press, If you do, then it is entitled to 2 additional time units before it can be preempted. Here the response ratio of job 1 is the smaller, and consequently job 2 is selected for service at time t. This algorithm is repeated each time a job is completed to take new arrivals into account. Note that this algorithm is not quite the same as highest response ratio next.
The latter would schedule job 1 at time t. Intuitively, it is clear that the present algorithm attempts to minimize the maximum response ratio by consistently postponing jobs that will suffer the least increase of their response ratios. Mondrup, is reported in [BRIN73]. Consider the queue at time t immediately after a departure and ignore further arrivals. The waiting jobs are numbered 1 to n in the order in which they will be scheduled: job: 1 2. Notice that this proof is valid in general for priorities that are non- decreasing functions of time.
For example, in a FIFO system, priorities increase linearly with waiting time at the same rate for all jobs. Therefore, the present proof shows that the FIFO algorithm minimizes the maximum waiting time for a given batch of jobs. Assume that an item with service time Ts has been in service for a time h. That is, no matter how long an item has been in service, the expected remaining service time is just the average service time for the item.
This result, though counter to intuition, is correct, as we now show. Therefore the expected value of the remaining service time is the same as the original expected value of service time. With this result, we can now proceed to the original problem. When an item arrives for service, the total response time for that item will consist of its own service time plus the service time of all items ahead of it in the queue. The total expected response time has three components.
Now, consider a newly arrived process, which is placed at the end of the ready queue for service. It must wait until all q processes waiting in line ahead of it have been serviced. When the ready queue has many processes that are interactive, responsiveness is very important e. An argument in favor of a large quantum: Using a large quantum will enhance the throughput, and the CPU utilization measured with respect to real work, because there is less context switching and therefore less overhead.
A system for which both might be appropriate: There are some systems for which both small and large quanta are reasonable. Although this type of job can be considered as a batch job, in some sense, it still has to interact with the user. Therefore, during the times when there is no user interaction, the quantum might be increased to optimize the throughout and during interactive time, the quantum might be lowered to provide better responsiveness.
Two adjacent arrivals to the second box the "service" box will arrive at a slightly slower rate, since the second item is delayed in its chase of the first item. Since priorities are initially based only on elapsed waiting times, W is clearly independent of the service time x. We have already developed the formula for R.
For V, observe that the arrival rate to the service box is l', and therefore the utilization is r'. When the quantum is decreased to satisfy more users rapidly two things happen: 1 processor utilization decreases, and 2 at a certain point, the quantum becomes too small to satisfy most trivial requests. Users will then experience a sudden increase of response times because their requests must pass through the round- robin queue several times. Medium: Parallel processing or multitasking within a single application.
Coarse: Multiprocessing of concurrent processes in a multiprogramming environment. Very Coarse: Distributed processing across network nodes to form a single computing environment. Independent: Multiple unrelated processes. A global queue of ready threads is maintained, and each processor, when idle, selects a thread from the queue. The term load sharing is used to distinguish this strategy from load-balancing schemes in which work is allocated on a more permanent basis. With an unparalleled degree of support for integrating projects into the course, plus comprehensive coverage of the latest trends and developments in operating systems, including cloud computing and the Internet of Things IoT , the text provides everything students and instructors need to keep pace with a complex and rapidly changing field.
The 9th Edition has been extensively revised and contains new material, new projects, and updated chapters. Online Chapters and Appendices. Pearson offers affordable and accessible purchase options to meet the needs of your students.
Connect with us to learn more. William Stallings has authored 18 titles, and including the revised editions, over 40 books on computer security, computer networking, and computer architecture. In over 30 years in the field, he has been a technical contributor, technical manager, and an executive with several high-technology firms.
As a consultant, he has advised government agencies, computer and software vendors, and major users on the design, selection, and use of networking software and products. This site provides documents and links on a variety of subjects of general interest to computer science students and professionals. He is a member of the editorial board of Cryptologia , a scholarly journal devoted to all aspects of cryptology.
Stallings holds a Ph. Cloth Bound with Access Card. We're sorry! We don't recognize your username or password. Please try again. The work is protected by local and international copyright laws and is provided solely for the use of instructors in teaching their courses and assessing student learning. You have successfully signed out and will be required to sign back in should you need to download more resources.
William Stallings. Description For one- or two-semester undergraduate courses in operating systems for computer science, computer engineering, and electrical engineering majors An introduction to operating systems with up-to-date and comprehensive coverage Now in its 9th Edition , Operating Systems: Internals and Design Principles provides a comprehensive, unified introduction to operating systems topics aimed at computer science, computer engineering, and electrical engineering majors.
This edition was extensively reviewed by a number of professors who teach the subject and by professionals working in the field. As a result, the narrative has been clarified and tightened, and illustrations have been improved. Four operating systems serve as running examples to illustrate the concepts and to tie them to real-world design choices that must be made: Linux, UNIX, Android, and Windows The book includes a number of pedagogic features, including the use of animations and videonotes and numerous figures and tables to clarify the discussion.
Each chapter includes a list of keywords, review questions, and homework problems. Design concepts discussed in a given chapter are immediately reinforced with real-world examples. Running case studies , focused on how specific operating systems implement specific concepts, illustrate concepts and are embedded throughout the text, rather than assembled as a single chapter or appendix. Projects: This text provides an unparalleled degree of support for including a projects component in the course.
New to This Edition. About the Book This edition was extensively reviewed by a number of professors who teach the subject and by professionals working in the field. Linux coverage: The Linux material has been updated and expanded to reflect changes in the Linux kernel since the 8th Edition.
Android coverage: The Android material has been updated and expanded to reflect changes in the Android kernel since the 8th Edition. Virtualization coverage: The chapter on virtual machines has been completely rewritten to provide better organization and an expanded and more up-to-date treatment. In addition, a new section has been added on the use of containers. Cloud operating systems: New to this edition is the coverage of cloud operating systems, including an overview of cloud computing, a discussion of the principles and requirements for a cloud operating system, and a discussion of a OpenStack, a popular open-source Cloud OS.
IoT operating systems: New to this edition is the coverage of operating systems for the Internet of Things. Embedded operating systems: This chapter has been substantially revised and expanded, including: The section on embedded systems has been expanded and now includes discussions of microcontrollers and deeply embedded systems. The overview section on embedded OSs has been expanded and updated. Concurrency: New projects have been added to the Projects Manual to better help the student understand the principles of concurrency.
Background 1. Computer System Overview 1. Basic Elements 1. Evolution of the Microprocessor 1. Instruction Execution 1. Interrupts 1. The Memory Hierarchy 1. Cache Memory 1. Direct Memory Access 1. Multiprocessor and Multicore Organization 1. Performance Characteristics of Two-Level Memories 2. Operating System Overview 2. Operating System Objectives and Functions 2.
The Evolution of Operating Systems 2. Major Achievements 2.
0コメント