- Operating Systems Basics
- Operating System (OS) Home
- Operating System Basics
- What is an Operating System
- History of Operating System
- Mainframe Operating System
- Server Operating System
- Multiprocessor Operating System
- Personal Computer OS
- Real-Time Operating System
- Embedded Operating System
- Smart Card Operating System
- OS Processors
- OS Memory
- OS System Calls
- Operating System Structure
- OS Processes and Threads
- OS Processes
- OS Process Model
- OS Process Creation
- OS Process Termination
- OS Process Hierarchies
- OS Process States
- OS Process Implementation
- OS Threads
- OS Thread Model
- OS Thread Implementation
- OS Pop-up Threads
- OS Interprocess Communication
- OS Scheduling
- OS Thread Scheduling
- OS Deadlocks
- OS Deadlocks
- OS Deadlock Resources
- OS Deadlock Conditions
- OS Deadlock Modelling
- OS Deadlock Detection
- OS Deadlock Recovery
- OS Deadlock Avoidance
- OS Deadlock Prevention
- OS Two-Phase Locking
- OS Memory Management
- OS Memory Management
- OS Monoprogramming
- OS Multiprogramming
- OS Relocation and Protection
- Memory Management with Bitmap
- Memory Management with Linked List
- OS Virtual Memory
- OS Page Replacement Algorithms
- OS Local vs Global Allocation Policie
- OS Load Control
- OS Page Size
- OS Separate Instruction & Data Space
- OS Shared Pages
- OS Cleaning Policies
- OS Virtual Memory Interface
- OS Implementation Issues
- OS Involvement with Paging
- OS Page Fault Handling
- OS Instruction Backup
- OS Locking Pages in Memory
- OS Backing Store
- OS Separation of Policy & Mechanism
- OS Segmentation
- Operating System Input/Output
- Operating System Input/Output
- OS Input/Output Devices
- OS Device Controllers
- OS Memory-Mapped Input/Output
- OS Direct Memory Access DMA
- OS Input/Output Software Goals
- OS Programmed Input/Output
- OS Interrupt-Driven Input/Output
- OS Input/Output using DMA
- OS Input/Output Software Layers
- OS Disks
- OS Disk Hardware
- OS Disk Formatting
- OS Stable Storage
- OS Clocks
- OS Character-Oriented Terminals
- OS RS-232 Terminal Hardware
- OS Graphical User Interfaces
- OS Network Terminals
- OS Power Management
- OS File Systems
- OS Files
- OS File Naming
- OS File Structure
- OS File Types
- OS File Access
- OS File Attributes
- OS File Operations
- OS Memory-Mapped Files
- OS Directories
- OS Single-Level Directory System
- OS Two-Level Directory System
- OS Hierarchical Directory System
- OS Path Names
- OS Directory Operations
- OS File System Implementation
- OS File System Layout
- OS Disk Space Management
- Multimedia Operating System
- Multimedia Operating System
- OS Multimedia Files
- OS Audio Encoding
- OS Video Encoding
- OS Video Compression
- OS Multimedia Process Scheduling
- OS Multimedia File System Paradigm
- OS File Placement
- OS Caching
- OS Disk Scheduling
- OS Multiple Processor System
- OS Multiprocessors
- OS Multiprocessor Hardware
- OS Multiprocessor Synchronization
- OS Multiprocessor Scheduling
- OS Multicomputers
- OS Multicomputer Hardware
- Low-Level Communication Software
- User-Level Communication Software
- OS Remote Procedure Call
- OS Distributed Shared Memory
- OS Multicomputer Scheduling
- OS Load Balancing
- OS Distributed System
- OS Network Hardware
- OS Network Services and Protocols
- OS Document-Based Middleware
- OS File System-Based Middleware
- OS Shared Object-Based Middleware
- Operating System Security
- Operating System Security
- OS Threats
- OS Intruders
- OS Accidental Data Loss
- Basics of Cryptography
- Secret-Key Cryptography
- Public-Key Cryptography
- OS Digital Signatures
- OS User Authentication
- OS Trojan Horses
- OS Login Spoofing
- OS Logic Bombs
- OS Trap Doors
- OS Viruses
- OS AntiViruses
- OS Internet Worms
- Give Online Test
- All Test List
- Operating System Test
OS Deadlock Prevention
Deadlock avoidance is basically not possible only because it requires information about future requests which isn't known.
If we can ensure that at least one of the four condition for deadlock is never satisfied, then deadlock will be structurally not possible.
Now the table given below describes briefly about all those four conditions for deadlocks (that we have learned/discussed in earlier tutorial) one by one.
Condition | Description |
---|---|
Attacking the Mutual Exclusion Condition | In case if no resource were ever assigned exclusively to a single process, then we would never have any deadlocks. But allowing two processes to write on the printer at the same instance of time will lead to chaos. By spooling printer output, several process can produce output at the same time. In this model, the only process that actually requests the physical printer is the printer daemon. Since the daemon never requests any other resources, we can eliminate deadlock for the printer. |
Attacking the Hold and Wait Condition | If we can prevent processes that hold resources from waiting for more resources, we can eliminate deadlocks. A way to achieve this goal is to require all the processes to request all their resources before starting the execution. If everything is available then the process will be allocated whatever it needs and can run to completion. Nothing will be allocated and the process would wait, in case if one or more than one resources are busy |
Attacking the No Preemption Condition | If a process has been assigned the printer and is in the middle of printing its output, forcibly taking away from the printer because a needed plotter is not available is tricky at best and impossible at worst |
Attacking the Circular Wait Condition | In several ways, the circular wait can be eliminated. One way is to have a rule saying that a process is entitled only to a single resource at any moment. If it needs a second one then it must release the first one. For a process that needs to copy a huge file from a tape to a printer, this restriction is unacceptable |
Now let's summarise the approaches to deadlock presentation.
Approaches to Deadlock Prevention
The table given below summarises the approaches of deadlock prevention.
Condition | Approache |
---|---|
Mutual exclusion | Spool everything |
Hold and wait | Request all resources initially |
No preemption | Take resources away |
Circular wait | Order resources numerically |
« Previous Tutorial Next Tutorial »
Like/Share Us on Facebook 😋