Test 2 - Operating System | Computer Science (CS)

Description: GATE Previous year Topic Wise Solution | Operating System
Number of Questions: 19
Created by:
Tags: Operating System GATE CS
Attempted 0/19 Correct 0 Score 0

Which of the following statements is false?

  1. Virtual memory implements the translation of a program's address space into physical memory address space.

  2. Virtual memory allows each program to exceed the size of the primary memory.

  3. Virtual memory increases the degree of multi-programming

  4. Virtual memory reduces the context switching overhead.


Correct Option: A
Explanation:

Virtual memory enables a program to exceed the size of primary memory so it increases degree of multi-programming. Since data required by executing program is available here so context switching is reduced. But virtual memory doesn't translate program's address space into physical memory.

Consider a virtual memory system with FIFO page replacement policy. For an arbitrary page access pattern, increasing the number of page frames in main memory will

  1. always decrease the number of page faults

  2. always increase the number of page faults

  3. sometimes increase the number of page faults

  4. never affect the number of page faults


Correct Option: C
Explanation:

During F1F0 page replacement policy, due to increase in the no. of page frames in memory should decrease the no. of page faults since more frames can be kept there. But due to Belady's Anomaly after certain limit or in some page access instances no. of page faults are high.

Where does the swap space reside?

  1. RAM

  2. Disk

  3. ROM

  4. On-chip cache


Correct Option: B
Explanation:

Swap space is the memory space where the part of the program not currently in main memory for execution is stored, this program part can be swapped into memory when required. This space is generally in disk.

Consider a machine with 64 MB physical memory and a 32-bit virtual address space. If the page size is 4 KB, what is the approximate size of the page table?

  1. 16 MB

  2. 8 MB

  3. 2 MB

  4. 24 MB


Correct Option: B
Explanation:

Which of the following scheduling algorithms is non-preemptive?

  1. Round Robin

  2. First-In First-Out

  3. Multilevel Queue Scheduling

  4. Multilevel Queue Scheduling with Feedback


Correct Option: B
Explanation:

Round robin is preemptive since processes are cycled for CPU time, & run for a particular time stamp in one cycle. Multilevel queue scheduling maintains various quenes, each having different priorities. But in FIFO scheme, only the process which enters once, would be completed first, so no. preemption.

Consider a set of n tasks with known runtimes, r1, r2, ........r3 to be run on a uniprocessor machine. Which of the following processor scheduling algorithms will result in the maximum throughput?

  1. Round-robin

  2. Shortest-Job-First

  3. Highest-Response-Ratio-Next

  4. First-come-First-Served


Correct Option: B
Explanation:

Here the running time r1, ........rn  are already known, single processor system. In this scenario, throughput i.e. CPU is maximum utilized in shortest job first scheduling.

The optimal page replacement algorithm will select the page that

  1. has not been used for the longest time in the past

  2. will not be used for the longest time in the future

  3. has been used least number of times

  4. has been used most number of times


Correct Option: B
Explanation:

Optimal page replacement algorithm assumes that the pages that will come in future are already known, so replacement of the page which will not be used in future occurs.

Consider Peterson's algorithm for mutual exclusion between two concurrent processes i and j . The program executed by process is shown below.

For the program to guarantee mutual exclusion, the predicate P in the while loop should be

  1. flag [j]= true and turn =j

  2. flag [j]=true and turn =j

  3. flag [i]=true and turn=j

  4. flag [i]=true and turn=i


Correct Option: B
Explanation:

While loop if true predicate then the program enters into critical region. This program enters into critical region of flag [i]=true act as semaphore, & true =j, the requirement of resource is by some other process.

In the index allocation scheme of blocks to a file, the maximum possible size of the file depends on

  1. the size of the blocks, and the size of the address of the blocks

  2. the number of blocks used for the index, and the size of the blocks

  3. the size of the blocks, the number of blocks used for the index, and the size of the address of the blocks

  4. none of the above


Correct Option: B
Explanation:

When indexes are created, the maximum no. of blocks given to a file are totally dependent upon size of the index which tells how many blocks can be there and size of each block.

The minimum number of page frames that must be allocated to a running process in a virtual memory environment is determined by

  1. the instruction set architecture

  2. page size

  3. physical memory size

  4. number of processes in memory


Correct Option: A
Explanation:

Page frames are allocated in main memory, for virtual memory pages. This no. of page frames depends upon the instruction set architecture.

Which combination of the following features will suffice to characterize an OS as a multi-programmed OS ? More than one program may be loaded into main memory at the same time for execution. (B) If a program waits for certain events such as I/O, another program is immediately scheduled for execution. (C) If the execution of a program terminates, another program is immediately scheduled for execution.

  1. A

  2. A and B

  3. A and C

  4. A, B and C


Correct Option: B
Explanation:

