Operating systems miscellaneous
- The following two functions P1 and P2 that share a variable B with an initial value of 2 execute concurrently.
The number of district values that can possibly take after the ececution is ...............
-
View Hint View Answer Discuss in Forum
If we execute P2 process after P1 process, then we get B = 3
If we execute P1 process after P2 process, then we get B = 4
If we did preemption between P1 and P2 processes, then we get B = 2 (Preemption have done from P1 to P2) or B = 3 (Preemption have done from P2 to P1). So, among 2 and 3 values, only one value will be saved in B. So, total no. of different values that B can possibly take after the execution is 3.Correct Option: C
If we execute P2 process after P1 process, then we get B = 3
If we execute P1 process after P2 process, then we get B = 4
If we did preemption between P1 and P2 processes, then we get B = 2 (Preemption have done from P1 to P2) or B = 3 (Preemption have done from P2 to P1). So, among 2 and 3 values, only one value will be saved in B. So, total no. of different values that B can possibly take after the execution is 3.
- Consider the following two-process synchronization solution:
Process 0 Process 1 Entry: loop while (turn = = 1); Entry: loop while (turn = = 0); (critical section) (critical section) Exit: turn =1; Exit: turn = 0;
The shared variable turn is initialized to zero. Which one of the following is TRUE ?
-
View Hint View Answer Discuss in Forum
The given statement for two process synchronization using “Turn” variable, fulfils the condition of only mutual exclusion and bounded waiting but the progress is violated.
Correct Option: C
The given statement for two process synchronization using “Turn” variable, fulfils the condition of only mutual exclusion and bounded waiting but the progress is violated.
- Consider the following two phase locking protocol. Suppose a transaction T accesses (for read or write operations), a certain set of objects {O1; ...,Ok}. This is done in the following manner:
Step 1. T acquires exclusive locks to O1,..., Ok in increasing order of their addresses.
Step 2. The required operations are performed.
Step 3. All locks are released. This protocol will
-
View Hint View Answer Discuss in Forum
Two phase locking protocol ensures serializability and due to following linear order in acquiring the locks, there will be no deadlock.
Correct Option: A
Two phase locking protocol ensures serializability and due to following linear order in acquiring the locks, there will be no deadlock.
- Consider the following proposed solution for the critical section problem. There are n processes: P0 ...Pn - 1. In the code, function pmax returns an integer not smaller than any of its arguments. For all i, t[i] is initialized to zero.
Code for Pi:
do {
c[i] = 1; t[i] = pmax (t[0],..., t[n – 1]) + 1; c[i] = 0;
for every j ≠ i in{0,..., n–1} {
while(c[j]);
while(t[j] != 0 && t[j] <= t[i]);
}
Critical Section;
t[i] = 0;
Remainder Section;
} while (true);
Which one of the following is TRUE about the above solution?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
NA
- Using a larger block size in a fixed block size file system leads to
-
View Hint View Answer Discuss in Forum
Using larger block size in a fixed block size system lead to poor disk space utilization due to data items which are very small comparable to block size cause fragmentation. But it leads to better disk through put since no. of blocks needs to fetch & replace become less.
Correct Option: A
Using larger block size in a fixed block size system lead to poor disk space utilization due to data items which are very small comparable to block size cause fragmentation. But it leads to better disk through put since no. of blocks needs to fetch & replace become less.