# Recent questions and answers in Operating System

1
In the context of operating systems, which of the following statements is/are correct with respect to paging? Paging helps solve the issue of external fragmentation Page size has no impact on internal fragmentation Paging incurs memory overheads Multi-level paging is necessary to support pages of different sizes
1 vote
2
Which of the following statement(s) is/are correct in the context of $\text{CPU}$ scheduling? Turnaround time includes waiting time The goal is to only maximize $\text{CPU}$ utilization and minimize throughput Round-robin policy can be used even when the $\text{CPU}$ time required by each of the processes is not known apriori Implementing preemptive scheduling needs hardware support
3
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 ... deadlocks will not occur The scheme may lead to live-lock The scheme may lead to starvation The scheme violates the mutual exclusion property
4
consider a system using 2 level paging applicable page table is divided into 2K pages each of size 4 KB. if pas is 64 MB which is divided into 16K frames memory is byte addressable . page tabke entry size is 2 bytes in both the levels calculate the length of logical and physical address. total number of entry at second level
5
Ans. 52 msec
6
A user level process in Unix traps the signal sent on a Ctrl-C input, and has a signal handling routine that saves appropriate files before terminating the process. When a Ctrl-C input is given to this process, what is the mode in which the signal handling routine executes? User mode Kernel mode Superuser mode Privileged mode
7
The state of a process during context switching is 1. May be busy 2. May be idle 3. Always idle 4. always busy
8
Suppose that the running time for each process in milliseconds is an exponential random variable with parameter λ=1/20. If process P1 arrives immediately ahead of the process P2 in the running state, then the probability that process P2 will have to wait more than 20 milliseconds is _____________ . A 0.274 B 0.324 C 0.428 D 0.368 How to approach this. even not able to understand the question.
9
The read system call to fetch data from a file always blocks the invoking process.[True / False] [blocking means context switching to another process]
1 vote
10
Consider three processes (process id $0,1,2$ respectively) with compute time bursts $2,4$ and $8$ time units. All processes arrive at time zero. Consider the Longest Remaining Time First (LRTF) scheduling algorithm. In LRTF ties are broken by giving priority to the process with the lowest process id. The average turn around time is $13$ units $14$ units $15$ units $16$ units
11
Consider the following pseudocode, where $\textsf{S}$ is a semaphore initialized to $5$ in line $\#2$ and $\textsf{counter}$ is a shared variable initialized to $0$ in line $\#1$. Assume that the increment operation in line $\#7$ is $\textit{not}$ ... $0$ after all the threads successfully complete the execution of $\textsf{parop}$ There is a deadlock involving all the threads
12
Consider the following two-process synchronization solution. ... two- process synchronization solution. This solution violates mutual exclusion requirement. This solution violates progress requirement. This solution violates bounded wait requirement.
13
The $P$ and $V$ operations on counting semaphores, where s is a counting semaphore, are defined as follows: $P(s):$ $s=s-1;$ If $s < 0$ then wait; $V(s):$ $s=s+1;$ If $s \leq0$ then wake up process waiting on s; Assume that $P_b$ and $V_b$ the wait and signal operations on ... $x_b$ and $y_b$ are respectively $0$ and $0$ $0$ and $1$ $1$ and $0$ $1$ and $1$
14
Let the time taken to switch from user mode to kernel mode of execution be $T1$ while time taken to switch between two user processes be $T2$. Which of the following is correct? $T1 > T2$ $T1 = T2$ $T1 < T2$ Nothing can be said about the relation between $T1$ and $T2$
1 vote
15
At a particular time of computation, the value of a counting semaphore is $7$. Then $20 \ P$ (wait) operations and $15 \ V$ (signal) operations are completed on this semaphore. What is the resulting value of the semaphore? $28$ $12$ $2$ $42$
1 vote
16
In a particular system it is observed that, the cache performance gets improved as a result of increasing the block size of the cache. The primary reason behind this is : Programs exhibits temporal locality Programs have small working set Read operation is frequently required rather than write operation Programs exhibits spatial locality
1 vote
17
Consider the following functions $f()$ and $g().$ f(){ w = 3; w = 4; } g(){ z = w; z = z + 2*w; print(z); } We start with $w$ set to $0$ and execute $f()$ and $g()$ in parallel-that is, at each step we either execute one statement from $f()$ or one statement from $g()$. What is the set of possible values printed by $g()?$ $0,9,12$ $0,8,9,12$ $0,6,8,9,11,12$ $0,4,6,9,10,12$
18
State any undesirable characteristic of the following criteria for measuring performance of an operating system: Turn around time
19
State any undesirable characteristic of the following criteria for measuring performance of an operating system: Waiting time
1 vote
20
Consider the following multi-threaded code segment (in a mix of C and pseudo-code), invoked by two processes $P_1$ and $P_2$, and each of the processes spawns two threads $T_1$ and $T_2$: int x = 0; // global Lock L1; // global main () { create a thread to execute foo() ... will print the value of $y$ as $2.$ Both $T_1$ and $T_2$, in both the processes, will print the value of $y$ as $1.$
21
Q1: SAFE OR NOT?? i have doubt with the answer given becz i am getting safe for question 1 and unsafe for question 2 but opposite answer is given in test series/.
22
Explain the difference between internal fragmentation and external fragmentation. Which one occurs in paging systems? Which one occurs in systems using pure segmentation?
23
Explain how hard links and soft links differ with respective to i-node allocations.
24
Consider the following page reference string. $1\ 2\ 3\ 4\ 2\ 1\ 5\ 6\ 2\ 1\ 2\ 3\ 7\ 6\ 3\ 2\ 1\ 2\ 3\ 6\$ What are the minimum number of frames required to get a single page fault for the above sequence assuming LRU replacement strategy? $7$ $4$ $6$ $5$
1 vote
25
Suppose that a machine has $438-bit$ virtual addresses and $32-bit$ physical addresses. What is the main advantage of a multilevel page table over a single-level one? With a two-level page table, $16-KB$ pages, and $4-byte$ entries, how many bits should be allocated for the top-level page table field and how many for the next level page table field? Explain.
26
Consider a system having $10$ IO bound jobs and $1$ CPU bound job.. If IO bound job issue an IO request once for every ms of CPU computation and that each IO request takes $10$ ms. If context switch overhead is $0.1$ ms.Using round -robin scheduling with a time quantum of $10$ ms. , the CPU efficiency is __________________
27
Consider the following four processes with their corresponding arrival time and burst time: $\begin{array} \text{Process}&\text{Arrival time}&\text{Burst time(in ms)}\\ \text{P1}&0.0&8\\ \text{P2}&0.6&6\\ \text{P3}&3.8&4\\ \text{P4}&4.4&2\end{array}$ What is the average turn around time (in ms) for these processes using FCFS scheduling algorithm? $15$ $12.8$ $13$ none of the options
1 vote
28
Starvation can be avoided by which of the following statements: By using shortest job first resource allocation policy . By using first come first serve resources allocation policy. (i) only (i) and (ii) only (ii) only None of the options
29
Process is in a ready state _______ . when process is scheduled to run after some execution when process is unable to run until some task has been completed when process is using the $CPU$ none of the options
30
Three CPU-bound tasks, with execution times of $15,12$ and $5$ time units respectively arrive at times $0,t$ and $8$, respectively. If the operating system implements a shortest remaining time first scheduling algorithm, what should be the value of $t$ to have $4$ context switches? Ignore the context switches at time $0$ and at the end. $0<t<3$ $t=0$ $t<=3$ $3<t<8$
1 vote
31
Jobs keep arriving at a processor. A job can have an associated time length as well as a priority tag. New jobs may arrive while some earlier jobs are running. Some jobs may keep running indefinitely. A ... the following job-scheduling policies is starvation free? Round - robin Shortest job first Priority queuing Latest job first None of the others
32
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$P_1, P_2, P_3, P_4$ ... absolute value of the difference between the average turnaround times (in ms) of SJF and RR (round off to $2$ decimal places is_______
33
Consider the following statements about process state transitions for a system using preemptive scheduling. A running process can move to ready state. A ready process can move to running state. A blocked process can move to running state. A blocked process can move to ready state. Which of the above statements are TRUE? I, II, and III only II and III only I, II, and IV only I, II, III and IV only
34
Names of some of the Operating Systems are given below: MS-DOS XENIX OS/$2$ In the above list, following operating systems didn’t provide multiuser facility. (a) only (a) and (b)only (b) and (c) only (a),(b) and (c)
35
Which statements is not correct about “init” process in Unix? It is generally the parent of the login shell. It has PID $1$. It is the first process in the system. Init forks and execs a ‘getty’ process at every port connected to a terminal.
1 vote
36
Consider three CPU-intensive processes, which require $10,20$ and $30$ time units and arrive at times $0,2$ and $6$, respectively. How many context switches are needed if the operating system implements a shortest remaining time first scheduling algorithm? Do not count the context switches at time zero and at the end. $1$ $2$ $3$ $4$
1 vote
37
Consider three processes, all arriving at time zero, with total execution time of $10,20$ and $30$ units, respectively. Each process spends the first $20\%$ of execution time doing I/O, the next $70\%$ of time doing computation, and the last $10\%$ of time doing I/O again. The ... as much as possible. For what percentage of time does the CPU remain idle? $0\%$ $10.6\%$ $30.0\%$ $89.4\%$
Determine the number of page faults when references to pages occur in the following order: $1,2,4,5,2,1,2,4$. Assume that the main memory can accommodate $3$ pages and the main memory already has the pages $1$ and $2$, with page $1$ having been brought earlier than page $2$.(LRU algorithm is used). $3$ $5$ $4$ None of these.
If a processor has $32$-bit virtual address, $28$-bit physical address, $2$ kb pages. How many bits are required for the virtual, physical page number? $17,21$ $21,17$ $6,10$ None