GATE 2007
184 questions
MCQ 1841-mark 184
Questions 136–140 of 184
Group 1 contains some CPU scheduling algorithms and Group 2 contains some applications. Match entries in Group 1 to entries in Group 2. Group I Group II
Answer: (A)
- P. Gang scheduling: the threads of one process are scheduled together, at the same time on different CPUs. So it matches Thread scheduling (3).
- Q. Rate monotonic scheduling: fixed priorities for periodic tasks, where a shorter period gives a higher priority. It is a real-time algorithm, so it matches Real-time scheduling (2).
- R. Fair share scheduling: each user (or group) gets a fair share of the CPU, regardless of how many processes it runs. This is the idea behind Guaranteed scheduling (1), where each of the n users is promised about 1/n of the CPU time.
So P-3, Q-2, R-1.
Answer: (A)
- Q. Rate monotonic scheduling: fixed priorities for periodic tasks, where a shorter period gives a higher priority. It is a real-time algorithm, so it matches Real-time scheduling (2).
- R. Fair share scheduling: each user (or group) gets a fair share of the CPU, regardless of how many processes it runs. This is the idea behind Guaranteed scheduling (1), where each of the n users is promised about 1/n of the CPU time.
So P-3, Q-2, R-1.
Answer: (A)
The head of a hard disk serves requests following the shortest seek time first (SSTF) policy.
What is the maximum cardinality of the request set, so that the head changes its direction after servicing every request if the total number of tracks are 2048 and the head can start from any track?
What is the maximum cardinality of the request set, so that the head changes its direction after servicing every request if the total number of tracks are 2048 and the head can start from any track?
Answer: (C)
We want the largest set of requests in which the head turns back after every request under SSTF. This needs two things. The next request must be on the opposite side of the head, and it must be strictly nearer than every unserved request on the head's own side (a tie would keep the head moving the same way).
Let be the seek length of the -th request. To pack as many requests as possible, keep them as close as possible.
- The first seek can be 1 track, so .
- When the head moves from to (distance ), the request on the other side must be farther from than is, so at least away. The seek from to is then at least .
So , which gives 1, 3, 7, 15, ..., that is .
In the figure, the head starts at 0 and the seeks have length 1, 3, 7, 15. The black X marks show positions where a request would tie, so no request is placed there.
There are 2048 tracks, so the longest possible seek is . The -th seek needs , so . The largest set therefore has 11 requests.
Answer: (C)
Let be the seek length of the -th request. To pack as many requests as possible, keep them as close as possible.
- The first seek can be 1 track, so .
- When the head moves from to (distance ), the request on the other side must be farther from than is, so at least away. The seek from to is then at least .
So , which gives 1, 3, 7, 15, ..., that is .
In the figure, the head starts at 0 and the seeks have length 1, 3, 7, 15. The black X marks show positions where a request would tie, so no request is placed there.
There are 2048 tracks, so the longest possible seek is . The -th seek needs , so . The largest set therefore has 11 requests.
Answer: (C)
The head of a hard disk serves requests following the shortest seek time first (SSTF) policy. The head is initially positioned at track number 180.
Which of the request sets will cause the head to change its direction after servicing every request assuming that the head does not change direction if there is a tie in SSTF and all the requests arrive before the servicing starts?
Which of the request sets will cause the head to change its direction after servicing every request assuming that the head does not change direction if there is a tie in SSTF and all the requests arrive before the servicing starts?
Answer: (B)
The head must turn back after every request. A tie never turns the head, because on a tie it keeps going the same way. So at every step the nearer request must be on the opposite side, with no tie.
The head starts at 180. The nearest request is 181, so it moves up. From 181 the tracks 178 and 184 are both 3 away. The head continues its direction (up) on a tie, so it would go to 184 with no turn. This breaks options (A) and (C), which both have 184 and 178 together.
Options (B) and (D) share the start 180, 181, 178, 185. Now the head is at 185 having moved up. In (D), 170 and 200 are both 15 away, a tie, so the head continues up to 200 with no turn. This breaks (D).
Check (B), with requests 10, 138, 170, 178, 181, 185, 201, 265, one step at a time:
- 180 to 181 (1), up.
- 181: 178 is 3 away, 185 is 4 away, so go to 178, down.
- 178: 185 is 7 away, 170 is 8 away, so go to 185, up.
- 185: 170 is 15 away, 201 is 16 away, so go to 170, down.
- 170: 201 is 31 away, 138 is 32 away, so go to 201, up.
- 201: 138 is 63 away, 265 is 64 away, so go to 138, down.
- 138: 265 is 127 away, 10 is 128 away, so go to 265, up.
- 265: only 10 is left, so go down.
The direction alternates every time.
Answer: (B)
The head starts at 180. The nearest request is 181, so it moves up. From 181 the tracks 178 and 184 are both 3 away. The head continues its direction (up) on a tie, so it would go to 184 with no turn. This breaks options (A) and (C), which both have 184 and 178 together.
Options (B) and (D) share the start 180, 181, 178, 185. Now the head is at 185 having moved up. In (D), 170 and 200 are both 15 away, a tie, so the head continues up to 200 with no turn. This breaks (D).
Check (B), with requests 10, 138, 170, 178, 181, 185, 201, 265, one step at a time:
- 180 to 181 (1), up.
- 181: 178 is 3 away, 185 is 4 away, so go to 178, down.
- 178: 185 is 7 away, 170 is 8 away, so go to 185, up.
- 185: 170 is 15 away, 201 is 16 away, so go to 170, down.
- 170: 201 is 31 away, 138 is 32 away, so go to 201, up.
- 201: 138 is 63 away, 265 is 64 away, so go to 138, down.
- 138: 265 is 127 away, 10 is 128 away, so go to 265, up.
- 265: only 10 is left, so go down.
The direction alternates every time.
Answer: (B)
A demand paging system takes 100 time units to service a page fault and 300 time units to replace a dirty page. Memory access time is 1 time unit. The probability of a page fault is p. In case of a page fault, the probability of page being dirty is also p. It is observed that the average access time is 3 time units. Then the value of p is
Answer: (A)
Every memory access takes 1 time unit when there is no page fault, which has probability . With a page fault (probability ), the access takes 300 units if the page to be replaced is dirty (probability ) and 100 units if it is clean (probability ). These figures are the full time of that access.
The negative root is dropped because a probability cannot be negative. This matches option (A). The other options are far too large: for example already gives an average time above 10 units.
Answer: (A)
The negative root is dropped because a probability cannot be negative. This matches option (A). The other options are far too large: for example already gives an average time above 10 units.
Answer: (A)
The address sequence generated by tracing a particular program executing in a pure demand paging system with 100 bytes per page is
Suppose that the memory can store only one page and if x is the address which causes a page fault then the bytes from addresses x to x + 99 are loaded on to the memory. How many page faults will occur?
Suppose that the memory can store only one page and if x is the address which causes a page fault then the bytes from addresses x to x + 99 are loaded on to the memory. How many page faults will occur?
Answer: (C)
Address : page fault. Memory now holds addresses up to .
Address : page fault. Memory now holds addresses up to .
Address : page fault. Memory now holds addresses up to .
Address : no page fault.
Address : no page fault.
Address : page fault. Memory now holds addresses up to .
Address : no page fault.
Address : page fault. Memory now holds addresses up to .
Address : page fault. Memory now holds addresses up to .
Address : no page fault.
Address : no page fault.
Address : page fault. Memory now holds addresses up to .
Address : no page fault.
So the number of page faults is , and the answer is (C).