Operating Systems questions — page 3 of 7

Q63

GATE CS 2022 CSFile SystemsNAT2 marks
Consider two files systems AA and BB, that use contiguous allocation and linked allocation, respectively. A file of size 100 blocks is already stored in AA and also in BB. Now, consider inserting a new block in the middle of the file (between 50th50^{\text{th}} and 51st51^{\text{st}} block), whose data is already available in the memory. Assume that there are enough free blocks at the end of the file and that the file control blocks are already in memory. Let the number of disk accesses required to insert a block in the middle of the file in AA and BB are nAn_A and nBn_B, respectively, then the value of nA+nBn_A + n_B is_________.
Show answer without attempting

Answer: 153

Q64

GATE CS 2022 CSMemory ManagementNAT2 marks
Consider a demand paging system with four page frames (initially empty) and LRU page replacement policy. For the following page reference string

7,2,7,3,2,5,3,4,6,7,7,1,5,6,17, 2, 7, 3, 2, 5, 3, 4, 6, 7, 7, 1, 5, 6, 1

the page fault rate, defined as the ratio of number of page faults to the number of memory accesses (rounded off to one decimal place) is_________.
Show answer without attempting

Answer: 0.6

Q11

GATE CS 2021 CS-1Memory ManagementMSQ1 mark
In the context of operating systems, which of the following statements is/are correct with respect to paging?
More than one option can be correct.
Show answer without attempting

Answer: A, C

Q14

GATE CS 2021 CS-1Processes and ThreadsMSQ1 mark
Which of the following standard C library functions will always invoke a system call when executed from a single-threaded process in a UNIX/Linux operating system?
More than one option can be correct.
Show answer without attempting

Answer: A, C

Q15

GATE CS 2021 CS-1File SystemsMSQ1 mark
Consider a linear list based directory implementation in a file system. Each directory is a list of nodes, where each node contains the file name along with the file metadata, such as the list of pointers to the data blocks. Consider a given directory foo.
Which of the following operations will necessarily require a full scan of foo for successful completion?
More than one option can be correct.
Show answer without attempting

Answer: A, C

Q25

GATE CS 2021 CS-1SchedulingNAT1 mark
Three processes arrive at time zero with CPU bursts of 16, 20 and 10 milliseconds. If the scheduler has prior knowledge about the length of the CPU bursts, the minimum achievable average waiting time for these three processes in a non-preemptive scheduler (rounded to nearest integer) is ______ milliseconds.
Show answer without attempting

Answer: 12

Q46

GATE CS 2021 CS-1Concurrency and SynchronizationMSQ2 marks
Consider the following pseudocode, where S is a semaphore initialized to 5 in line#2 and counter is a shared variable initialized to 0 in line#1. Assume that the increment operation in line#7 is not atomic.
1. int counter = 0;
2. Semaphore S = init(5);
3. void parop(void)
4. {
5.     wait(S);
6.     wait(S);
7.     counter++;
8.     signal(S);
9.     signal(S);
10.}
If five threads execute the function parop concurrently, which of the following program behavior(s) is/are possible?
More than one option can be correct.
Show answer without attempting

Answer: A, B, D

Q14

GATE CS 2021 CS-2SchedulingMSQ1 mark
Which of the following statement(s) is/are correct in the context of CPU scheduling?
More than one option can be correct.
Show answer without attempting

Answer: A, C, D

Q42

GATE CS 2021 CS-2Processes and ThreadsMSQ2 marks
Consider the following multi-threaded code segment (in a mix of C and pseudo-code), invoked by two processes P1 and P2, and each of the processes spawns two threads T1 and T2:
int x = 0; // global
Lock L1; // global
main() {
    create a thread to execute foo(); // Thread T1
    create a thread to execute foo(); // Thread T2
    wait for the two threads to finish execution;
    print (x);}

foo() {
    int y = 0;
    Acquire L1;
    x = x + 1;
    y = y + 1;
    Release L1;
    print (y);}
Which of the following statement(s) is/are correct?
More than one option can be correct.
Show answer without attempting

Answer: A, D

Q43

GATE CS 2021 CS-2DeadlocksMSQ2 marks
Consider a computer system with multiple shared resource types, with one instance per resource type. Each instance can be owned by only one process at a time. Owning and freeing of resources are done by holding a global lock (L). The following scheme is used to own a resource instance :
function OWNRESOURCE(Resource R)
    Acquire lock L // a global lock
    if R is available then
        Acquire R
        Release lock L
    else
        if R is owned by another process P then
            Terminate P, after releasing all resources owned by P
            Acquire R
            Restart P
            Release lock L
        end if
    end if
end function
Which of the following choice(s) about the above scheme is/are correct?
More than one option can be correct.
Show answer without attempting

Answer: A, B, C

Q48

GATE CS 2021 CS-2Memory ManagementNAT2 marks
Consider a three-level page table to translate a 39-bit virtual address to a physical address as shown below.

