Marks 1
Consider three concurrent processes P1, P2 and P3 as shown below, which access a shared variable D that has been initialized to 100.
The process are ...
A file is organized so that the ordering of data records is the same as or close to the ordering of data entries in some index. Then that index is cal...
The following two functions P1 and P2 that share a variable B with an initial value of 2 execute concurrently.
P1( ) {
C = B – 1;
B = 2 * C;
}
P...
Three concurrent processes X, Y, and Z execute three different code segments that access and update certain shared variables. Process X executes the P...
Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared b...
Which of the following scheduling algorithms is non-preemptive?
Suppose a processor does not have any stack pointer register. Which of the following statements is true?
Where does the swap space reside?
Let m[0] ..m[4] be mutexes (binary semaphores) and P[0] ...P[4] be processes. Suppose each process P[i] executes the following: wait (m[i]); wait (m(m...
When the result of a computation depends on the speed of the processes involved there is said to be
A counting semaphore was initialized to 10. Then 6 P (wait) operations and 4 V (signal) operations were completed on this semaphore. The resulting val...
A critical section is a program segment
Marks 2
Each of a set of n processes executes the following code using two semaphores a and b initialized to 1 and 0, respectively. Assume that count is a sha...
A shared variable x, initialized to zero, is operated on by four concurrent processes W, X, Y, Z as follows. Each of the processes W and X reads x fro...
A certain computation generates two arrays a and b such that a[i]=f(i)for 0 ≤ i < n and b[i] = g (a[i] )for 0 ≤ i < n. Suppose this computation ...
Fetch_And_Add (X, i) is an atomic Read-Modify-Write instruction that reads the value of memory location X, increments it by the value i, and returns t...
The following program consists of 3 concurrent processes and 3 binary semaphores. The semaphores are initialized as S0=1, S1=0, S2=0.
How many times...
The enter_CS() and leave_CS() functions to implement critical section of a process are realized using test-and-set instruction as follows:
void enter_...
The P and V operations on counting semaphores, where s is a counting semaphore, are defined as follows:
P(s): s = s-1;
if s < 0 then wait;
V(s) ...
Two processes, P1 and P2, need to access a critical section of code. Consider the following synchronization construct used by the processes:
/* P1 *...
The atomic fetch-and-set x, y instruction unconditionally sets the memory location x to 1 and fetches the old value of x n y without allowing any inte...
Barrier is a synchronization construct where a set of processes synchronizes globally i.e. each process in the set arrives at the barrier and waits fo...
Barrier is a synchronization construct where a set of processes synchronizes globally i.e. each process in the set arrives at the barrier and waits fo...
Suppose we want to synchronize two concurrent processes P and Q using binary semaphores S and T. The code for the processes P and Q is shown below.
Pr...
Suppose we want to synchronize two concurrent processes P and Q using binary semaphores S and T. The code for the processes P and Q is shown below.
Pr...
Consider Peterson’s algorithm for mutual exclusion between two concurrent processes i and j. The program executed by process is shown below.
Repeat
...
Each process Pi,i=1.....9 is coded as follows
Repeat
P(mutex){
critical section
}
V(mutex)
Forever
The code for P10 is identical except...
A solution to the Dining Philosophers Problem which avoids deadlock is
The concurrent programming constructs fork and join are as below:
Fork (label) which creates a new process executing from the specified label join (v...
At a particular time of computation the value of a counting semaphore is 7. Then 20 P operations and 15 V operations were completed on this semaphore....
Semaphore operations are atomic because they are implemented within the OS
A critical region is: