Question : Peterson’s Solution belongs to which category?
Solution :
Correct Answer : Software synchronization solution
Description -
Software synchronization solution Explanation Peterson's Solution is a classic software-based synchronization algorithm designed to solve the critical section problem for two processes. It relies entirely on software logic using shared variables (turn and flag) rather than relying on special hardware instructions.
Question : Peterson’s solution guarantees which property?
Solution :
Correct Answer : All of the above
Description -
All of the above Explanation Peterson's Solution satisfies all three requirements required to solve the critical section problem in process synchronization:
Question : Peterson’s Solution uses which variables?
Solution :
Correct Answer : flag[ ] and turn
Description -
flag[] and turn Explanation Peterson's Solution uses two shared variables to coordinate synchronization between two processes:
Question : Peterson’s algorithm works correctly for how many processes?
Solution :
Correct Answer : 2
Description -
2 Explanation Peterson's algorithm is specifically designed and mathematically proven to work correctly for exactly two processes (typically denoted as P₀ and P₁). While generalized software solutions like Lamport's Bakery Algorithm exist for N processes, Peterson's original logic using a single turn variable and a two-element flag array cannot be directly scaled to 3 or more processes without losing its synchronization guarantees.
Question : Peterson’s Solution is used to solve which problem in Operating Systems?
Question : The Interested Variable mechanism is mainly used to solve:
Solution :
Correct Answer : Critical section problem
Description -
The Interested Variable mechanism is mainly used to solve the Critical section problem. Why this is the correct answer:
Question : When a process exits the critical section, it sets its interest variable to:
Solution :
Correct Answer : False
Description -
When a process exits the critical section, it sets its interest variable to False. The Explanation The Interested Variable mechanism is a software-based synchronization approach designed to regulate how two or more processes share a common resource (the critical section). It relies on a shared array of flags (usually Boolean), where each process has its own variable: interest[i]. The life cycle of a process using this mechanism operates in three phases: By changing the variable to False, the process officially announces that it has left the critical section and is no longer competing for it. This immediate toggle unblocks any other process that was waiting in the Entry Section, allowing the next process to safely enter.
Question : If Int[j] = true, process Pi will:
Solution :
Correct Answer : Wait in a loop
Description -
If Int[j] = true, process Pi will Wait in a loop. Why this happens:
Question : In the Interested Variable mechanism, the variable Int[i] indicates:
Solution :
Correct Answer : Interest of process to enter critical section
Description -
In the Interested Variable mechanism, the variable Int[i] indicates the Interest of process to enter critical section. Explanation:
Question : The Interested Variable Mechanism uses which type of variable?
Solution :
Correct Answer : Boolean variable
Description -
The Interested Variable Mechanism uses a Boolean variable. Why this is the correct answer:
Question : The waiting mechanism used in the turn variable approach is:
Solution :
Correct Answer : Busy waiting
Description -
The waiting mechanism used in the turn variable approach is Busy waiting. Why this is the correct answer:
Question : Which problem is NOT guaranteed to be satisfied by the strict alternation approach?
Solution :
Correct Answer : Progress
Description -
The problem that is NOT guaranteed to be satisfied by the strict alternation approach is Progress.
Question : In the strict alternation approach, a process can enter the critical section when:
Solution :
Correct Answer : turn variable equals its process ID
Description -
In the strict alternation approach, a process can enter the critical section when turn variable equals its process ID. Why this is the correct answer:
Question : The Turn Variable or Strict Alternation approach works for how many processes?
Solution :
Correct Answer : Two processes
Description -
The Turn Variable or Strict Alternation approach works for Two processes. Why this is the correct answer:
Question : The Turn Variable approach in Operating Systems is mainly used for:
Solution :
Correct Answer : Process synchronization
Description -
The Turn Variable approach in Operating Systems is mainly used for Process synchronization. Why this is the correct answer:
Question : Priority inversion mainly affects which type of systems?
Solution :
Correct Answer : Real-time systems
Description -
Priority inversion mainly affects Real-time systems. The Explanation Priority Inversion is a scenario in operating systems where a high-priority task is indirectly preempted by a lower-priority task, effectively reversing their assigned priorities. This scenario presents a major hazard in real-time systems, where tasks must meet strict timing constraints (deadlines). How Priority Inversion Happens (The Scenario) Imagine three tasks with varying priorities: High (\(T_{H}\)), Medium (\(T_{M}\)), and Low (\(T_{L}\)). In this situation, a medium-priority task is delaying a high-priority task. Why Real-Time Systems Are Most Affected In standard desktop or batch operating systems, priority inversion merely causes a temporary slowdown. However, in real-time systems (such as automotive controls, medical devices, or aerospace software), tasks must finish within exact microsecond windows. If a high-priority safety task is delayed indefinitely because of priority inversion, it will miss its deadline, which can result in catastrophic system failure. To prevent this, real-time operating systems (RTOS) use protocols like Priority Inheritance (where \(T_{L}\) temporarily inherits the high priority of \(T_{H}\) so it cannot be preempted by \(T_{M}\)).
Question : What type of lock situation occurs when neither process can proceed in the TSL scenario?
Solution :
Correct Answer : Spinlock
Description -
When neither process can proceed in the TSL (Test and Set Lock) scenario, the resulting lock situation is a Spinlock. To understand why this is a spinlock (and why it behaves like a temporary or permanent blockage), we have to look at how the Test and Set Lock (TSL) instruction functions at the hardware level. The TSL mechanism is a hardware-supported solution to the critical section problem. It uses a single shared atomic variable (often called lock). A process trying to enter the critical section runs a loop that looks like this: assembly enter_region: TSL REGISTER, LOCK | Copy lock to register and set lock to 1 CMP REGISTER, #0 | Was lock zero? JNZ enter_region | If it was non-zero, lock was already set; loop again RET | Return, enter critical section Use code with caution. When a process finds that the lock is already 1, it does not go to sleep or yield the CPU. Instead, it enters a tight, continuous loop, repeatedly executing the TSL instruction over and over again until the lock becomes 0. This mechanism is explicitly called a spinlock because the process "spins" in a loop while holding onto the CPU. The question describes a specific failure state where neither process can make progress. In a pure TSL scenario on a single-processor system, this happens due to a combination of a spinlock and priority inversion: As a result, the High-priority process spins forever waiting for a release that will never come, and the Low-priority process can never run to release it. While this situation creates a logical deadlock or livelock, the structural type of lock causing the stall is a spinlock.
Question : Why is process P2 unable to enter the critical section?
Solution :
Correct Answer : Lock variable is already set by P1
Description -
Process P2 is unable to enter the critical section because the Lock variable is already set by P1. The Explanation In process synchronization, a lock variable is a shared flag used to protect a critical section from being accessed by multiple processes at the same time. This mechanism ensures mutual exclusion through a simple set of rules: While P1 is inside executing its code, the lock remains 1. If Process P2 arrives and attempts to enter the critical section: P2 will remain stuck outside the critical section until P1 finishes its task, exits, and resets the lock variable back to 0.
Question : In the TSL mechanism example, which process initially enters the critical section?
Solution :
Correct Answer : P1
Description -
In the standard TSL (Test and Set Lock) mechanism example, the process that initially enters the critical section is P1. The Explanation In classic operating system textbook examples designed to demonstrate synchronization and mutual exclusion, processes are typically introduced in sequential order (\(P_1, P_2, P_3\), etc.) to illustrate how a locking mechanism handles competing requests. Here is the step-by-step breakdown of how \(P_{1}\) initially gains entry: Before any process tries to enter the critical section, the shared global hardware variable (often called LOCK) is initialized to 0 (which means unlocked/free). When \(P_{1}\) wants to enter its critical section, it executes the atomic hardware instruction TSL REGISTER, LOCK. \(P_{1}\) checks the value it just copied into its register. Because the register contains 0, the condition to wait is bypassed. \(P_{1}\) breaks past the entry loop and safely enters the critical section. While \(P_{1}\) is inside execution, LOCK remains 1. If \(P_{2}\) or any subsequent process arrives right after:
Question : Priority inversion occurs when:
Solution :
Correct Answer : Low-priority process blocks a high-priority process holding a resource
Description -
Priority inversion occurs when a Low-priority process blocks a high-priority process holding a resource (indirectly allowing a medium-priority process to run instead).