1. 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. The resulting value of the
semaphore is:
(a) 42 (b) 2 (c) 7 (d) 12
Ans:- Option - B
Explanation:-
The wait operation (P) decrements the semaphore
value.
The Signal operation(v) increments the semaphore
value.
The 20 P operation will decrements the semaphore
value 20 times.
The 15 V operation will increments the semaphore value
15 times.
GATE-1992
2. A computer system has 6 tape drives, with n
process completing for them.
Each process may need 3 tape drives. The maximum
value of n for which the
system is guaranteed to be deadlock free is:
(a) 2 (b) 3 (c) 4 (d) 1
Ans:-Option-A
Explanation:-
Deadlock:-
Deadlock is a situation in which two or more competing
actions are each waiting for the other to finish, and thus neither ever
does. Read more
Lets check with maximum value that is option c
suppose process 1==> 2 tape drives
process
2==> 2 tape drives
process
3==> 1 tape drive
process
4==> 1 tape drive
in this situation process 1 waiting for other processes to be free. and same
way process 2 waiting for process 2 waiting for other processes to be free. so
deadlock will occur.
Lets check option B
Process 1==> 2 tape drives.
Process 2==> 2 tape drives.
Process 3==> 2 tape drives.
Here also one process waiting for other process to release resources. so
deadlock will occur.
now check Option A
Process 1==> 3 tape drives.
Process 2==> 3 tape drives.
GATE-1992
3. Which of the following is an example of a
spooled device?
(a) The terminal used to the input data for a
program being executed.
(b) The secondary memory device in a virtual memory
system
(c) A line printer used to print the output of a
number of jobs.
(d) None of the above
Ans:- Option-C
Explanation:-
Spool means simultaneous
peripheral operations on-line.
The common spooling application is print spooling:
Generally Printers typically can print only a
single document at a time and require seconds or minutes to do so. With
spooling application, multiple processes can write documents to a print queue
without waiting. As soon as a process has written its document to the spool
device, the process can perform other tasks, while a separate printing process
operates the printer.
GATE-1993
1. Consider a system having m resources of the same
type. These resources are shared by 3 processes A, B and C, which have peak
demands of 3, 4 and 6 respectively. For what value of m deadlock will not
occur?
(a)7 (b) 9 (c) 10 (d) 13
(e) 15
Ans:- Option-D
Explanation:-
Lets start with option-A
Process A ==> 2 resources
Process B ==> 3 resources
Process C ==> 2 resources
In this situation one process will wait for other
processes to be free. so deadlock occur.
Option- B
Process A ==> 2 resources
Process B ==> 3 resources
Process C ==> 4 resources
Deadlock.
Option-C
Process A ==> 2 resources
Process B ==> 3 resources
Process C ==> 5 resources
Option D
Process A ==> 3 resources
Process B ==> 4 resources
Process C ==> 6 resources
So it will be deadlock free.
Note: Also option E is also possible.
GATE-1993
2. Assume that the following jobs are to be executed on a single processor
system
Job_id
|
Burst time
|
P
|
4
|
Q
|
1
|
R
|
8
|
S
|
1
|
T
|
2
|
The jobs are assumed to have arrived at time 0 and
in the order p, q, r, s, t.
Calculate
the departure time (completion time) for job p if scheduling is
round robin
with time slice 1
(a) 4 (b) 10 (c) 11 (d) 12 (e) None of the above
Ans:- option-C
Explanation:-