Machine-translated by Google. Questions are authored in English.
Top

Process Synchronisation Questions and Answers

11.

Consider a non-negative counting semaphore S. The operation P(s) decrements S, and V(s) increments S. During an execution, 20 P(s) operations and 12 V(s) operations are issued in some order. The largest initial value of S for which at least one P(s) operation will remain blocked is :

Exam Year(s)

MH SET - 2024, SET Exam - 2024,

Answer: D

The largest initial value is 7.

Each P(s) consumes one unit and each V(s) supplies one. Starting from S, at most S + 12 of the P operations can ever complete. For at least one of the 20 P operations to remain blocked, that must be fewer than 20:

\[ \begin{aligned} S + 12 &\lt 20 \\ S &\lt 8 \end{aligned} \]

So S = 7 is the largest value. With S = 8, the 8 initial units plus 12 V operations are enough for all 20 P operations in a suitable order; 4, 5 and 6 also leave a P blocked but are not the largest.

Please log in or register to report this question.

12.

Consider a program, which spawn 20 threads to find out the sum of elements in a shared array of 200. Each thread i, takes elements A[i] to A[(20 * i) - 1] and compute local sum loc_sum [i] and eventually adds loc_sum[i] to a shared variable tot_sum for total sum which of the following needs to be placed inside a critical section ?

Exam Year(s)

MH SET - 2025, SET Exam - 2025,

Answer: B

Only adding to tot_sum must be in a critical section.

All threads update the shared variable tot_sum, and each update is a read-modify-write: read the total, add the local sum, write it back. If two threads interleave these steps, one update can be lost, so the addition must be protected by a lock or made atomic.

Reading the array values needs no protection because the threads only read the shared array and nobody writes to it while they run; each thread builds its own loc_sum. So neither 'reading array values' nor 'both' is needed, and 'neither' would allow lost updates.

Please log in or register to report this question.

13.

Which of the following ensures mutual exclusion in concurrent processes ?

Exam Year(s)

Tripura Public Service Commission - 2026,

Answer: B

Mutual exclusion is ensured by atomic test-and-set instructions.

A test-and-set instruction reads a lock variable and sets it to 1 in a single, indivisible hardware operation. A process enters its critical section only if the old value was 0; any other process that tries at the same moment sees 1 and must wait. Because no other process can slip in between the read and the write, only one process can hold the lock, which is the basis of spinlocks.

Unbuffered I/O only changes how data reaches a device. Environment variables and command-line arguments pass settings to a process when it starts. None of them coordinates access to shared data between running processes.

Please log in or register to report this question.

14.

What is the main disadvantage of Peterson's solution for mutual exclusion ?

Exam Year(s)

Tripura Public Service Commission - 2026,

Answer: B

The main disadvantage is that it fails on modern multi-core CPUs.

Peterson's algorithm for two processes uses a flag array and a turn variable, and in theory it guarantees mutual exclusion, progress and bounded waiting. But the proof assumes that every read and write to memory happens in program order and is seen at once by the other processor. Modern multi-core CPUs and compilers reorder memory operations and buffer stores, so both processes can see the other's flag as false and enter the critical section together. It works on such machines only with explicit memory barriers, which is why real systems use atomic hardware instructions instead.

Option A is false: ensuring progress is one of the algorithm's proven properties. External fragmentation is a memory-allocation problem, and high memory access time is not its characteristic weakness.

Please log in or register to report this question.

15.

The signal operation of the semaphore basically works on the basic ______ system call.

Exam Year(s)

Tripura Public Service Commission - 2019,

Answer: B

The signal operation works on the wakeup() system call.

In the blocking implementation of semaphores, wait() places a process that cannot proceed on the semaphore's waiting list and calls block(). signal() removes one process from that list and calls wakeup() to move it to the ready queue.

continue(), getup() and start() are not the operations used in this scheme.

Together wait() and signal() let a waiting process sleep instead of busy-waiting, so no CPU time is wasted while it waits for the semaphore.

Please log in or register to report this question.

Answer: B

A race condition is multiple processes accessing shared data concurrently, so that the result depends on the timing.

If two threads both read a counter, add one and write it back, their steps can interleave so that one update is lost, and the final value depends on which ran first. Code that touches shared data must be a critical section protected by mutual exclusion, with locks, semaphores or atomic operations.

Competition for the CPU is handled by the scheduler and is not a race condition. Waiting for I/O is ordinary blocking. Priority inversion is a different scheduling problem, where a high-priority task waits on a lower-priority one.

Please log in or register to report this question.

17.

What is the purpose of a semaphore in process synchronization ?

Exam Year(s)

Tripura Public Service Commission - 2026,

Answer: B

A semaphore is used to control access to shared resources.

A semaphore is an integer variable changed only by the atomic operations wait (P) and signal (V). A binary semaphore enforces mutual exclusion on a critical section, and a counting semaphore limits how many processes may use a pool of resources at once. Semaphores are also used to order events between processes.

Scheduling is the job of the CPU scheduler, memory allocation the job of the memory manager, and interrupts are handled by interrupt service routines. A semaphore does none of these.

Please log in or register to report this question.

Answer: C

The deadlock-free solution is to let one particular philosopher pick up the left fork first, while all the others pick up the right fork first.

Deadlock occurs when every philosopher holds one fork and waits for the next, forming a cycle. If all of them pick up forks in the same order, left first or right first, that cycle can form. Making one philosopher take the forks in the opposite order breaks the circular wait, so at least one philosopher can always get both forks.

So the first two options both allow deadlock, and since option C works, 'None of the above' is wrong.

Please log in or register to report this question.

19.

Match the following :

List - IList - II
a. Critical region1. Hoares Monitor
b. Wait/signal2. Mutual exclusion
c. Working set3. Principal of locality
d. Dead lock4. Circular wait

Codes : a b c d

Exam Year(s)

UGC NET - 2012,

Answer: A

A critical region is the section of code that needs mutual exclusion (2). Wait and signal are the operations of a monitor, which was proposed by Hoare (1). A working set is the set of pages a process is using, which rests on the principle of locality (3). Deadlock requires a circular wait among processes (4). The code is 2 1 3 4. In the other codes a pair is wrong, for example the third code gives the working set to Hoare's monitor, which is a synchronisation device and has nothing to do with paging. The keyed answer is the first code.

Please log in or register to report this question.

20.

A thread is a light weight process. In the above statement, weight refers to

Exam Year(s)

UGC NET - 2012,

Answer: B

A thread is called a light weight process because it needs fewer resources than a full process. Threads of a process share the code, data and open files, and only the registers and the stack are private to each, so creating and switching them is cheaper. The weight in the statement therefore refers to the number of resources. Time and speed are results of this and not what weight means. The keyed answer is the number of resources.

Please log in or register to report this question.

Loading…

Other Subjects

Tags: Process Synchronisation Questions and Answers || Process Synchronisation MCQ Questions and Answers || Process Synchronisation GK Questions and Answers || Process Synchronisation GK MCQ Questions || Process Synchronisation Multiple Choice Questions and Answers || Process Synchronisation GK || GK on Process Synchronisation || Operating Systems Questions and Answers || Operating Systems MCQ Questions and Answers || Operating Systems GK Questions and Answers || GK on Operating Systems