Professional Documents
Culture Documents
OS PYQs
OS PYQs
MANIPAL
(A constituent unit of MAHE, Manipal)
M CO PO BL
first scheduling
Assuming that the operating system uses a preemptive shortest job
algorithm for CPUscheduling, answer the following questions:
a) Construct the Gantt chart for this scenario.
time.
b) Compute the average waiting time and average turnaround
c) Compute the percentage of time the CPUremains idle?
d) Compute the total number of context switches for this scenario.
Q2
Include
operating system and illustrate these states with a comprehensive diagram.
descriptions of transitions between states and the events that trigger these
transitions
real- 2
latency times must be bounded in a hard 2,
Q3 Explain why interrupt and dispatch
time system.
functions: 5 3
maintains an account balance with two
1
Q4 Consider abanking system that the 2
(amount). These two functions are passed
deposit (amount) and withdraw balance. 3
withdrawn from the bank account
amount that is to be deposited or the husband
share a bank account. Concurrently,
Assume that a husband and wife race
wife calls deposit(). Analyse how a
calls the withdraw() function and the
done to prevent the race condition from
condition is possible and what might be
oCcurring.
3 2
among the three multithreading models: 2, :
Outline the differences and similarities
Highlight how each model handles
Many-to-One, One-to-One, and Many-to-Many.
kernel-level threads and the implications of
the mapping of user-level threads to
utilization.
these approaches on performance and resource
2 3 1,
Q6 Consider the Resource Allocation Graph (RAG) given in Figure Q6. 2
3.
a) Interpret the status of the Processes P1 and P2 in the graph. 8
potential
b) Analyse the RAG and list out the scenarios which could lead to a
deadlock.
R
R
Figure Q6
1
3
Q7 Consider an operating system running five processes: Chrome, Photoshop, Spotity, 3 2
Word, and System Update. The system has three types of resources: File Handles, 3
Network Bandwidth, and Disk i/0 Bandwidth. The total available units for these 8
resources are 10 units of File Handles, 5 units of Network Bandwidth, and7 units of
Disk i/0 Bandwidth, respectively. The maximum resources
required by each process
and the currently allocated resources are as follows:
4 1, 3
Q14 Explain Belady's anomaly in the context of page replacement algorithms. llustrate 3
your answer by considering the following sequence of memory access requests: 2,
3,
0, 1, 5, 3, 0, 1, 4, 0, 1, 5,3, 4, in that order,where each number indicates a request 8
for a page number. Consider two scenarios where physical memory is divided into
3-frames and 4-frames, respectively.
Q15 Consider a logical address space of 64 pages of 1,024 words each, mapped onto a 2 4 1, 3
physical memory of 32 frames. 2,
a) How many bits are there inthe logical address? 3,
b) Howmany bits are there in the physical address?
Q5 Q4 Q3 02 Q1
turn;
int
boolean The contextConsider bound Why For
Withcalculate reside, PID: scheduling.
priority c)
shortest b) 2
than
scheduling. Answer
a)
CPU programs? uses
Consider Consider Consider Duration:hrs 3
two time, is a above Process queue
of itsuitable Priority: first the
processes,
flag[2]: a important average scheduling.
firstjob
thiswhile
scenario questions come Q_no
ID, all 2. following
all the MANIPAL (A
setup. diagram, the Queue MANIPAL
/* Process Lower AT: the constituent
waiting first denotes Table B.
initially PO with for five five Tech
(a), Arrival based
and the number Q_no BT ATPID serve uses 1
P2two explain Priority|3 processes processes Q1 vth tunit
false P1, requires scheduler time. (b), time,
m o on
processes and schedulinground thewhich Semester of
share have queue the MAHE,
*/ Process 1 6 P1 DSE
(c) BT: robin
only are are given INSTITUTE
3153
the to
illustrate the Burst shows
of Manipal)
indistinguish in algorithm.
in 04-01-2024
Date: Makeup
following Control highest 4 1 TableQ1:
3 P2 with the
scenarios:
10 a
time, same same OPERATING
system:
units. process,
time five
with
Block priorityQ_no: 5 1 5 queue queue Examinations
P3
variables: Explain
Process i/0-bound help quantum process
and 5
priority SYSTEMS
of Queue 2 2 P4 and and
the its a under OF
P1 it it of
Convoy components. Gantt no twO of
requires programs 1 1 2 2 P5 folloWS follows December
in queue
multilevel TECHNOLOGY
chart which units
effect 50 from preemptive preemptive and 1
and is 2023
units process
in CPU- queue
greaterqueue Marks:
Max. 50
the of
3 S 3
2 M
3 2 2 1 2 CO
3, 2, 1, 8 3, 8 2, 3
2 1 2, 2 1, PO
3 3 2 3 BL
codesnippet,where
below
isdefinedbythe
or 1)
processP (i==0
structure of or0).
Ine processis Pi(j== 1
the other
do { = true:
flag[iJ
(flag[j) {
while (turn {
== j)false;
if =
[i]
flag == j)
while (turnnothing +/
/* do
true;
flag (i] =
section */
critical
/*
turn = ];
false;
flag [i] =
*/
remainder seCtion
/*
} while (true);
2
4
Q9 Fxolain the concept of thrashing in the context of operating system memory 2
management. Describe the conditions that lead to thrashing, its impact on system
performance, and the mechanisms that can be employed to mitigate or prevent it.
snapshot of asystem in Table Q10: 5 3 1, 3
Coonsiderthe following 2
Q10 3
Table Q10:
Max Available
Allocation
ABC D AB C D
A B C D
6 1 5 2
2 3 2
PO 1 2
2 1 4
0 1 1 2
P1
3 6 5 1
P2 2
1 2 6 2
P3 1
3 1 1 3
1 2
P4
4 1, 3
KB, 750 KB, and 125 KB
5
300 KB, 600 KB, 350 KB, 200 2
Q13 Given six memory partitions of worst-fit algorithms place processes
best-fit, and 3.
(in order), how would the first-fit, Rank the algorithms
200 KB, and 375 KB (in order)?
8
ofsize 115 KB, 500 KB, 358 KB,
memory.
in terms of how efficiently they use
3 4 2, 2
With the help of a neat block diagram,
explain the different steps involved in
Q14
Demand Paging.
handling a Page Fault in an operating system that uses
2 4 2 2
Q15 Briefly explain the drawbacks of the contiguous memory allocation technique.
MANIPAL INSTITUTEOF TECHNOLOGY
MANIPAL
(A constituent unit of MAHE, Manipal)
Section A: MCQ
2 3
then each process 0.5 2
Q1 If there are N processes in the ready queue and the time quantum is Q,
In this case, no
gets 1/N of the CPU time in chunks of at most Q time units at once.
procesS waits more than time units.
1. Q-N
2. (N-1)*Q
3. N*(Q-N)
4. N*Q
2
for a system using 0.5 2
Q2 Consider the following statements about process state transitions
preemptive scheduling.
S1: A running process can move to a ready state.
S2: A ready prOcess can move to a ready state.
S3: Ablocked process can move to a running state
S4: A
blocked process can move to a ready state
Which of the above statements is TRUE?
(ii) Set the program counter to the first instruction of the interrupt handling routine.
(üi) Save the current context.
1. (i) only
Blocked
1.
Open End)
(New) Ready
Block Unblock
Block
Running
2.
Ready
Abort
3
Blocked
Abort
Retry
4
(Running)
thread 0.5 2 2
the entire process gets blocked if a
In which of the following Multithreading model,
06 cal.
makes a blocking system
1. One-to-one
2. Many-to-one
3. Many-to-Many
4. Two-level
0.5 1 2 2
between processes?
on a context switch
Which of the following need not be saved
purpose registers
1. General
2. Program counter
look aside buffer
3. Translation
information
4. Process state 2 2
0.5 1
process?
following is/are reason(s) for blocking a running of OS code.
Which of the procedure that is a part
A from
call the running program to a
(i) operation.
may initiate an I/0
(ii) Arunning process running process.
(ii) Auser may block a
1. Stack
Segments
2. Shared memory
3. Heap
4. CPU registers
system with 0.5 2 1,2 3
computer
can be in Ready state for a
Q10 The maximum number of prOcesses that
n CPUs is:
1 n
2. n'
3. 2^
4. Independent of n
Section B: DESCRIPTIVE
Q11 a.Consider the below table of four process under multilevel queue scheduling. Q_no 4 2
1,2
denotes the queue of the process, priority of queue lis greater than queue 2. Queue 1 uses
round robin with time quantum of two units and queue 2 uses first come first serve
scheduling algorithm.
b. Consider allthe five processes are in same queue and it follows preemptive shortest job
first scheduling.
C. Consider all the five processes are in same queue and it follows preemptive priority
scheduling.
For above questions a, b, and c, draw Gantt chart and calculate average
turnaround time.
PID P1 P2 P3 P4 P5
AT 1 1.5 0 2
BT 6 4 2 5
Q no 1 2 2
Priority 3 4 2 1
second?
each process is microseconds, what must be the time
guaranteed to get its turn at the CPU after 1
n15 Describe the typical return values of the fork() system call and what each value sieniftes, 3 1 1,2 3
How many times does the following Cprogram print "Hello"? Explain.
main ()
for (int i=0; i<8; i++)
{
3 if (1%2 == 0) break;
fork ();
printf ("Hello\n");
2 2
Short-term, Medium-term 3
1
V SEMESTER MCA
MARE wO SEMESTER EXAMINATIONS
DECEMBER 2022
SUBJECT: OPERATING SYSTEM (DSE3153)
REVISED CREDIT SYSTEM
( /12 /2022)
Time: 3 Hours MAX. MARKS: 50
Instructions to Candidates:
Answer ALL FIVE questions.
3 Missing data may be suitably assumed.
3B. Explain Belady's anomaly with the given reference string using 3 and 4 frames. 3
4A. Describe how the Test and Set() instruction can be used to provide mutual exclusion. Also discuss 5
the limitation of this solution.
4B. Discuss the three queue implementation methods used in message passing. 3
4C. What are two differences between user-level threads and kernel-level threads? Under what 2
circumstances is one type better than the other?
5A. What is TLB? Explain its role in memory management with suitable diagram.
SB. Give the queuing diagram representing process scheduling and show the action point for the 3
different types of CPU schedulers.
5C. What is the difference between logical and physical addresses? 2
MCA 4153
Page 2 of 2
Reg. No.
V SEMESTERB.Tech.
END SEMESTER EXAMINATIONS
NOVEMBER 2022
SUBJECT: OPERATING SYSTEM (DSE3153)
REVISEDCREDIT SYSTEM
(11/2022)
Time: 3 Hours MAX. MARKS: 50
Instructions to Candidates:
Answer ALL FIVE questions.
3 Missing data may be suitably assumed.
1B. Discuss the advantage of having different time quantum sizes on different
levels of a multi-level 3
queueing system?
1C. Differentiate between multiprogramming and multitasking operating systems. 2
2B. Given six memory partitions of 300 KB, 600 KB, 350 KB, 200 KB, 750 KB, and 125 KB
order), how would the first-fit, best-fit, and worst-fit algorithms place processes of size 115 kD,
500 KB, 358 KB, 200 KB, and 375 KB (in order)? Rank the algorithms in terms of now
efficiently they use memory.
mapped onto a physteal 2
ZC. Consider a logical address space of 64 pages of 1.024 words each.
memory of 32 frames.
a. How many bits are there in the logical address?
b. How many bits are there the physical address?
PO 00 1 2 001 2 15 2 0
P 10 0 0 175 0
P2 1 3 5 4 2 3 56
P3 06 3 2 0 65 2
P4 00 1 4 065 6
Answer the following questions using the Banker's algorithm( Resource request algorithm,
Safety Algorithm)
a) Calculate the resource Need for each process.
b) Is the system in a safe state?
c) If a request from a process Pl arrives for (0, 4, 2, 0), can the request be granted
immediately?
d) What is the total number of instances for each resource in the above given
system?
3B. Discuss critical section problem with its structure. Also describe the criteria to be satisfied by
any efficient solution for the same problem.
3
3C. What the copy-on-write feature, and under what
circumstances is its use beneficial?
4A. Describe how the compare and swap() instruction can be used to
Also discuss the limitation of this
solution.
provide mutual exclusion.
4B. What are the benefits and the
a. disadvantages of each of the
Synchronous and asynchronous communication following? 3
Fixed-sized and variable-sized messages
4C. What is the cause of
thrashing? How does the system detect thrashing? If
logical address is 20-bit, What is the number of entries in the page size is 2 KB and Z
page table?
5A. Suppose that a disk drive has
5,000 cylinders, numbered 0 to
serving a request at cylinder 2,150,
pending and the previous request was at 4.999, The drive is currently
3681. requests, in FIFO order, is: 2,069, cylinder 1,805. The queue of
1,212, 2,296, 2,800, 544, 1,618, 356,
Starting from the current head 1,523, 4,965, 5
moves to satisfy all the pendingposition, what is the
requests for each oftotal
the
distance (in cylinders) that the disk arm
following disk-scheduling algorithms?
DSE3153
Page 2 of 3
à. FCFS
b. SSTF
c. SCAN
d. LOOK
3
5B. Explain the purpose of the open) and close) file operations.
ms. If the average page fault 2
5C. Let an instruction take 10 ms and page fault takes an additional 5
time.
Occurs after 20 instructions, Calculate the effective access
Setms CoE3I53j
Q1. Suppose that the OS uses variable length partitions for memory management. At some
particular time, the running process occupies a partition between physical addresses 20,000
and 40,000. The values of base and limit register are respectively (0.5)
1. **20,000, 20,000
2. 0, 40,000
3. 20, 000, 40,000
4. 0, 10,000
memory management. At some
Q2. Suppose that the OS uses variable length partitions for addresses 20,000
particular time, the running process occupies a partition between physical (0.5)
and 40,000. What physical address corresponds to a virtual address of 13,000?
1. **33,000
2. 13,000
3. 43,000
4. 23,000
Q3. The value ofa counting semaphore is 7. Then 15 wait operations and
10signal
operations were completed on this semaphore. The resulting value of semaphore is (0.5)
1. 5
2. **2
3. 7
4. 0
7 after (0.5)
Q4. At a particular time, the value of a counting semaphore is 10. It will become
1. 3 signal operations
2. 2 wait operations
3 ** 3wait operations
4. 5 signal operations and 2 wait operations
Q5. A process executes the following segment of code
for (i =1;i<10; i ++) fork( );
The number of new processes created is (0.5)
1 1024
2. 1023
3. ** 511
4. 512
Q6. For each thread in a multithreaded process, there is a separate (0.5)
1. ** User and kernel stack
2. Process control block
2) A Process Control Block (PCB) does not contain which of the following?
(0.5)
1) Timer 2) Code 3)Stack 4) Data
3) Ina timesharing operating system, when the time slot assigned to a process is
completed, the process switches from the current state to?
(0.5)
Suspended Ready Terminated Blocked
1 state 2) state 3) 4)
state state
name communicate
the communicate communicate
with each
recipient with one other without by (0.5)
1) or 2) another by 3
sharing the
4)establishing
sender the shared
resorting to same address
of the shared data region
space
message
To access the services of the operating systerm, the interface is provided by the
5)
(0.5)
System System Assembly
1 2) IPC 3) 4)
calls Instructions
Library
6) Which of the following two operations are provided by the IPC facility?
receive & write & delete & send & (0.5)
I) send 2) delete 3) receive 4) delete
message message message message
the sending
the sending the sending the sending
process process process
process sends the
keeps sends the keeps 4) message
1) sending 2) message and 3) sending
untilit and reciving
until the resumes process is
receives a
message is
operation blocked
received message
DESCRIPTIVE
Section Duration: 40 mins
Answer all the questions.
Question 1.
11) (2)
Operating system.
Discuss the methods used to pass parameters to the
Question 2.
12)
to an API (2)
Why would an application programmer prefer programming according
rather than invoking actual system calls?
13) Question 3.
With suitable diagram describe the following operating system structure:
(3)
a. Simple structure
b. Layered structure
c. Microkernel
30-08-202241C
about:srcdc
Question 4.
a. Consider the below table of five process under multilevel queue scheduling.
Qnodenotes the queue of the process, priority of queue lis greater than
queue 2. Queue Iuses round robin with timequantum of two units and queue
2 uses first come first serve scheduling algorithm.
b. Consider allthe five processes are in same queue and it follows preemptive
shortest job first scheduling.
priority
c. Consider all the five processes are in same queue and it follows
scheduling.
calculate average waiting time.
For above questions a, b, and c, draw Gantt chart and
AT 03 S 0 2
BT 64 2 5 8
Q no 1 12 1 2
Priority|34 52
no: Queue no in which process
PID: Process ID, AT: Arrival time, BT: Burst time, Q
reside, Priority: Lower number have the highest priority
--..-End---.