Multi-programmed:- More than one program can run on single CPU, when one is blocked. (1) Is true and a characteristic of multi-programmed (2) Is true & also characterise a multi-programmed OS (3) Is true but no necessary for this type this happens in all OS, even in batch processor.

Consider an operating system capable of loading and executing a single sequential user process at a time. The disk head scheduling algorithm used is First Come First Served (FCFS). If FCFS is replaced by shortest seek Time Fist (SSTF), claimed by the vendor to given 50% better benchmark results, what is the expected improvement in the I/O performance of user programs?

  1. 50%

  2. 40%

  3. 25%

  4. 0%


Correct Option: D
Explanation:

I/O performance is not entirely dependent upon disk access, it has effect of various other devices, so using SSTF in place of FCFS may reduce disk access time but no improvement in the I/O is done.

A Unix-style I-node has 10 direct pointers and one single, one double and one triple indirect pointers. Disk block size is 1 Kbyte, disk block address is 32 bits and 48-bit integers are used. What is the maximum possible file size?

  1. 224 bytes

  2. 232 bytes

  3. 234 bytes

  4. 248 bytes


Correct Option: C
Explanation:

Consider a system with a two-level paging scheme in which a regular memory access takes 150 nanoseconds, and servicing a page fault takes 8 milliseconds. An average instruction takes 100 nanoseconds of CPU time, and two memory accesses. The TLB hit ratio is 99%, and the page fault rate is one in every 10,000 instructions. What is the effective average instruction execution time?

  1. 645 nanoseconds

  2. 1050 nanoseconds

  3. 1215 nanoseconds

  4. 1230 nanoseconds


Correct Option: D
Explanation:

Consider the following statements with respect to user-level threads and kernel-supported threads (i) Context which is faster with kernel-supported threads (ii) For user-level threads. a system call can block the entire process (iii) Kernel-supported threads can be scheduled independently (iv) User-level threads are transparent to the kernel

Which of the above statements are true?

  1. (ii),(iii) and (iv) only

  2. (ii) and (iii) only

  3. (i) and (iii) only

  4. (i) and (ii) only


Correct Option: B
Explanation:

(I) It is false, context switch is not faster in support of kernel threads. (II) A system call can truly block the user level threads, since they don't have permission to do that. (III) True since kernel supported threads have their independent memory & resources. (IV) False since user level threads might need support of kernel threads.

Consider the following set of processes, with the arrival time and the CPU-burst time given in milliseconds.

What is the average turnaround time for these processes using the algorithm shortest remaining processing time first (SRPT)?

  1. 5.50

  2. 5.75

  3. 6.00

  4. 6.25


Correct Option: A
Explanation:

Consider the following code fragment: if (fork()==0 {a = a + 5; print f (%d,%/na, and a);} else {a − 5; print f (%d,%d/n,a,&a);} Let u, v be the values printed by the parent process, and x,y be the values printed by the child process. Which one of the following is TRUE?

  1. u = x + 10 and v = y

  2. u = x + 10 and v $\ne$ y

  3. u + 10= x and v = y

  4. u + 10 = x and v $\ne$ y


Correct Option: D
Explanation:

Initial value of a is 10 and its address and the value of 'a' would be different for both the parent and child processes. So, (1) and (2) are incorrect. Also, parent process executes a = a − 5 = 5 = u and child executes a = a + 5 = 15 = x. Therefore, u + 10 = x.

Suppose $n$ processes, $P_1, \dots P_n$ share $m$ identical resource units, which can be reserved and released one at a time. The maximum resource requirement of process $P_i$ is $s_i$, where $s_i > 0$. Which one of the following is a sufficient condition for ensuring that deadlock does not occur?

  1. $\forall i,: s_i, < m$

  2. $\forall i, :s_i < n $

  3. $\Sigma_{i=1}^n : s_i < (m+n)$

  4. $\Sigma_{i=1}^n : s_i < (m \times n)$


Correct Option: C
Explanation:

Consider two processes P1 and P2 accessing the shared variables X and Y protected by two binary semaphores Sx and Sy respectively, both initialized to 1. P and V denote the usual semaphore operators, where P decrements the semaphore value and V increments the semaphore value. The pseudo-codes of P1 and P2 are as follows:

In order to avoid deadlock, the correct operators at L1,L2,L3 and L4 are respectively

  1. P(SY),P(SX);P(SX),P(SY)

  2. P(SX),P(SY);P(SY),P(SX)

  3. P(SX),P(SX);P(SY),P(SY)

  4. P(SX),P(SY);P(SX),P(SY)


Correct Option: D
Explanation:

Here semaphores are required to obtain mutual exclusion since both access X & Y. So at L1 P (Sx) which means now S wait x = at L2 P (Sy) Sy wait, this prevents process P2 to start access X &Y. V(Sx) & V(Sy) in the end of P1 makes Sx & Sy signal so that at L3 & L4 P(Sx) & P(Sy) can start.

- Hide questions