The page size is 4KB (1KB=2101\text{KB} = 2^{10} bytes) and page table entry size at every level is 8 bytes. A process PP is currently using 2GB (1GB=2301\text{GB} = 2^{30} bytes) virtual memory which is mapped to 2GB of physical memory. The minimum amount of memory required for the page table of PP across all levels is ____________ KB.
Question figure
Show answer without attempting

Answer: 4108

Q11

GATE CS 2020 CSMemory ManagementMCQ1 mark−1/3 if wrong
Consider allocation of memory to a new process. Assume that none of the existing holes in the memory will exactly fit the process’s memory requirement. Hence, a new hole of smaller size will be created if allocation is made in any of the existing holes. Which one of the following statements is TRUE?
Show answer without attempting

Answer: C

Q12

GATE CS 2020 CSProcesses and ThreadsMCQ1 mark−1/3 if wrong
Consider the following statements about process state transitions for a system using preemptive scheduling.

I. A running process can move to ready state.
II. A ready process can move to running state.
III. A blocked process can move to running state.
IV. A blocked process can move to ready state.

Which of the above statements are TRUE?
Show answer without attempting

Answer: C

Q34

GATE CS 2020 CSConcurrency and SynchronizationMCQ2 marks−2/3 if wrong
Each of a set of nn processes executes the following code using two semaphores a and b initialized to 1 and 0, respectively. Assume that count is a shared variable initialized to 0 and not used in CODE SECTION P.
CODE SECTION P

wait(a); count=count+1;
if (count==n) signal(b);
signal(a); wait(b); signal(b);

CODE SECTION Q
What does the code achieve?
Show answer without attempting

Answer: A

Q35

GATE CS 2020 CSSchedulingMCQ2 marks−2/3 if wrong
Consider the following five disk access requests of the form (request id, cylinder number) that are present in the disk scheduler queue at a given time.

(P, 155), (Q, 85), (R, 110), (S, 30), (T, 115)

Assume the head is positioned at cylinder 100. The scheduler follows Shortest Seek Time First scheduling to service the requests.

Which one of the following statements is FALSE?
Show answer without attempting

Answer: B

Q50

GATE CS 2020 CSSchedulingNAT2 marks
Consider the following set of processes, assumed to have arrived at time 0. Consider the CPU scheduling algorithms Shortest Job First (SJF) and Round Robin (RR). For RR, assume that the processes are scheduled in the order P1,P2,P3,P4P_1, P_2, P_3, P_4.
ProcessesP1P_1P2P_2P3P_3P4P_4
Burst time (in ms)8724
If the time quantum for RR is 4 ms, then the absolute value of the difference between the average turnaround times (in ms) of SJF and RR (round off to 2 decimal places) is __________.
Show answer without attempting

Answer: 5.25

Q53

GATE CS 2020 CSMemory ManagementNAT2 marks
Consider a paging system that uses 1-level page table residing in main memory and a TLB for address translation. Each main memory access takes 100 ns and TLB lookup takes 20 ns. Each page transfer to/from the disk takes 5000 ns. Assume that the TLB hit ratio is 95%, page fault rate is 10%. Assume that for 20% of the total page faults, a dirty page has to be written back to disk before the required page is read in from disk. TLB update time is negligible. The average memory access time in ns (round off to 1 decimal places) is __________.
Show answer without attempting

Answer: 154.5 to 155.5

Q17

GATE CS 2019 CSProcesses and ThreadsNAT1 mark
The following C program is executed on a Unix/Linux system:
#include <unistd.h>
int main()
{
    int i;
    for (i=0; i<10; i++)
        if (i%2 == 0) fork();
    return 0;
}
The total number of child processes created is __________.
Show answer without attempting

Answer: 31

Q23

GATE CS 2019 CSConcurrency and SynchronizationNAT1 mark
Consider three concurrent processes P1, P2 and P3 as shown below, which access a shared variable D that has been initialized to 100.
P1P2P3
⋮\vdots⋮\vdots⋮\vdots
D=D+20\text{D} = \text{D} + 20D=D−50\text{D} = \text{D} - 50D=D+10\text{D} = \text{D} + 10
⋮\vdots⋮\vdots⋮\vdots
The processes are executed on a uniprocessor system running a time-shared operating system. If the minimum and maximum possible values of D after the three processes have completed execution are X and Y respectively, then the value of Y−XY - X is __________.
Show answer without attempting

Answer: 80

Q33

GATE CS 2019 CSMemory ManagementMCQ2 marks−2/3 if wrong
Assume that in a certain computer, the virtual addresses are 64 bits long and the physical addresses are 48 bits long. The memory is word addressable. The page size is 8 kB8\text{ kB} and the word size is 44 bytes. The Translation Look-aside Buffer (TLB) in the address translation path has 128128 valid entries. At most how many distinct virtual addresses can be translated without any TLB miss?
Show answer without attempting

Answer: B

0/200 correct0 marks

Related topics in GATE CS