Вы находитесь на странице: 1из 8

*OS Quick Reference:* *Question-Answer style* *CIS343* ** Deadlock:: *4 Necessary Conditions:* w *Mutual exclusion* * *Only one process may

use a resource at a time. w *Hold and wait* * *A process may hold allocated resources while awaiting assignment of others. w *No preemption* * *No resource may be forcefully removed from a process holding it. w *Circular wait* * ** *3 Ways to Handle Deadlock* w *Deadlock Prevention* Prevent one of the 4 conditions from occurring w *Deadlock Avoidance* Never allow system to reach an unsafe state w *Deadlock Detection & Recovery* * *Allow deadlock to occur; detect its occurrence; remove processes until deadlock is eliminated ** *Deadlock Prevention* Actions taken (*AT*) matched with condition prevented (*CP*):: w *AT:* A process holding a resource must surrender it when denied a further request. *CP: **No preemption/Hold & Wait* w *AT:* A resource requested by one process may be taken from the process holding it. *A closed chain of processes exists.

*CP:* *No preemption* w *AT:* Resource types have a linear ordering. Resource requests must be made in the specified order. *CP:* *Circular Wait* w *AT:* A process must make all its resource requests at one time. *CP:* *Hold & Wait* *Notice: *No action corresponds to prevention of mutual exclusion, since, in general, this condition cannot be disallowed. ** *Deadlock Avoidance* Actions taken (*AT:* ) matched with name of strategy (*STR:* ):: w *AT:* Grant a request only if the result of the grant is a safe state. *STR:* *Resource allocation denial (banker's algorithm)* w *AT: *Start a process only if the maximum claims of all current processes plus those of the new process can be met. *STR: **Process initiation denial* ** *Banker's Algorithm* w All states are either *safe *or *unsafe*. w *Safe state* There is at least one sequence in which all processes can run to completion without leading to deadlock w Question/Answer v *Q: *Since in a safe state, there are some sequences of execution that could lead to deadlock, why is it called safe? I.e., what keeps deadlock from occurring? v *A: *If one of the sequences leading to an unsafe state were to occur, it would

trigger resource denial by the OS ** *Q/A Information:* *1. *Rank these in order, from most conservative to least. a. Deadlock detection & recovery b. Deadlock prevention c. Deadlock avoidance B, C, A *(2-10) Classify each of these in one of the categories listed immediately below:* DP. Deadlock prevention DA. Deadlock avoidance DDR. Deadlock detection & recovery IDS. Integrated deadlock strategy *2. *Do not start a process if its demands might lead to deadlock. DA *3. *Deny the hold and wait condition DP *4. *Successively preempt until deadlock no longer exists. DDR *5. *Group resources into classes,with linear ordering in each class. Within any class use the algorithm most appropriate for that class. IDS *6. *Back up each deadlocked process to some previously defined checkpoint. Restart all processes. DDR *7. *A process holding a resource must surrender it when denied a further request. DP *8. *Do not grant a resource request if it could lead to deadlock. DA *9. *Abort all deadlocked processes.

DDR *10. *Processes must make all resource requests in a predefined order, regardless of the order of actual need by that process. DP ** *11. *What is the most commonly adopted solution to deadlock recovery? Abort all deadlocked processes *Other Chapters:* http://faculty.kutztown.edu/rieksts/343/study/qz-ans/main.html http://faculty.kutztown.edu/rieksts/343/study/qz-ans/qz-chap3.html http://faculty.kutztown.edu/rieksts/343/study/qz-ans/qz-chap1-lec.html http://docs.google.com/viewer?a=v&q=cache:_7bZRdMfufkJ:www.comp.hkbu....<http:// docs.google.com/viewer?a=v&q=cache:_7bZRdMfufkJ:www.comp.hkbu....> *Answers to* Chapter 7 Quiz *CIS343* *(1-5) Identify the five requirements that memory management is intended to satisfy.* *1. *No process should be subject to unwanted interference from another process, whether accidental or intentional. protection *2. *Controlled access to shared areas of memory must be allowed, without compromising essential protection. sharing *3. *Since we cannot know ahead of time where in memory a program should be placed, and since a program may be moved from one memory area to another, our memory management must provide for... relocation *4. *The task of finding areas of main memory and secondary memory for a program and of moving information between the two levels of memory. physical organization *5. *Providing for the programmer useful concepts for program organization, which may or may not have exact physical parallels. logical organization *(6-11) Identify these memory management techniques.* *6. *Main memory is divided into a number of equal-size frames. Each process is divided into a number of equal-size units, of the same size as

the frames. simple paging *7. *Main memory is divided into a number of static partitions at system generation time. fixed partitioning *8. *Each process is divided into a number of segments, not all of which are resident at any one point in time. virtual memory segmentation *9. *Partitions are created as needed, so that each process is loaded into a partition of exactly the same size as the process. dynamic partitioning *10. *Each process is divided into a number of segments, all of which are loaded into memory at run time, though not necessarily contiguously. simple segmentation *11. *Each process is divided into frames, some of which, though not all, are resident at run time. virtual memory, paging *(12-17) Classify each of these memory management strategies in one of 4 categories:* I-Y E-Y :: internal fragmentation - yes; external fragmentation yes** I-N E-Y :: internal fragmentation - no; external fragmentation yes** I-Y E-N :: internal fragmentation - yes; external fragmentation no** I-N E-N :: internal fragmentation - no; external fragmentation no** *12. *Fixed partitioning I-Y E-N internal fragmentation; no external fragmentation *13. *Dynamic partitioning I-N E-Y no internal fragmentation; external fragmentation *14. *Simple paging I-Y E-N

no external fragmentation; a small amount of internal fragmentation *15. *Simple segmentation I-N E-Y no internal fragmentation; some external fragmentation *16. *Virtual memory paging I-Y E-N no external fragmentation; a small amount of internal fragmentation *17. *Virtual memory segmentation I-N E-Y no internal fragmentation *(18-20) Describe these terms related to relocation.* *18. *Relative address An address expressed as a location relative to some known point. *19. *Physical address An absolute address, an actual location in main memory. *20. *Logical address A reference to a memory location independent of the current assignment of data to memory. *(21-23) Describe these terms related to paging and segmentation.* *21. *Frames The equal-size chunks that memory is divided into *22. *Pages The equal-size chunks that a process is divided into. *23. *Segments The chunks that a program is divided into which are not necessarily all of the same length. *(24-29) Identify the memory management technique which has the following strengths *(list all that apply): *24. *No internal fragmentation dynamic partitioning simple paging

virtual memory, segmentation *25. *Higher degree of multiprogramming virtual memory, paging virtual memory, segmentation *26. *Large virtual address space virtual memory, paging virtual memory, segmentation *27. *Protection and sharing support virtual memory, segmentation *28. *Simple to implement; little OS overhead fixed partitioning *29. *No external fragmentation simple paging virtual memory, paging *(30-35) Identify the memory management technique which has the following weakness* (list all that apply): *30. *Overhead of complex memory management virtual memory, paging virtual memory, segmentation *31. *A small amount of internal fragmentation simple paging virtual memory, paging *32. *Inefficient use of memory due to internal fragmentation fixed partitioning *33. *Inefficient use of processor due to need for compaction to counter external fragmentation dynamic partitioning *34. *There is no simple relationship between logical addresses and physical addresses. segmentation

*35. *Maximum number of active processes is fixed. fixed partitioning *(36-39) Identify these terms and hardware and OS features used in support of program relocation and paging.* *36. *Contains the address at which a program is loaded. base register *37. *Contains the address of the last memory location allocated to the code + data. bounds register *38. *Used to check the address of a memory access against the bounds register. comparator *39. *The address at which a program is loaded base address *40. T/F: *The difference between segmentation and paging is that under segmentation the entire program is placed into contiguous memory, while in paging this may or may not be the case. false

Вам также может понравиться