GATE 2001
60 questions
MCQ 601-mark 60
Questions 46–50 of 60
Answer: (C)
Relocation means giving load addresses to the parts of a program that depend on position. The code and data are then adjusted to match the assigned addresses.
So, Option C is the answer.
Symbol resolution means searching files and libraries. Symbolic references or library names are replaced with real, usable memory addresses before the program runs.
Answer: (D)
The scheduler is not an interrupt source. It is a part of the OS that runs after the running process has already left the CPU (by a timer interrupt, an I/O request or exit), and it then picks the next process.
Answer: (D)
Answer: (B)
Option (B) is correct.
Swap space is a part of the hard disk. It is part of the Virtual Memory of the machine. Virtual Memory is made of the usable physical memory (RAM) and the swap space. Swap space holds memory pages that are inactive, for a short time. The system uses swap space when active processes need physical memory and there is not enough free physical memory. If the system needs more memory, inactive pages in physical memory are moved to the swap space. This frees that physical memory for other uses. Swap is slower to access, so do not treat it as a full replacement for physical memory. Swap space can be a dedicated swap partition (recommended), a swap file, or both together.
repeat
flag [i] = true;
turn = j;
while ( P ) do no-op;
Enter critical section, perform actions, then exit critical
section
flag [ i ] = false;
Perform other non-critical section actions.
until false; For the program to guarantee mutual exclusion, the predicate P in the while loop should beAnswer: (B)
flag[i] and turn = j shows.Process sets
flag[i] = true to show it wants to enter, then gives the turn to the other process with turn = j. It must wait while the other process also wants to enter and it is the other's turn. So P = flag[j] = true and turn = j.Why this gives mutual exclusion. If both want to enter, both flags are true, and the shared variable
turn holds the value written last. If turn = j, then waits and goes in (j's test is turn = i, which is false). If turn = i, then waits and goes in. Only one process can pass. So the process that writes turn first enters first, because the later write sends the turn back to the earlier process. If the other process is not interested, flag[j] is false and enters at once (progress). Since a process hands over the turn, it cannot enter again and again while the other waits (bounded waiting).Why (A) fails. The loop would test
turn = i, but has just set turn = j. So the test is false and enters even if is already inside its critical section, since left turn = i behind.Why (C) and (D) fail. They test
flag[i], which has just set to true, so they never look at whether the other process wants to enter. (D) is false straight away, so can enter while is inside. (C) makes wait even when is not interested.Answer: (B)
Answer: (B)
Answer : Shortest job first
Throughput is the number of tasks finished in one unit of time. Shortest Job First gives the highest throughput. It runs the shortest jobs first, so the most tasks get completed.
Note: The Highest-Response-Ratio-Next policy also prefers shorter jobs, but it puts a limit on how long the longer jobs have to wait.