1
GATE CSE 2006
MCQ (Single Correct Answer)
+2
-0.6
Consider three processes (process id $$0,1,2,$$ respectively) with compute time bursts $$2, 4,$$ and $$8$$ time units. All processes arrive at time zero. Consider the longest remaining time first $$(LRTF)$$ scheduling algorithm. In $$LRTF$$ ties are broken by giving priority to the process with the lowest process id. The average turn around time is
A
$$13$$ units
B
$$14$$ units
C
$$15$$ units
D
$$16$$ units
2
GATE CSE 2006
MCQ (Single Correct Answer)
+2
-0.6
Consider three processes, all arriving at time zero, with total execution time of $$10,20,$$ and $$30$$ units, respectively. Each process spends the first $$20$$% of execution time doing $${\rm I}/O$$, the next $$70$$% of time doing computation, and the last $$10$$% of time doing $${\rm I}/O$$ again. The operating system uses a shortest remaining compute time first scheduling algorithm and scheduling a new process either when the running processes gets blocked on $${\rm I}/O$$ or when the running process finishes its compute burst. Assume that all $${\rm I}/O$$ operations can be overlapped as much as possible. For what percentage of time does the $$CPU$$ remain idle?
A
$$0$$%
B
$$10.6$$%
C
$$30.0$$%
D
$$89.4$$%
3
GATE CSE 2006
MCQ (Single Correct Answer)
+2
-0.6
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 for all others to arrive and then all processes leave the barrier. Let the number of processes in the set be three and S be a binary semaphore with the usual P and V functions. Consider the following C implementation of a barrier with line numbers shown on left.
void barrier (void) { 
1: P(S); 
2: process_arrived++; 
3: V(S); 
4: while (process_arrived !=3); 
5: P(S); 
6: process_left++; 
7: if (process_left==3) { 
8: process_arrived = 0; 
9: process_left = 0; 
10: } 
11: V(S); 
} 
The variables process_arrived and process_left are shared among all processes and are initialized to zero. In a concurrent program all the three processes call the barrier function when they need to synchronize globally.
The above implementation of barrier is incorrect. Which one of the following is true?
A
The barrier implementation is wrong due to the use of binary semaphore S.
B
The barrier implementation may lead to deadlock if two invocations are used in immediate succession
C
Lines 6 to 10 need not be inside a critical section.
D
The barrier implementation is correct if there are only two processes instead of three.
4
GATE CSE 2006
MCQ (Single Correct Answer)
+2
-0.6
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 for all others to arrive and then all processes leave the barrier. Let the number of processes in the set be three and S be a binary semaphore with the usual P and V functions. Consider the following C implementation of a barrier with line numbers shown on left.
void barrier (void) { 
1: P(S); 
2: process_arrived++; 
3: V(S); 
4: while (process_arrived !=3); 
5: P(S); 
6: process_left++; 
7: if (process_left==3) { 
8: process_arrived = 0; 
9: process_left = 0; 
10: } 
11: V(S); 
} 
The variables process_arrived and process_left are shared among all processes and are initialized to zero. In a concurrent program all the three processes call the barrier function when they need to synchronize globally.
Which one of the following rectifies the problem in the implementation?
A
Lines 6 to 10 are simply replaced by process_arrived--
B
At the beginning of the barrier the first process to enter the barrier waits until process_arrived becomes zero before proceeding to execute P(S).
C
Context switch is disabled at the beginning of the barrier and re-enabled at the end.
D
The variable process_left is made private instead of shared
EXAM MAP
Medical
NEET
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
CBSE
Class 12