Exam 2 Flashcards
Name the two causes of disk I/O delays and explain.
seek time - the amount of time it takes for the read/write head to move to the correct track on the disk
rotational latency - the amount of time for the disk to rotate so that the sector in the track is under the read/write head and able to get information
Name the four necessary and sufficient conditions for deadlock to occur
mutual exclusion
hold and wait
circular wait
no preemption
Explain mutual exclusion
each resource is available or allocated to exactly one process; resources are not shared
Explain hold and wait
a process is holding resources can request and wait for an additional resources
Explain circular wait
a circular chain of processes where each process is waiting on a resource that is held by the next process in the chain
ex. dining philosopher’s problem - every philosopher was holding their left fork and waiting for the left fork
Explain no preemption
resources allocated to a process may not be forcibly taken away
Explain deadlock
the state of indefinite waiting that processes may reach when competing for system resources or attempting to communicate
Name the four ways to prevent deadlock…
attack mutual exclusion
attack hold and wait
attack circular wait
attack no preemption
Explain the ‘attack mutual exclusion’ deadlock prevention method…
avoid assigning resources unless necessary
limit the number of processes that are allowed to request resources
ex. daemons for devices
Explain the ‘attack hold and wait’ deadlock prevention method…
disallow processes to hold resources while waiting for additional resources
all resources must be allocated to the process before it can start - must have full set!; if the process needs an additional resource, the process must temporarily release all resources
breaks the wait part!
Explain the problems associated with the ‘attack hold and wait’ deadlock prevention method…
process may not know what it needs when it starts
resources tied up longer than necessary and underutilized
delayed if lots of resources are needed - starvation
break the hold part - process requires a new resource and must release all resources to acquire new resources - another process may grab what the process needs allowing both to complete - would just have to wait
Explain the ‘attack circular wait’ deadlock prevention method…
allow processes to have only one resource at a time
globally order all processes into categories by number - when numbering processes, think of the normal way things are processed
a process can only request from a higher numbered category in the resource chain
a process can release resources in a higher numbered category to request lower numbered category resources - higher numbered category resources may be requested again
When globally ordering all processes, why should output devices have a high numbered category?
output devices are needed at the end of a process; for example, it doesn’t make sense to give up everything to print!
Give an example of globally ordering all processes into categories…
if you have requested and been granted a resource in category 2, you can no longer request from category 1, 4 can’t request 1, 2, 3; must be held further down resource chain than I am;
if a process needs a resource from category 2, the process will release resources in category 3 to get to resources in category 2 - can always request again!
preemptible
can be interrupted; can be taken away from a process without a problem (without fail)
non-preemptible
can’t be interrupted; cause process to fail, cause erroneous result, cause extra work; considered a deadlock; ex. print job taken away
Describe how deadlock can be detected…
deadlock detection involves maintaining information of the current resource-allocation state and invoking an algorithm that uses the information of the resource-allocation state to detect deadlock
each resource type has one instance - construct a resource graph and search for a cycle - cycle indicates deadlock; resource-allocation graph algorithm
each resource type has multiple instances - use the detection algorithm over the array structures; when the algorithm completes, any unmarked processes are deadlocked
What does a process to a resource indicate?
process is requesting one instance of the resource type; request
What does a resource to a process indicate?
one instance of a resource type has been allocated to the process; acquired
How often should the deadlock detection algorithm be invoked (2)…
invoked every time a process requests a resource that cannot be immediately allocated - os can identify the specific process that caused deadlock along with the processes that are in deadlock; tons of overhead
invoked periodically; deadlock reduces the CPU utilization and system throughput - CPU utilization drops below a certain percentage the algorithm is invoked - ~40%
Describe the Banker’s Algorithm…
answer
Describe the Detection Algorithm…
answer