GATE 2014 (Session 3)
65 questions
MCQ 47 · NAT 181-mark 30 · 2-mark 35
Questions 41–45 of 65
A system contains three programs and each requires three tape units for its operation. The minimum number of tape units which the system must have such that deadlocks never arise is _________.
Answer: 7
Think of the worst case: each of the 3 programs holds 2 tapes and waits for a third one. Together they hold 3 2 = 6 tapes, and this is a deadlock.
If the system has one more tape, one program can get it and finish. It then releases its tapes, so 6 + 1 = 7.
Answer: 7
If the system has one more tape, one program can get it and finish. It then releases its tapes, so 6 + 1 = 7.
Answer: 7
An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their arrival times and CPU burst times (in milliseconds):
The average waiting time (in milliseconds) of the processes is _________.
The average waiting time (in milliseconds) of the processes is _________.
Answer: 5.5
SRTF schedule:
- 0-2: P1 runs (remaining 10)
- 2-6: P2 runs (P3 comes at 3 and needs 6, which is more than what P2 has left)
- 6-12: P3 runs (P4 comes at 8 and needs 5, which is more than the 4 P3 has left)
- 12-17: P4 runs, then 17-27: P1 runs
Waiting time = completion time arrival time burst time:
P1 = 27 0 12 = 15, P2 = 0, P3 = 12 3 6 = 3, P4 = 17 8 5 = 4
Average = 22 / 4 = 5.5
Answer: 5.5
- 0-2: P1 runs (remaining 10)
- 2-6: P2 runs (P3 comes at 3 and needs 6, which is more than what P2 has left)
- 6-12: P3 runs (P4 comes at 8 and needs 5, which is more than the 4 P3 has left)
- 12-17: P4 runs, then 17-27: P1 runs
Waiting time = completion time arrival time burst time:
P1 = 27 0 12 = 15, P2 = 0, P3 = 12 3 6 = 3, P4 = 17 8 5 = 4
Average = 22 / 4 = 5.5
Answer: 5.5
Consider a paging hardware with a TLB. Assume that the entire page table and all the pages are in the physical memory. It takes 10 milliseconds to search the TLB and 80 milliseconds to access the physical memory. If the TLB hit ratio is 0.6, the effective memory access time (in milliseconds) is _________.
Answer: 122
Work out the time for each case:
- TLB hit: 10 + 80 = 90
- TLB miss: 10 + 80 (page table) + 80 (data) = 170
Effective memory access time (EMAT) = 0.6 90 + 0.4 170 = 54 + 68 = 122
Answer: 122
- TLB hit: 10 + 80 = 90
- TLB miss: 10 + 80 (page table) + 80 (data) = 170
Effective memory access time (EMAT) = 0.6 90 + 0.4 170 = 54 + 68 = 122
Answer: 122
Consider the basic block given below.
a= b + c
c =a + d
d =b + c
e =d - b
a =e + b
The minimum number of nodes and edges present in the DAG representation of the above basic block respectively are
a= b + c
c =a + d
d =b + c
e =d - b
a =e + b
The minimum number of nodes and edges present in the DAG representation of the above basic block respectively are
Answer: (A)
Work with the values to simplify:
- d = b + c, and e = d b = c (the new c). Then a = e + b = c + b = d.
So e uses the same node as c, and the last a uses the same node as d.
- Leaf nodes: b, c0, d0 (3 nodes)
- n1 = b + c0 (a), n2 = n1 + d0 (c, e), n3 = b + n2 (d, a). These are 3 more nodes, with 2 edges each.
Nodes = 6, edges = 6
Answer: 6 and 6
- d = b + c, and e = d b = c (the new c). Then a = e + b = c + b = d.
So e uses the same node as c, and the last a uses the same node as d.
- Leaf nodes: b, c0, d0 (3 nodes)
- n1 = b + c0 (a), n2 = n1 + d0 (c, e), n3 = b + n2 (d, a). These are 3 more nodes, with 2 edges each.
Nodes = 6, edges = 6
Answer: 6 and 6
Which one of the following problems is undecidable?
Answer: (A)
For context-free languages, checking membership (using CYK), checking emptiness and checking finiteness can all be decided.
Checking whether a CFG is ambiguous is undecidable. It can be shown by a reduction from the Post Correspondence Problem.
Answer: Deciding if a given context-free grammar is ambiguous
Checking whether a CFG is ambiguous is undecidable. It can be shown by a reduction from the Post Correspondence Problem.
Answer: Deciding if a given context-free grammar is ambiguous