Process Synchronization — Operating System
Q1.
Which of the following conditions must hold for a race condition to occur?
A) Mutual exclusion
B) Concurrent access to shared data
C) Sequential process execution
D) Independent local variables
Answer: B
Solution:
A race condition arises when multiple processes concurrently access shared data, and the final output depends on the order of execution.
Q2.
The section of code where only one process can execute at a time is known as:
A) Semaphore section
B) Critical section
C) Mutual section
D) Protected block
Answer: B
Solution:
A critical section is the portion of code that accesses shared resources, requiring mutual exclusion to prevent conflicts.
Q3.
Which synchronization mechanism is busy waiting based?
A) Mutex
B) Monitor
C) Spinlock
D) Semaphore (sleep-waiting)
Answer: C
Solution:
Spinlocks use busy waiting where a process continuously checks if a lock is free, consuming CPU cycles.
Q4.
In the Producer–Consumer problem with a buffer size of 10, if there are 6 filled slots, the number of empty slots is:
A) 10
B) 4
C) 6
D) 0
Answer: B
Solution:
Empty slots = Total − Filled = 10 − 6 = 4.
Q5.
Which of the following cannot be used to implement mutual exclusion?
A) Test-and-Set instruction
B) Peterson’s algorithm
C) Semaphores
D) Sleep()
Answer: D
Solution:Sleep() suspends a process but does not ensure mutual exclusion or atomicity.
Q6.
Which statement about Peterson’s Algorithm is true?
A) Works only for multiple processes
B) Uses busy waiting
C) Uses semaphores
D) Does not ensure progress
Answer: B
Solution:
Peterson’s Algorithm uses busy waiting and guarantees mutual exclusion and progress for two processes.
Q7.
A binary semaphore can take values:
A) 0 and 1
B) 0, 1, and 2
C) Any integer
D) −1 and 1
Answer: A
Solution:
Binary semaphores (mutexes) only take values 0 (locked) or 1 (unlocked).
Q8.
If two processes are waiting indefinitely for resources held by each other, this is:
A) Starvation
B) Deadlock
C) Aging
D) Critical section violation
Answer: B
Solution:
Deadlock occurs when two or more processes are waiting indefinitely for events that only the other can cause.
Q9.
Which of the following ensures bounded waiting?
A) Test-and-Set
B) Peterson’s Algorithm
C) Disable interrupts
D) Spinlocks
Answer: B
Solution:
Peterson’s algorithm guarantees that each process will enter the critical section within bounded time.
Q10.
A counting semaphore initialized to 5 allows how many concurrent accesses?
A) 1
B) 0
C) 5
D) Unlimited
Answer: C
Solution:
Counting semaphores allow up to N (here 5) processes to enter the critical region concurrently.
Q11.
When a process enters the critical section without synchronization, it causes:
A) Busy waiting
B) Race condition
C) Deadlock
D) Starvation
Answer: B
Solution:
Lack of synchronization allows concurrent writes, resulting in race conditions.
Q12.
Which operation is atomic in semaphore implementation?
A) Wait and Signal
B) Only Wait
C) Only Signal
D) Both are non-atomic
Answer: A
Solution:
Both wait() and signal() must be atomic to prevent simultaneous modifications of semaphore value.
Q13.
If wait(S) decreases S from 1 to 0, and another process calls wait(S) again, it will:
A) Proceed
B) Block
C) Restart
D) Abort
Answer: B
Solution:
When semaphore S = 0, any further wait() calls block the calling process until signal() increments it.
Q14.
A monitor provides synchronization through:
A) Hardware interrupts
B) Conditional variables
C) Test-and-Set
D) Busy waiting
Answer: B
Solution:
Monitors use condition variables (wait() / signal()) for synchronization without busy waiting.
Q15.
Which of the following statements about monitors is false?
A) Only one process can execute inside a monitor at a time
B) Uses busy waiting
C) Higher-level synchronization construct
D) Implemented using semaphores
Answer: B
Solution:
Monitors do not use busy waiting — they rely on condition variables and blocking semantics.
Q16.
Which one of the following synchronization primitives can cause a process to block?
A) Spinlock
B) Wait (Semaphore)
C) Test-and-Set
D) Disable interrupts
Answer: B
Solution:
When a process performs wait() on a semaphore with value 0, it blocks until another process performs signal().
Q17.
The Dining Philosopher problem can cause:
A) Starvation
B) Race condition
C) Both A and B
D) None
Answer: C
Solution:
Without proper synchronization, philosophers can starve (never eat) or enter race conditions over forks.
Q18.
The signal() operation in semaphores is used to:
A) Decrease the semaphore value
B) Wake a waiting process
C) Block a process
D) Initialize the semaphore
Answer: B
Solution:signal() increases the semaphore value and wakes up one blocked process, if any.
Q19.
Which of the following is not a solution to the critical section problem?
A) Peterson’s algorithm
B) Test-and-Set instruction
C) Semaphores
D) Context switching
Answer: D
Solution:
Context switching is part of CPU scheduling, not a synchronization mechanism.
Q20.
A mutex is different from a binary semaphore because:
A) Mutex can be released by any process
B) Mutex can be released only by the process that acquired it
C) Mutex uses busy waiting
D) Semaphore cannot block
Answer: B
Solution:
A mutex must be unlocked only by the owner, unlike semaphores which can be signaled by any process.
Q21.
A system using spinlocks will:
A) Reduce CPU utilization under contention
B) Waste CPU cycles while waiting
C) Always be deadlock-free
D) Always ensure fairness
Answer: B
Solution:
Spinlocks waste CPU cycles since waiting threads continuously check lock status.
Q22.
A semaphore initialized to 1 can be used to implement:
A) Event synchronization
B) Mutual exclusion
C) Resource counting
D) None of the above
Answer: B
Solution:
A binary semaphore (value = 1) enforces mutual exclusion — only one process at a time.
Q23.
Which synchronization construct is typically used in reader-writer problems?
A) Counting semaphore
B) Spinlock
C) Monitor
D) Test-and-Set
Answer: C
Solution:
Monitors handle the reader-writer problem effectively using condition variables.
Q24.
In the bounded buffer problem, which semaphores are typically used?
A) mutex, empty, full
B) mutex, signal, block
C) wait, signal, count
D) reader, writer, queue
Answer: A
Solution:
Three semaphores control:
mutexfor mutual exclusionemptyfor available slotsfullfor filled slots.
Q25.
If a system allows priority-based preemption inside critical sections, it may lead to:
A) Priority inversion
B) Starvation
C) Deadlock
D) Mutual exclusion failure
Answer: A
Solution:
A low-priority process holding a lock can block a high-priority process, leading to priority inversion.
🧠 Operating System — Process Synchronization
Q26.
If two threads are executing in the same process, which synchronization primitive prevents concurrent modification of shared data?
A) Counting semaphore
B) Binary semaphore
C) Spinlock
D) Any of the above
Answer: D
Solution:
All listed primitives can ensure mutual exclusion to protect shared data — the implementation choice depends on performance and blocking needs.
Q27.
The Test-and-Set instruction:
A) Is used for context switching
B) Provides hardware-level mutual exclusion
C) Disables interrupts
D) Enables busy waiting removal
Answer: B
Solution:Test-and-Set is an atomic instruction used to lock a variable in hardware, providing low-level synchronization.
Q28.
Which one is a software-only solution for critical section problems?
A) Test-and-Set
B) Swap instruction
C) Peterson’s algorithm
D) Compare-and-Swap
Answer: C
Solution:
Peterson’s algorithm is purely software-based, ensuring mutual exclusion, progress, and bounded waiting for two processes.
Q29.
In Producer–Consumer problem, if the producer tries to insert into a full buffer, it should:
A) Overwrite old data
B) Block until a consumer consumes
C) Abort
D) Restart production
Answer: B
Solution:
The producer blocks when the buffer is full until a consumer frees a slot.
Q30.
Which statement about semaphores is false?
A) They can synchronize access to resources
B) Wait and Signal must be atomic
C) Counting semaphores can take negative values
D) Binary semaphores can prevent race conditions
Answer: C
Solution:
Semaphore values are non-negative integers. A negative counter is not allowed in standard definitions.
Q31.
The wait() operation decrements the semaphore value. If it becomes negative, this means:
A) A process must wait
B) Resource is available
C) Multiple processes can enter
D) System is idle
Answer: A
Solution:
When the semaphore becomes negative, the process blocks until another performs signal().
Q32.
In Dining Philosophers Problem, deadlock can occur if:
A) Each philosopher picks up one fork
B) One philosopher always eats
C) No one picks up forks
D) Forks are infinite
Answer: A
Solution:
If all philosophers pick up one fork and wait for another, the system enters deadlock.
Q33.
To prevent deadlock in Dining Philosophers, one solution is:
A) Allow all to eat simultaneously
B) Use only one fork per philosopher
C) Impose an ordering on resource acquisition
D) Disable interrupts
Answer: C
Solution:
Assigning an order to fork acquisition avoids circular wait, thus preventing deadlock.
Q34.
The Readers-Writers problem allows:
A) Multiple readers and multiple writers simultaneously
B) Multiple readers or one writer
C) Only one reader or writer
D) Only one reader and writer concurrently
Answer: B
Solution:
The rule: multiple readers can read concurrently, but only one writer may write at a time.
Q35.
Which synchronization construct uses condition variables?
A) Semaphore
B) Monitor
C) Mutex
D) Spinlock
Answer: B
Solution:
Monitors support wait() and signal() condition variables for controlled synchronization.
Q36.
A counting semaphore initialized to 3 can allow how many concurrent accesses before blocking?
A) 1
B) 3
C) Unlimited
D) 0
Answer: B
Solution:
Counting semaphore value = number of available instances of a resource, so 3 processes can proceed concurrently.
Q37.
Which of the following problems cannot be solved using semaphores?
A) Mutual exclusion
B) Process coordination
C) Deadlock detection
D) Synchronization
Answer: C
Solution:
Semaphores handle synchronization and exclusion, not deadlock detection.
Q38.
A process performing wait(mutex) and then crashing will cause:
A) Starvation
B) Deadlock
C) Race condition
D) Priority inversion
Answer: B
Solution:
If a process crashes while holding a lock, others waiting on wait() will never be released — a deadlock scenario.
Q39.
The Sleeping Barber problem models:
A) Mutual exclusion
B) Interprocess communication
C) Process synchronization and waiting queues
D) Deadlock prevention
Answer: C
Solution:
It models synchronization between a barber and customers using semaphores to manage waiting chairs.
Q40.
A binary semaphore initialized to 0 can be used to implement:
A) Resource counting
B) Event synchronization
C) Mutual exclusion
D) Priority scheduling
Answer: B
Solution:
When initialized to 0, a binary semaphore acts as an event signal between processes.
Q41.
If signal(S) is executed by a process that doesn’t own the semaphore, the result is:
A) Error
B) Unchanged state
C) Increment of S
D) System crash
Answer: C
Solution:
Semaphores are not owned, so any process can perform signal(S) safely, incrementing its value.
Q42.
The spinlock approach is preferred:
A) When the waiting time is small
B) For long waits
C) When context switching cost is high
D) Both A and C
Answer: D
Solution:
Spinlocks are efficient for short critical sections or when context switch overhead outweighs waiting time.
Q43.
The Compare-and-Swap instruction is used for:
A) Synchronization in multiprocessors
B) Virtual memory
C) Page replacement
D) Interrupt handling
Answer: A
Solution:Compare-and-Swap is an atomic synchronization primitive used to manage shared variables in multi-core systems.
Q44.
Which condition must not hold to prevent deadlock in synchronization?
A) Mutual exclusion
B) Hold and wait
C) Circular wait
D) No preemption
Answer: C
Solution:
Breaking circular wait (by ordering resources) prevents deadlock.
Q45.
In the Readers-Writers problem, if priority is always given to readers:
A) Writers may starve
B) Readers may starve
C) Deadlock always occurs
D) All readers get blocked
Answer: A
Solution:
If readers are always prioritized, writers may never get access, causing starvation.
Q46.
Which of the following is not true for monitors?
A) Automatic mutual exclusion
B) Only one process active inside
C) Explicit wait/signal usage
D) Requires busy waiting
Answer: D
Solution:
Monitors do not use busy waiting; processes sleep when waiting on a condition.
Q47.
In Peterson’s algorithm, if turn variable is not updated, which condition fails?
A) Mutual exclusion
B) Progress
C) Bounded waiting
D) Both B and C
Answer: D
Solution:
Without turn, processes can get stuck in waiting loops — progress and bounded waiting fail.
Q48.
A semaphore initialized to value N ensures at most how many processes can execute concurrently in a section?
A) N
B) N+1
C) 1
D) Unlimited
Answer: A
Solution:
Semaphore value limits the number of simultaneous entries — hence N concurrent processes.
Q49.
Which problem occurs when lower-priority processes hold locks needed by higher-priority processes?
A) Deadlock
B) Priority inversion
C) Race condition
D) Starvation
Answer: B
Solution:
This is priority inversion, solved using priority inheritance protocols.
Q50.
A binary semaphore can be implemented using:
A) Test-and-Set
B) Swap instruction
C) Compare-and-Swap
D) Any atomic instruction
Answer: D
Solution:
Any atomic test-and-update operation can safely implement a binary semaphore.
Q51.
Which of the following is a hardware-based synchronization primitive?
A) Monitor
B) Test-and-Set
C) Semaphore
D) Mutex
Answer: B
Solution:Test-and-Set is implemented directly in hardware for atomic locking.
Q52.
Which of the following prevents starvation in synchronization?
A) Aging
B) Busy waiting
C) Disabling interrupts
D) Test-and-Set
Answer: A
Solution:
Aging increases process priority over time, ensuring eventual access.
Q53.
If a process continuously enters and exits its critical section quickly while another never gets in, this violates:
A) Mutual exclusion
B) Progress
C) Bounded waiting
D) Deadlock freedom
Answer: C
Solution:
Bounded waiting ensures every process eventually gets its turn — violated here.
Q54.
Which synchronization problem involves a shared waiting room?
A) Dining Philosophers
B) Producer–Consumer
C) Sleeping Barber
D) Readers–Writers
Answer: C
Solution:
In Sleeping Barber, synchronization occurs between the barber and customers using a shared waiting room.
Q55.
In semaphore implementation, the waiting queue for processes is generally:
A) LIFO
B) FIFO
C) Priority-based
D) Random
Answer: B
Solution:
To ensure fairness and prevent starvation, semaphore queues are generally FIFO.
Q56.
In Dining Philosophers, allowing only 4 philosophers to sit at a table of 5 avoids:
A) Starvation
B) Deadlock
C) Race condition
D) Priority inversion
Answer: B
Solution:
At least one philosopher can eat, preventing the system from entering deadlock.
Q57.
Which primitive can replace semaphores and avoid busy waiting?
A) Monitors
B) Spinlocks
C) Test-and-Set
D) Compare-and-Swap
Answer: A
Solution:
Monitors are high-level constructs using blocking semantics instead of busy waiting.
Q58.
In priority inheritance, when a low-priority task holds a lock needed by a high-priority task, it:
A) Loses the lock
B) Inherits high priority
C) Is terminated
D) Gets preempted
Answer: B
Solution:
The low-priority process temporarily inherits the higher priority to prevent inversion.
Q59.
The signal() operation on a semaphore with value = 0 will:
A) Wake one waiting process
B) Wake all waiting processes
C) Block
D) No effect
Answer: A
Solution:
A single waiting process is awakened per signal() call.
Q60.
Disabling interrupts ensures mutual exclusion only in:
A) Multiprocessor systems
B) Single-processor systems
C) Distributed systems
D) Clustered systems
Answer: B
Solution:
In a uniprocessor, disabling interrupts prevents context switching, ensuring exclusion.
Q61
Which of the following is a classical synchronization problem?
A) Sleeping Barber
B) Page Replacement
C) CPU Scheduling
D) File Allocation
Answer: A
Solution:
The Sleeping Barber problem is one of the classic synchronization problems representing inter-process coordination using semaphores.
Q62.
If a semaphore value becomes negative, it represents:
A) Number of waiting processes
B) Number of available resources
C) Number of running threads
D) None of the above
Answer: A
Solution:
A negative value of a semaphore indicates how many processes are currently blocked and waiting for the resource.
Q63.
When using semaphores to solve Producer–Consumer, which semaphore ensures mutual exclusion on buffer access?
A) mutex
B) empty
C) full
D) lock
Answer: A
Solution:mutex ensures only one process (producer or consumer) accesses the shared buffer at a time.
Q64.
Which type of semaphore can be used to limit resource access to at most N processes simultaneously?
A) Binary semaphore
B) Counting semaphore
C) Monitor
D) Spinlock
Answer: B
Solution:
A counting semaphore initialized to N controls how many processes can concurrently access a limited resource.
Q65.
In the Dining Philosophers Problem, if all philosophers pick up their left fork first, the system:
A) Always avoids deadlock
B) May deadlock
C) Allows two to eat
D) Becomes starvation-free
Answer: B
Solution:
If all philosophers pick the same side fork first, circular wait may occur — a classic deadlock.
Q66.
Which synchronization primitive is implemented inside the kernel for thread coordination?
A) Mutex
B) Monitor
C) Critical section
D) Spinlock
Answer: A
Solution:
Kernel-level mutexes coordinate threads/processes within kernel space to ensure safe resource sharing.
Q67.
A race condition can only occur when:
A) Two or more threads access shared data concurrently
B) There is no preemption
C) Mutual exclusion is guaranteed
D) Each thread has its own data
Answer: A
Solution:
Concurrent unsynchronized access to shared data causes unpredictable results — the definition of a race condition.
Q68.
Which mechanism provides automatic blocking instead of busy waiting?
A) Semaphore
B) Monitor
C) Spinlock
D) Test-and-Set
Answer: B
Solution:
Monitors automatically block a waiting process using condition variables — no CPU is wasted.
Q69.
If a process executes wait(S) followed immediately by signal(S) with no critical section in between:
A) The semaphore value increases
B) The semaphore value remains unchanged
C) It causes deadlock
D) It blocks the process
Answer: B
Solution:wait(S) decrements and signal(S) increments, resulting in no net effect on semaphore value.
Q70.
Which approach guarantees no deadlock but may cause starvation?
A) Priority scheduling
B) Resource ordering
C) Readers-preferred synchronization
D) Spinlock
Answer: C
Solution:
In the readers-preferred solution of the Readers–Writers problem, writers can starve indefinitely.
Q71.
Which of the following ensures that every process eventually enters its critical section?
A) Progress
B) Bounded waiting
C) Mutual exclusion
D) Deadlock prevention
Answer: B
Solution:
Bounded waiting ensures a finite limit on how long any process waits before entering its critical section.
Q72.
In a system with preemptive scheduling, if a process inside a critical section is preempted, what must be ensured?
A) Mutual exclusion still holds
B) Race conditions occur
C) Critical section re-entry allowed
D) Semaphore reset
Answer: A
Solution:
Synchronization primitives (mutex/semaphore) ensure mutual exclusion even under preemption.
Q73.
If two semaphores control two shared resources, improper ordering of wait() operations may cause:
A) Deadlock
B) Starvation
C) Race condition
D) Priority inversion
Answer: A
Solution:
If each process holds one semaphore and waits for the other, circular wait leads to deadlock.
Q74.
In the Sleeping Barber problem, when no customers are present:
A) Barber continues to work
B) Barber sleeps until awakened
C) Barber terminates
D) Barber spins in a loop
Answer: B
Solution:
The barber process sleeps and is awakened by a new customer — modeled using semaphores.
Q75.
A semaphore initialized to 1 is functionally equivalent to:
A) A monitor
B) A binary lock or mutex
C) A counting semaphore
D) None
Answer: B
Solution:
A binary semaphore (1/0) behaves like a mutex, allowing only one process access at a time.
Q76.
Which of the following statements about Test-and-Set is true?
A) It is non-atomic
B) It guarantees fairness
C) It is a hardware-level atomic instruction
D) It causes no busy waiting
Answer: C
Solution:Test-and-Set executes atomically in hardware, preventing simultaneous variable modification.
Q77.
If a system uses mutex locks without any timeout, it may lead to:
A) Deadlock
B) Starvation
C) Preemption
D) Fair scheduling
Answer: A
Solution:
Processes may wait forever for a lock held by a crashed or stuck thread — a deadlock scenario.
Q78.
Which of the following does not require synchronization?
A) Access to global variables
B) Reading a shared array by multiple readers
C) Writing to a shared variable
D) Incrementing a counter by multiple threads
Answer: B
Solution:
Multiple readers can access shared data simultaneously without modification — no synchronization required.
Q79.
A semaphore used for synchronizing producer and consumer must be initialized to:
A) 0 for full, N for empty
B) N for full, 0 for empty
C) N for both
D) 0 for both
Answer: A
Solution:
For a buffer of size N:
full = 0(no filled slots initially)empty = N(all slots empty initially).
Q80.
The key difference between a mutex and a semaphore is that:
A) Semaphore can be released by any process
B) Mutex allows multiple owners
C) Semaphore doesn’t block
D) Mutex uses busy waiting
Answer: A
Solution:
A mutex must be released by the owner thread, but a semaphore can be signaled by any process.
Q81.
The signal() operation in semaphores corresponds to:
A) Releasing a resource
B) Acquiring a resource
C) Waiting for a resource
D) Checking a resource state
Answer: A
Solution:signal() increments the semaphore value — indicating resource release.
Q82.
If two processes repeatedly execute wait(mutex) but never execute signal(mutex), it results in:
A) Starvation
B) Deadlock
C) Race condition
D) No problem
Answer: B
Solution:
All processes block indefinitely since no one signals the mutex — deadlock.
Q83.
Which of the following techniques is used to ensure atomicity in synchronization?
A) Interrupt disabling
B) Busy waiting
C) Context switching
D) Polling
Answer: A
Solution:
Disabling interrupts ensures a critical instruction sequence executes atomically without preemption.
Q84.
The property “Progress” ensures:
A) Mutual exclusion
B) At least one process makes progress if no one is in critical section
C) All processes wait forever
D) No preemption
Answer: B
Solution:
Progress means if no process is in critical section, one waiting process must enter soon.
Q85.
Which one of the following can lead to livelock?
A) Two processes repeatedly releasing and acquiring resources
B) Processes waiting forever
C) Starvation
D) Sleeping Barber
Answer: A
Solution:
In livelock, processes are active but continually change states without making progress.
Q86.
When two threads alternate access to a shared variable properly, it demonstrates:
A) Race condition
B) Proper synchronization
C) Deadlock
D) Context switching
Answer: B
Solution:
Correct alternation means synchronized access, ensuring safe updates.
Q87.
Which synchronization primitive can both wake and block processes?
A) Semaphore
B) Spinlock
C) Test-and-Set
D) Compare-and-Swap
Answer: A
Solution:
Semaphores support both blocking (wait) and waking (signal) operations.
Q88.
If a binary semaphore is used for signaling between producer and consumer, its initial value should be:
A) 0
B) 1
C) −1
D) N
Answer: A
Solution:
A value of 0 ensures the consumer waits until the producer produces and signals.
Q89.
Which mechanism is suitable for short critical sections in multi-core processors?
A) Spinlock
B) Semaphore
C) Monitor
D) Event variable
Answer: A
Solution:
Spinlocks avoid expensive context switches — ideal for short, fast locks.
Q90.
Which synchronization issue can be avoided using turn variables?
A) Deadlock
B) Busy waiting
C) Race condition
D) Starvation
Answer: C
Solution:
Turn variables ensure alternate entry to critical section — eliminating race conditions.
Q91.
Which of the following is not a requirement for critical section solutions?
A) Progress
B) Mutual exclusion
C) Infinite waiting
D) Bounded waiting
Answer: C
Solution:
Critical section requirements exclude infinite waiting, as that implies starvation.
Q92.
In Peterson’s algorithm, the shared variable flag represents:
A) Resource count
B) Intention to enter critical section
C) Waiting list
D) Process ID
Answer: B
Solution:
Each process sets its flag[i] = true when it intends to enter its critical section.
Q93.
Which synchronization primitive cannot be used directly across multiple computers in a distributed system?
A) Semaphore
B) Mutex
C) Monitor
D) All of the above
Answer: D
Solution:
These are local synchronization primitives — distributed systems require message-passing mechanisms.
Q94.
A semaphore value of 2 means:
A) 2 resources are free
B) 2 processes are blocked
C) 2 processes can enter concurrently
D) Both A and C
Answer: D
Solution:
Semaphore value represents available resources and number of processes allowed simultaneously.
Q95.
Busy waiting wastes CPU cycles because:
A) Processes remain in ready queue
B) Processes continuously test a condition
C) Process enters sleep mode
D) Context switch is frequent
Answer: B
Solution:
In busy waiting, the process repeatedly tests lock availability, consuming CPU without doing useful work.
Q96.
Which synchronization mechanism is both software and hardware independent?
A) Semaphore
B) Monitor
C) Message passing
D) Spinlock
Answer: C
Solution:
Message passing does not depend on shared memory or atomic hardware primitives — works across systems.
Q97.
Which property ensures no two processes execute critical section simultaneously?
A) Progress
B) Bounded waiting
C) Mutual exclusion
D) Deadlock prevention
Answer: C
Solution:
Mutual exclusion guarantees that only one process executes critical section at any time.
Q98.
The compare-and-swap instruction operates on:
A) A single memory location atomically
B) Two locations simultaneously
C) A register and a memory location atomically
D) Multiple cores concurrently
Answer: C
Solution:
It compares a memory location with a register and swaps them atomically if equal.
Q99.
Which situation describes starvation?
A) A process waiting indefinitely despite availability
B) All processes blocked
C) Two processes waiting for each other
D) One process monopolizing CPU
Answer: A
Solution:
Starvation occurs when a process waits indefinitely due to unfair scheduling or priority.
Q100.
Which synchronization problem models a scenario with multiple barbers and waiting customers?
A) Sleeping Barber (extended)
B) Dining Philosophers
C) Readers–Writers
D) Producer–Consumer
Answer: A
Solution:
The multi-barber Sleeping Barber is an extended synchronization problem illustrating multiple concurrent service providers.