This study guide will help you get ready for the final exam. It discusses the key topics in each unit, walks through the learning outcomes, and lists important vocabulary terms. It is not meant to replace the course materials!
Deadlock is a specific type of computer scheduling starvation where the execution of a job process is delayed for an inordinate amount of time. Deadlock occurs when the process is never allowed to execute. The job is in a circular starvation pattern which never allows it to execute.
Five conditions for deadlock include:
Review this material in Deadlock.
Brilliant and elegant thinking, and using computer-based logic may be required to avoid or overcome deadlock.
Some techniques for avoiding gridlock include:
One technique for avoiding deadlock is Banker's Algorithm. This technique involves incorporating a dynamic allocation of resources. Think about how a banker needs to calculate whether the bank should lend money to a customer based on how much money the individual has deposited at the bank.
In the same way, all resources that might be required, while not immediately seized, must be made known in advance by the thread. This process ensures each thread releases its resources after execution. Banker's Algorithm dictates that the maximum amount of all resource needs for all of the current threads is greater than the total resources.
Note that we are using a fluid or expanding the definition of "program". The more formal understanding is that a program is the written software, dormant on a shutdown computer that is ready to run. Although we often say "run the program", computer purists would dismiss this.
A process means the program is running. You might consider a thread to be a "program" since it executes one particular function the program does or is supposed to do. Each process must request resources from the OS, such as CPU time to run. The OS commands everything and will grant threads resources based on how the OS is written. Different results will ensue depending on how that OS is written and handles the allocation of resources to requesting threads. You can think about a thread as a single keystroke, when it shows up on the keyboard and when it is recorded in memory. Each of those could be its own thread.
Review this material in Deadlock.
Deadlock describes a specific case of starvation where a thread will NEVER be executed. It is logically impossible, not just operationally unlikely, although it may seem so.
Deadlock cannot be allowed and must be anticipated if possible. If ignored, a reboot is required. If a reboot is unacceptable, the computer programmer must find a better and more elegant design that definitively avoids deadlock, otherwise, the consequences of a failure of the software will ensue, and are assured to occur at an unspecified time. Most likely, any time is the worst time for it to occur.
Three ways to discover deadlock include:
Some ways to recover from deadlock include:
Review these materials in: