Operations Systems C5 Flashcards
Q132: What are the consequences of many programs competing for limited resources in a system?
A132: The consequences include:
- Lack of process synchronization
- Potential for deadlock, livelock, and starvation
Q133: How is a deadlock described in the context of system resource sharing?
A133: A deadlock is described as a “deadly embrace,” “Catch 22,” or “blue screen of death.” It occurs when two or more jobs are placed in a HOLD state because they are waiting for an unavailable vital resource, causing the system to come to a standstill.
What is the Seven Cases of Deadlock or Livelock
- Nonsharable/nonpreemptable resources
– Allocated to jobs requiring same type of resources - Resource types locked by competing jobs
– File requests
– Databases
– Dedicated device allocation
– Multiple device allocation
– Spooling
– Network
– Disk sharing
Q134: Describe the Narrow staircase analogy in the context of system resource sharing.
A134: The Narrow staircase analogy compares the system to a staircase where the steps and landings represent resources.
- Stairs are wide enough for only one person.
- Landing at each floor can accommodate two people.
- Deadlock occurs when two people meet on the stairs, and neither retreats.
- Livelock occurs when two people on a landing keep mirroring each other’s steps without moving forward.
- Starvation occurs when people wait on the landing for a break that never comes.
Q135: How is a deadlock different from starvation?
A135:
- Deadlock is more serious than starvation.
- Deadlock affects the entire system and more than one job.
- All system resources become unavailable in a deadlock.
- Deadlocks are more accepted in interactive and real-time systems.
- OS must prevent or resolve deadlock situations.
Q136: What is livelock in the context of system resource sharing?
A136: Livelock occurs when two processes on a landing keep mirroring each other’s steps without making any progress, leading to a continuous loop of actions that prevent them from moving forward
Q137: What is starvation in the context of system resource sharing?
A137: Starvation occurs when processes or jobs are waiting for a resource that they never get access to, leading to them being stuck in a waiting state indefinitely.
Q138: Why do deadlocks become critical situations in interactive systems and real-time systems?
A138: Deadlocks become critical in these systems because they can cause the entire system to become unresponsive, affecting the timely execution of jobs and leading to potential failures or delays in real-time operations.
What scenario is described in Case 1: Deadlocks on File Requests in the context of resource sharing and system deadlocks?
Answer:
In Case 1, multiple programs are competing for access to specific files required for execution. The scenario involves:
- Two programs, P1 and P2.
- Two files, F1 and F2.
- P1 holds access to file F1 and requires file F2 to proceed.
- P2 holds access to file F2 and requires file F1 to proceed.
Question:
What scenario is described in Case 2: Deadlocks in Databases in the context of resource sharing and system deadlocks?
In Case 2, two processes, P1 and P2, are compeating for access to and updating of two specific records, R1 and R2, within a database. This competition leads to a deadlock due to the following sequence:
- P1 accesses and locks record R1.
- P2 accesses and locks record R2.
- P1 attempts to access record R2 but finds it locked by P2.
- P2 attempts to access record R1 but finds it locked by P1.
This scenario illustrates the risk of not implementing proper locking mechanisms, resulting in a race condition between the processes. The absence of proper locking can lead to incorrect final data versions, heavily depending on the order of process execution.
What scenario is described in Case 3: Deadlocks in Dedicated Device Allocation in the context of resource sharing and system deadlocks?
In Case 3, two administrators, each managing separate education programs with processes P1 and P2, require access to two dedicated audio recorders, R1 and R2. Due to the limited availability of these resources, a deadlock ensues as follows:
- P1 requests and acquires audio recorder R1.
- P2 requests and acquires audio recorder R2.
- P1 subsequently requests audio recorder R2 but finds it blocked by P2.
- P2 requests audio recorder R1 but finds it blocked by P1.
This situation highlights the challenges posed by limited resource availability and the potential for deadlocks when processes compete for exclusive access to dedicated devices without proper resource management.
What scenario is described in Case 4: Deadlocks in Multiple Device Allocation in the context of resource sharing and system deadlocks?
In Case 4, three programs, P1, P2, and P3, are striving for access to three dedicated devices: a scanner, a printer, and a plotter. The deadlock scenario unfolds as follows:
- P1 acquires the scanner.
- P2 acquires the printer.
- P3 acquires the plotter.
- P1 subsequently requests the printer but finds it blocked by P2.
- P2 requests the plotter but finds it blocked by P3.
- P3 requests the scanner but finds it blocked by P1.
This example illustrates the complications that arise when multiple processes contend for a set of dedicated devices, leading to a deadlock due to competing resource requirements.
In Case 5: Deadlocks in Spooling, what is the scenario involving virtual and dedicated devices, the spooling process, and the resulting deadlock?
Case 5 discusses the issues of spooling, where a high-speed disk device acts as a virtual printer, facilitating data transfer between the CPU and the actual printer. The spooler serves as a temporary storage system, accepting output from multiple users. This output remains in the spooling system until the printer is ready to process the job data.
However, a deadlock situation arises due to the printer’s requirement to have all job outputs before initiating the printing process. As the spooling system fills up, no single job possesses its entire print output within the spooling area. **This results in incomplete output for all jobs, ultimately leading to a deadlock **where the system cannot proceed with any printing tasks.
In Case 6: Deadlocks in a Network, what scenario is presented regarding the absence of network protocols, the involved computing devices, and the resulting deadlock?
Case 6 illustrates a situation where there are** no network protocols** in place to control the flow of network messages. In this example, there are seven computing devices connected to the network, each residing on different nodes. The direction of the arrows in the figure indicates the communication flow between these devices.
However, a deadlock occurs when all available buffer space in the network fills up. This leads to a situation where the devices are unable to communicate further due to the lack of available buffer space, resulting in a network deadlock.
In Case 7: Deadlocks in Disk Sharing, what is the scenario involving disk access, the conflicting commands from competing processes, and the resulting livelock?
Case 7 describes a scenario where competing processes send conflicting commands for disk access, leading to a livelock situation. In this example, there are two processes, each waiting for an I/O request. One process is positioned at Track 20, while the other is at Track 310. The deadlock sequence unfolds as the disk arm moves back and forth between Tracks 20 and 310, attempting to fulfill the conflicting commands from the two processes. However, due to the conflicting nature of these commands, neither I/O request is satisfied, resulting in a livelock where the processes remain in a loop without making progress.