Question 1
EasyWhat is a deadlock?
- A.
A slow process
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Operating Systems
What is a deadlock?
A slow process
A set of processes each waiting for a resource held by another process in the set
A process waiting for user input
A process that has finished
Answer: B
In a deadlock none of the processes can proceed, because each waits for something only another blocked process can release.
In a resource-allocation graph where every resource has a single instance, what does a cycle mean?
The system is in a safe state
There is no deadlock
A deadlock may or may not exist
A deadlock exists
Answer: D
With single-instance resources, a cycle is both necessary and sufficient for deadlock.
What is the Banker's algorithm used for?
CPU scheduling
Memory allocation
Deadlock detection only
Deadlock avoidance
Answer: D
It grants a request only if the system stays in a safe state, so deadlock is avoided.
What is a safe state?
A state with no free resources
A state with no running processes
A state in which there is some order that lets every process finish
A state in which every process is waiting
Answer: C
If a safe sequence exists, resources can be granted in that order so all processes complete.
Making every process request resources in a fixed global order prevents which deadlock condition?
Circular wait
Mutual exclusion
No preemption
Hold and wait
Answer: A
If resources are always requested in increasing order, a cycle of waits can't form.
What is the 'ostrich algorithm' for deadlocks?
Killing every process
Using the Banker's algorithm
Ignoring deadlocks and assuming they rarely happen
Ordering resources
Answer: C
Many general-purpose systems simply ignore deadlocks because handling them costs more than the rare problem.
Allowing the OS to take resources away from a waiting process breaks which deadlock condition?
Hold and wait
Circular wait
Mutual exclusion
No preemption
Answer: D
If resources can be preempted, a process can't hold them indefinitely while waiting.
What does the 'hold and wait' condition for deadlock mean?
A process holds the CPU forever
A process holds at least one resource while waiting to acquire others
Resources wait for processes
A process waits without holding anything
Answer: B
Holding one resource while waiting for another is one of the four conditions needed for deadlock.
What does the 'circular wait' condition mean?
A process waits for the CPU in a circle
Processes run in Round Robin order
Resources are arranged in a circle on the disk
A closed chain of processes exists in which each waits for a resource held by the next
Answer: D
For example, P1 waits for P2, P2 waits for P3 and P3 waits for P1.
What does the 'no preemption' condition mean?
Resources can be taken at any time
Processes cannot be created
The CPU cannot be shared
A resource cannot be taken away from a process; it must be released voluntarily
Answer: D
If resources could be forcibly taken, the waiting cycle could be broken.