GATE 2009
66 questions
MCQ 661-mark 24 · 2-mark 42
Questions 51–55 of 66
Consider a disk system with 100 cylinders. The requests to access the cylinders
occur in following sequence:
4, 34, 10, 7, 19, 73, 2, 15, 6, 20
Assuming that the head is currently at cylinder 50, what is the time taken to satisfy all requests if it takes 1ms to move from one cylinder to adjacent one and shortest seek time first policy is used?
4, 34, 10, 7, 19, 73, 2, 15, 6, 20
Assuming that the head is currently at cylinder 50, what is the time taken to satisfy all requests if it takes 1ms to move from one cylinder to adjacent one and shortest seek time first policy is used?
Answer: (B)
With SSTF the head always serves the nearest pending request. Start at 50, with requests at 2, 4, 6, 7, 10, 15, 19, 20, 34, 73.
- From 50: 34 is 16 away and 73 is 23 away, so go to 34 (16).
- From 34: 20 is 14 away, 73 is 39 away, so go to 20 (14).
- Then 19 (1), 15 (4), 10 (5), 7 (3), 6 (1), 4 (2) and 2 (2). Each time the nearest request is the next one on the left.
- Only 73 is left, so go from 2 to 73 (71).
Total movement cylinders. At 1 ms per cylinder the time is 119 ms.
Answer: (B)
- From 50: 34 is 16 away and 73 is 23 away, so go to 34 (16).
- From 34: 20 is 14 away, 73 is 39 away, so go to 20 (14).
- Then 19 (1), 15 (4), 10 (5), 7 (3), 6 (1), 4 (2) and 2 (2). Each time the nearest request is the next one on the left.
- Only 73 is left, so go from 2 to 73 (71).
Total movement cylinders. At 1 ms per cylinder the time is 119 ms.
Answer: (B)
A multilevel page table is preferred in comparison to a single level page table for translating virtual address to physical address because
Answer: (B)
A single-level page table needs one entry for every page of the virtual address space, even for pages the process never uses. In a multilevel page table, only the second-level (and lower) tables for the parts of the address space that are in use need to be allocated. So the page table of a process takes much less memory. This is option (B).
The other options are wrong:
- (A) A multilevel table needs more memory accesses for each translation, so access time does not go down.
- (C) The TLB works with a single-level table as well, so it does not require a multilevel one.
- (D) The number of page faults depends on the replacement policy and the number of frames, not on how the table is organized. A multilevel table can even add faults, because a page of the table itself may not be in memory.
Answer: (B)
The other options are wrong:
- (A) A multilevel table needs more memory accesses for each translation, so access time does not go down.
- (C) The TLB works with a single-level table as well, so it does not require a multilevel one.
- (D) The number of page faults depends on the replacement policy and the number of frames, not on how the table is organized. A multilevel table can even add faults, because a page of the table itself may not be in memory.
Answer: (B)
The essential content(s) in each entry of a page table is / are
Answer: (B)
In a normal page table, the virtual page number is the index of the entry, so it is not stored in the entry. The entry must hold the page frame number, because that is what the translation returns: the physical address is the frame number joined with the offset.
- (A) and (C) are wrong, because the virtual page number is not stored in the entry.
- (D) Access rights (read, write, execute) and bits such as valid and dirty are normally kept in the entry, but the address translation itself does not need them. So they are not essential.
Answer: (B)
- (A) and (C) are wrong, because the virtual page number is not stored in the entry.
- (D) Access rights (read, write, execute) and bits such as valid and dirty are normally kept in the entry, but the address translation itself does not need them. So they are not essential.
Answer: (B)
In which one of the following page replacement policies, Belady's anomaly may occur?
Answer: (A)
Belady's anomaly means that giving a process more frames can lead to more page faults. It can happen with FIFO. Optimal, LRU and MRU are stack algorithms, so they do not show this anomaly.
Answer: FIFO
Answer: FIFO
Let R and S be relational schemes such that R={a,b,c} and S={c}. Now consider
the following queries on the database:
IV. Select R.a, R.b From R,S Where R.c=S.c
Which of the above queries are equivalent?
IV. Select R.a, R.b From R,S Where R.c=S.c
Which of the above queries are equivalent?
Answer: (A)
Here and holds values. The first three queries differ in the quantifier on and .
I. lists all pairs. Taking the product with gives every pair with every of . Subtracting leaves the combinations that are missing from . Projecting to gives the pairs that miss at least one of . Removing these from all pairs leaves the pairs that occur with every in . This is the division .
II. is an pair such that for every in some tuple of has and . This is also .
III. The quantifiers are swapped: for every tuple of , 's must equal and its must be in . So must be the of every tuple of . This is not division.
IV. The SQL query joins on and returns of each tuple of whose is in , with duplicates. It has no "for all" condition.
Example: , . I and II give only , the one pair seen with both 12 and 14. III gives nothing, because the tuples of have different values. IV gives twice, and .
So I and II are equivalent.
Answer: (A)
I. lists all pairs. Taking the product with gives every pair with every of . Subtracting leaves the combinations that are missing from . Projecting to gives the pairs that miss at least one of . Removing these from all pairs leaves the pairs that occur with every in . This is the division .
II. is an pair such that for every in some tuple of has and . This is also .
III. The quantifiers are swapped: for every tuple of , 's must equal and its must be in . So must be the of every tuple of . This is not division.
IV. The SQL query joins on and returns of each tuple of whose is in , with duplicates. It has no "for all" condition.
Example: , . I and II give only , the one pair seen with both 12 and 14. III gives nothing, because the tuples of have different values. IV gives twice, and .
So I and II are equivalent.
Answer: (A)