Operating Systems Test - 5 - PDF Flipbook

Operating Systems Test - 5

276 Views
33 Downloads
PDF 5,467,968 Bytes

Download as PDF

REPORT DMCA


GATE
CSE

Operating
systems

Test-05Solutions


OPERATING SYSTEMS

1. Consider n processes sharing the CPU in a round-robin fashion.

Assuming that each process switch takes s seconds, what must

be the quantum size q such that the overhead resulting from

process switching is minimized but, at the same time each

process is guaranteed to get its turn at the CPU at least every t

seconds?

a) q ≤ −
−1

b) q ≥ −
−1

c) q ≤ −
+1

d) q ≥ −
+1

Answer: (a)

Solution:

Each process runs for q period and if there are n process p1 p2

p3 ...... pn p1 p2 ... then p1 turn comes again when it has

completed time quanta for remaining process p2 to pn i.e., it

would take at most (n – l)q time So Each process in round robin

gets its turn after 1) count (n-1);
printf(“%d”, d);
}
Void main ()
{
Count (3)
}
a) 3 1 2 2 1 3 4 4 4
b) 3 1 2 1 1 1 2 2 2
c) 3 1 2 2 1 3 4
d) 3 1 2 1 1 1 2
Answer: (a)

12


Solution:

20. Which of the following memory allocation scheme suffers from
external fragmentation?
a) Segmentation
b) Pure demand paging
c) Swapping
d) Paging
Answer: (a)
Solution:
Internal fragmentation is the area occupied by a process but can
be used by the process this space is unusable by the system until
the process release the space
External fragmentation exists when total free memory is enough
for the new process but it’s not contiguous and cannot satisfy
the request
Segmentation suffers from external fragmentation and paging
suffers from internal fragmentation

13


21. A Counting semaphore was initialized to 10. Then 6P (wait)
operations and 4V (Signal) operations were completed on this
semaphore. The resulting value of the semaphore is:_____.
a) 0
b) 8
c) 10
d) 12
Answer: (b)
Solution:
Since semaphore value s = 10
6P ⟹ S = S – 6 = 4
4V ⟹ S = S + 4 = 8

22. Which statement is not true about process O in the Unix
operating system?
a) Process O is called in it process.
b) Process O is not created by fork system call.
c) After forking process 1, process O becomes swapper process.
d) Process O is a special process created when system boots.
Answer: (a)
Solution:
In Unix-like operating systems, every process except process
O(the swapper) is created when another process executes the
fork () system cell process 1 known as it is the ancestor of every
other process in the system

14


Process O is a special process that is created when the system
boots
23. A Computer has six tape drives, with n processes competing for
them. Each process may need two drives. What is the maximum
value of n for the system to be deadlock free?
a) 6
b) 5
c) 4
d) 3
Answer: (b)
Solution:
If there are 5 processes then at least 1process will get 2 tape
drives out of 6 tape drives.
Hence the system is deadlock free.
24. The function 'f' is defined as follows:

int f(int n)
{
if (n

Data Loading...