previous year-operating system-thapar university
previous year-operating system-thapar university
F 649
Thapar Institute of Engineering & Technology
Department of Computer Science and Engineering
END SEMESTER EXAMINATION
Out of 07 questions student needs to attempt 05 full questions only, attempting sub-part(s) of a question a
single place and in serial order. Combining the sub-part(s) of different questions will not be considered 'as bnr
full question. Assume any missing data.
Q. I a) On a Windows operating system, consider a process of VLC media player with 4 logical pages, which are (:
numbered from 0 to 3. The page table of the process consists of the following logical page number to physical
frame number mappings as: (0, 11), (I, 35), (2, 3), (3, 1). The process runs on a system with 16 bit virtual
addresses and a page size of 256 bytes. Taking the system as I-byte addressable, you have been given that
this process accesses virtual address 772. Compute the page number and offset corresponding to this virtual
address (consider all numbers given here in decimal).
b) In a system, a process will be having 6 physical pages, which are numbered 0 to 5. The access order of the (:
pages of the process is as follows: 1, 5, 0, I, 0, 2, 3, 3, 0, 2, I, 3, 0, 2, 4, 5, 3. 2. Considering the holding
capacity of the RAM as 3 out of these 6 pages at a time, and taking RAM initially as empty, with no other
process executing on the system; With a suitable illustration, comment on the count of page faults generated
using LRU.
Q.2 a) With a suitable illustration, explain three multi-threading models that we use in operating systems. Also,
comment on the line "in each program we must be having at-least one thread at user level"
b) As tabulated below, in a system, there are four processes in the RAM i.e., PI, P2, P3, and P4, which arrive at
time t=0 sec. Due to some memory error, the largest process gets swapped to the disk at time t=10 sec.
Consider the disk transfer rate of 01 Megabyte/Second, allied latency time of 5 milliseconds, and process
context switch time (both ways) as 500 milliseconds; Draw the GANTT chart for the scenario taking RR
quantum as 2. •
Process Size (kilo bytes) CPU Burst Time
PI 100 3 sec
P2 50 2 sec
P3 30 2 sec
P4 80 5 sec
Note: i) When a process is terminated/exit consider half context switch time, ii) It will be assumed that the error
gets resolved, when the erratic/halted process gets reloaded in the memory. This reloaded process continues from
where it left off. No other processes can run during this time. Also, assume that context saving/loading of the
error process is not required again.
Q.3 a) Consider a 64-bit system running an OS that uses hierarchical page tables to manage the virtual memory.
Assume that the logical and physical pages are of size 4 KB and each page table entry is of 4 bytes in size.
Using a suitable diagram for hierarchy, comment on the maximum number of levels that can be crafted for
the said scenario.
b) Consider a software named Xoro of size 10MB, which comprises 3 segments, namely, DataBase (DB), (
SourceFile (SF), and LibraryFile (LF); that further take 40, 20 and 40 percent of total software size
respectively. While software execution, the SF is required all the time, with either DB or LF. The OS here,
uses dynamic loading concept, with a TLB hardware of 8K entries. Each frame number entry of the TLB is
3-bytes in length. The page size is 2KB (with 1 byte addressable). Access of each entry from TLB takes 0.5
milliseconds. Consider time to access main memory as 20% more as compared to TLB access time.
Considering the 25% occupancy of the total TLB entries by the software Xoro at any time. Compute the
following:
Page 1 of 2
i) Size of Physical Address Space
ii) Size of Logical Address Space for Xoro
iii)What minimal percent of' the main memory does Xoro needs to occupy for ensuring its execution? Make an
assumption that each segment can either be loaded completely or not at all
iv) Time to access SF+DB from main memory (all the entries needed by Xoro are always present in the page table
and page table is available in.the RAM)
Q.4 a) Following code snippet is the first known software solution to the critical-section problem for two processes.
(5)
The two processes, Pi and Pj, share the following variables:
The structure of process Pi (i == 0 or I) is shown above; the other process is Pj (j == 1 or 0). Prove that
the algorithm satisfies all three requirements for the critical-section problem
b) With a suitable example, explain Semaphores and its types that one can deploy in an Operating System
to avoid the concern of Critical section. ( 5)
a) Consider fork () as system call of 1.INUX/UNIX operating system. Draw the Tree type structure
(5)
illustrating the execution of the multiple fork calls given in the code snippet below; and comment on the
number of times "Good Morning" and "Good Evening" will get printed.
llinclude <assume all required header files here>
void main (,)
{ if (fork() fork() && fork() fork()) { printi(" 1t Good Morning \n");} printf (nt Good Evening \n"); }
b) Assume a system has 4 files Fl, F2, F3, F4 and 4 domain DI, D2, D3, D4; Where, Fl is owned by D2; (5)
F2, F3 is owned by DI and F4 is owned by D4. Owners have read, write and execute permission but can
only copy read and write permissions. DI can modify any right of D3. D2 has all accesses that D4 has.
Draw the access matrix and answer the following questions.
i) Can D2 write on F4 by any way?
ii) Can Dl read Fl by any way through D4?
Q.6 a) List the four levels at which the measures are needed to be applied to protect a system. Give one difference
r)
between Masquerading and Session Hijacking.
Q.7 Consider a system with a single CPU core and three processes A, B, C. Process A arrives at t = 0, and runs on the (10 .
CPU for 10 time units before it finishes. Process B arrives at t = 6, and requires an initial CPU time of 3 units,
after which it blocks to perform I/O for 3 time units. After returning from 1/0 wait, it executes for a further 5 units
before terminating. Process C arrives at t = 8, and runs for 2 units of time on the CPU before terminating. Compute
the average waiting time taking first Come First Serve CPU scheduling algorithm, and average turnaround time
considering non-preemptive Shortest Job First scheduling algorithm.
Page 2 of 2
)II Number:
a) Explain Zombie process and orphan process and find out output for the following code: [5]
int main ()
fork 0;
printf ("Hello world! \n");
fork 0;
printf ("Hello world! \n");
return 0;
1
b) Two concurrent process PI and P2 want to use two resources printer and scanner in mutually exclusive
manner, initially printer and scanner are free. The program executed by two processes are given below.
[5]
P1 P2
II: while (printer-
-busy) { } ; 11: while (printer—busy) {};
12: printer=busy; 12: printer=busy;
13: while (scanner—busy) II; 13: while (scanner—busy) {} ;
14: scanner=busy; 14:scanner-busy;
15:use both resources 15: use both resources
16: printer = free 16: scanner = free
17: scanner = free 17: printer = free
i. Is mutual exclusion guaranteed for printer and scanner? If not show a possible interleaving of the
statements of P1 and P2 such mutual exclusion is violated.
ii. Can deadlock occur in the above program? If yes, show a possible interleaving of the statements of
PI and P2 leading to deadlock.
iii. If we exchange the statements 11 and 13 and statements 12 and 14 in P2. Is mutual exclusion
Q2. a) Explain multiprogramming and multitasking with their major objectives. Consider three jobs JOBI, JOB2 and
JOB3. JOB] runs in a loop for 10 iterations that requires 5 seconds of CPU time, followed by 1 1 seconds of I/O
to disk, followed by 7seconds of CPU time. JOB2 runs in a loop for 10 iterations that requires 7 seconds of CPU
time followed by 12 seconds of disk I/O followed by 2 CPU time, JOB3 runs in a loop for 15 iterations that
requires 2 seconds of CPU time followed by 9 seconds of disk I/O followed by 5 CPU time. Find out CPU
Allocation
Process A 2 0 1 1
Process B 0 1 0 0
Process C I 0 1 1
Process D 1 1 0 1
Maximum
Process A 3 1 1 1
Process B 0 2 1 2
Process C 4 1 I 1
Process D I 1
i. If a request from B arrives for (0,0,1,0) can the request be granted immediately.
ii. If a request from C arrives for (2,0,0,0) can the request be granted immediately
Draw the resource allocation graph and convert it into wait for graph and justify system will be in deadlock
state or not.
Q3. a) Explain thrashing with causes and solutions. [4]
b) The address sequence generated by tracing a particular program executing in a pure demand paging system
with 100 bytes per page is 0100, 0200, 0430, 0499, 0510, 0530, 0560, 0120, 0220, 0240, 0260, 0320, 0410.
Suppose that the memory can store only one page and if x is the address which causes a page fault then the
bytes from addresses x to x + 99 are loaded on to the memory.
[6]
i. How many page faults will occur?
ii. What is the working set if at the penultimate page reference 6 is 5.
Q4: Consider a hard disk with 8 platters (0, I, 2....7) having 16384 cylinders (0-16383) and each cylinder contains
64 sectors (0-63). Data storage capacity in each sector is 512 bytes. The following 6 disk requests of the form
111 [sector number, cylinder number, surface number] are received by the disk controller at the same time: [120,
30, 2], [180, 85, 1], [60, 90, 0], [212, 100, 3], [56, 105, 2], [118, 110, I], [56, 135, 2], [118, 145, 1], currently
head is positioned at sector number 80 of cylinder 100, and is moving towards higher cylinder numbers. The
average power dissipation in moving the head over 100 cylinders is 20 milliwatts and for reversing the
direction of the head movement once is 15 milliwatts. Power dissipation associated with rotational latency
and switching of head between different platters is negligible.
[10]
41105. a) Differentiate fixed size and variable size partitioning. Consider the following heap (figure) in which
blank regions are not in use and black regions are in use- [3]
The sequence of requests for blocks of size is P1 - 300 kb, P2 - 25 kb, P3 - 75 kb, P4 - 50 kb, P5 - 100
and P6 - 450. Perform the allocation of processes using variable size partitioning scheme and apply
first fit and best fit algorithm and compare them in terms of external fragmentation.
b) Explain need of Interprocess communications. How Message passing model is used for Interprocess
communication.?
[3]
c b) In a virtual memory system. size of virtual addre IN is hii. si/e of steal address is 30-bn, page si/e is 4
Kbyte and sin of each page table entry is 32-bit. Hie main memory is byte addressable. Which one of the
f011owing is the maximum number of hits that can be us ed for storing protection and other information in each
]4J
Q6. Consider below table of four processes under Multilevel Feedback Queue [101
PI 8
P2 4 7
P3 8 7
P4 12
scheduling. queuel uses round robin scheduling algorithm haN ing time quantum of 2 ins, queue2 also uses round
robin scheduling algorithm with time quantum of -fins and queue3 uses non-preemptive shortest job first
algorithm for process scheduling. Priority of queuel is highest and priority of queue 3 is smallest
(queuel>queue2>queue3), and there is non preemptive priority scheduling between the queues. If process
waiting time -- 13 ms at any point it must he upgraded to higher priority queue. Find out Avg. waiting time.
Q7: a) Consider a main memory with three page frames and the following sequence of page references: 3, 8. 2. 3.
i) Belady's anomaly
v) Aging
Roll Number: Group: Name of Student:
1. If a system is using proportional frame allocation method and it have total 72 frames to allocate between the
processes of size 20KB and of 120KB, then the first process will be allocated frames and other
a) 61, 10
b) 10, 61
c) 20, 52
d) 52, 20
We are using fixed size partitioning scheme for memory allocation, let us assume the jobs and the memory
requirements as follows:
Block5 — 50K
If we use best fit partition allocation scheme, then what will be the total internal fragmentation for
satisfying the request.
a) 130
b) 30
c) 50
d) 40
3. is used to locate the appropriate memory-resident library routine for dynamic linking
a) Stub
b) Paging
c) RAID
d) Working set model
4. In we can survive 2 concurrent disk failures.
a) RAID 4
b) RAID 5
c) RAID 6
d) RAID 10
5. Consider a main memory with 3 page frames and the following sequence of page references:
4. 7. 6, I, 7. 6. 1. 2. 7, 2
Which one of the following is true with respect to page replacement policy Least Recently Used (LRU)?
6. Consider Peterson's algorithm for mutual exclusion between two concurrent processes i and j. The program
repeat
flag[i]=TRUE;
I urn=j;
whilc(p) do no-op;
critical section
= false;
non-critical section
until false
For the program to guarantee mutual exclusion, the predicate P in the while loop should be.
7. Consider a hypothetical situation where system wants to allocate file f to a block of memory. Let A be an array
(of size 10) of available memory blocks. The system accesses the array A only sequentially (i.e forward (I to
10) or backward ( I 0 to I )). The following function is evaluated to allocate the file f to a block:
The system sorts the array again (ascending or descending based on the algorithm used) after each allocation
(by considering leftover block size). Consider the following algorithms for the above hypothetical system:
block size)
Algorithm P. Q respectively
a) 16 MB
b) 8 MB
c) 2 MB
d) 2,1 MB
9. Assume that the system has 3 page frames. Consider the following page reference stream in the given order.
7,0, 1, 2, 0, 3, 0, 4, 2, 3
The number of page faults occur using optimal page replacement algorithm arc
a) 10
4111 b) 6
c) 4
d) 8
10. Consider a computer system with 40-bit virtual addressing and page size of sixteen kilobytes. If the computer
system has a one-level page table per process and each page table entry requires 48 bits, then the size of the per-
process page table is megabytes.
a) 387 MB
b) 386 MB
c) 385 MB
d) 384 MB
Roll Number: Name: Group:
Q.1 A disk has 200 tracks (numbered 0 through 199). At a given time, it was
servicing the request of reading data from track 120, and at the previous request,
service was for track 90. The pending requests (in order of their arrival) are for track
numbers. 30 70 115 130 110 80 20 25.
(i) How many times will the head change its direction for the disk scheduling policies
C-SCAN, LOOK and SSTF (Shortest Seek Time First)?
(ii) Identify the total head movement (in number of cylinders) incurred while
servicing these requests using C-SCAN, LOOK and SSTF. [7 Marks]
Q.2 (i) What are the disadvantages of fixed partitioning? How dynamic partitioning
overcome these issues? Briefly discuss. [5 Marks]
Q.3 (i) Consider a single level paging scheme. The virtual address space is 4 GB and
page size is 128 KB. What is the maximum page table entry size possible such that
the entire page table fits well in one page? [4 Marks]
(ii) A computer system, using inverted page table where logical address space is
16MB and physical address space 8GB, and page size are 4KB. Memory is byte-
addressable and page entry size is 8 bytes. What is the page table size? [3 Marks]
Q. 4
(i) Consider six memory partitions of size 200 KB, 400 KB, 600 KB, 500 KB,
300 KB, and 250 KB, where KB refers to kilobyte. These partitions need to be
allotted to four processes of sizes 357 KB, 210 KB, 468 KB and 491 KB in that
order. If the best fit algorithm is used, which partitions are NOT allotted to any
process?
[2 Marks]
(ii) Consider the following segment table-
.
Segment No. Base Length
0 1219 700
1 2300 14
2 90 100
3 1327 580
4 1952 96 I
Which of the following logical address will produce trap addressing error?
I. 0, 430
ii. 1, 11
iii. 2, 100
iv. 3, 425
v. 4, 95
[5 Marks]
Q.5
(i) Discuss that file allocation scheme, which suffers from both internal and
external fragmentation.
[4 Marks]
(ii) Consider a disk pack with 16 surfaces, 128 tracks per surface and 256 sectors per
track. 512 bytes of data are stored in a bit serial manner in a sector. Calculate -
a. Capacity of the disk pack
b.
Number of bits required to specify a particular sector in the disk? [3 Marks]
Roll Number:
Thapar Institute of Engineering & Technology
Department of Computer Science and Engineering
END SEMESTER EXAMINATION
Q.1 Rohan got selected for the technical interview round of Amazon, where interviewer Mr. X asked him
7)
for his favourite topic in the subject operating systems. Rohan replied to this saying "Memory (
management". After this Mr. X given a scenario to Rohan, which was related to memory
management: In a system of 8GB RAM, virtual address space of 4GB was there for the processes
(maximum processes that system can accommodate).Where, the said system allows a maximum of
I K (=I024) processes to run concurrently. Also, the Paging-based memory management system was
in place. 4KB was the size of physical frames and logical pages. In the system, each page table entry
requires an additional I I bits (beyond the frame number) to store allied information related to flags
(assumption). After quoting the scenario, Mr. X questioned Rohan for his comments on the
requirement of the maximum memory space needed to store the page tables of all
proCesses in the system; where the Operating Systems uses hierarchical paging. Now, imagine
yourself in place of Rohan and give a suitable attempt to pass the technical round of Amazon.
[While computing, consider the memory required for both outer and inner page tables.]
Q.2 For a disk with 200 tracks on it, the table below gives a snapshot of the input/output request(s) (7)
made at different instances of time ('ms' is millisecond):
At the current clock time, which is 160th ms, assume the current head position at track number 65,
and direction of last movement is towards higher number of tracks. Compute the total number of
track movements when Shortest Seek Time First and LOOK disk-arm scheduling algorithms
have been deployed [give suitable diagram].
Q.3 a. What do we exactly mean by the term "allocation" for a particular file? With a suitable (4)
diagram, explain three file allocation methods available in an operating system.
b. With a suitable diagram differentiate between RAID 1+0 and RAID 0+ I. (3)
Q.4 a. List three types of breaches through which security in a computer system can be
(3)
compromised.
b. With a suitable diagram, explain the access matrix, various access rights and mode switching (3)
in it.
Page 1 of 2
c. In an access matrix, what does the symbol (*) star symbolize?
Q.5 a. For the Dining Philosopher Problem [taking 05 philosophers here], following code snippet is
one among the semaphore based proposed solution (for the ith Philosopher). Here, chopstick
is an array of Semaphore and has been initialized to I (i.e. chopstick [5] = {I, I, 1,1, I})
Although the given code was proposed as a solution, but this code is still having a problem. Point out
the problem with this code and give a robust solution by amending this snippet.
Page 2 of 2
Roll Number:
Thapar Institute of Engineering and Technology, Patiala
Department of Computer Science and Engineering
Auxiliary Exam Course Code: UCS303
B.E. COE/CSE (Second Year): Semester-Ill Course Name: Operating Systems
August 16, 2022, MM: 50 Name of Faculty: Dr. Tarunpreet Bhatia
Note: Attempt all parts of a question at one place. Assume missing data, if any, suitably.
Q.1 Consider the following snapshot of an operating system required to schedule the (10)
execution of the rocesses:
Processes Arrival Time (in Burst time (in Priority
ms) ms)
Pi 0 10 5 (Lowest)
P2 0 5 2
P3 2 3 1 (Highest)
P4 5 20 4
Ps 10 2 3
Calculate average waiting and turnaround time for the following scheduling policies:
a) SJF
b) SRTF
c) Priority with preemption
d) Priority without preemption
Q.2 Differentiate between user-level and kernel level threads. With appropriate diagrams, (4+6)
explain different multithreading models.
Q.3 a) Discuss critical section problem and three necessary conditions for solution to the (5)
Critical Section Problem.
b) Consider two processes Pi and Pi are executing below code, with the current process (5)
being process i and the other process being process j. Does the following proposed
solution to the critical section problem for two processes guarantee all the three
necessary conditions? Give proper justification.
int turn = 0; //shared variable
int flag[2] = {false, false}; //shared variable
//Entry section
turn = j;
flag[i] = true;
while (flag[j])
flag[i] = false;
while (turn != i) ;
flag[i] = true;
}
// Critical section
//Exit section
flag[i] = false;
Page 1 of 2 P.T.O
Q.4 There are 100 cylinders numbered 0-99. What is the total number of head movements (5+5)
for C-LOOK and SCAN algorithms if the head pointer is currently at cylinder 15 and it is
moving in forward direction? The requests are as follows: 2, 10, 5, 52, 33, 42, 81, 77,
22, 8, 14
Q.5 Consider a RAM of 3 frames and calculate the number of page faults in the following (5+5)
reference string using second chance and LRU page replacement algorithms.
0, 4, 1, 4, 2, 4, 3, 4, 2, 4, 0, 4, 1, 4, 2, 4, 3, 4
Assume that all the page frames are initially empty.
Page 2 of 2
Roll Number:
Thapar Institute of Engineering & Technology
Department of Computer Science and Engineering
END SEMESTER EXAMINATION
Attempt all Questions in sequence.AttemptlAnswer all sub-parts of each question at one place.
Assume missing data (if any). Show all the intermediate computations properly.
Q.1 Consider a disk storage system with 200 cylinders numbered as 0, I, ..., 199. Cylinder number (20)
0 starts from centre and move in an incremental fashion towards circumference. The disk
requests with following cylinder number are received by the disk controller:
72, 134, 20, 86,116, 16
Compute the Total Head movements and Number of times Head changes its direction, when
following algorithms have been deployed. Currently head is positioned at cylinder 80. Initial
direction of movement is towards higher cylinder numbers for C-LOOK and C-SCAN. Show
suitable diagrams and intermediate computational steps for each case.
i. FCFS
ii. SSTF
iii. C-LOOK
iv. C-SCAN
Q.2 (a) Illustrate the translation of logical to physical address in segmentation with the help of (5)
a diagram.
(b) Consider a system with single-level paging-based memory management, whose
architecture allows for a 4GB virtual/logical address space for processes. The size of
each logical page is 4KB.The system has 5 I 2MB of physical RAM.Assume valid-invalid
bit is also attached to each entry in the page table, and memory is byte addressable.
Show intermediate calculations to answer the following questions:
i. When a process starts, the content of page table gets loaded to the CPU
registers from RAM (with load speed of 0I byte per 100 nsec). If a process runs
for 500 msec (including the time to load the page table), what percentage of the
CPU time is involved for loading the page table?
ii. Assume a program of size 20400 bytes that is to be loaded in some of the
available free frames numbered {6, 18, 60, 2, 35, 15, 45}.The order for occupying
the frames will be 6->18->6042435415->45. Convert the logical addresses
11876 and 17865 to their corresponding physical addresses.All addresses given
here are in decimal and your answer should also be in decimal. (Assume that
memory addresses start from 0). Also, calculate the external fragmentation in
bytes (if any).
Q.3 (a) With a suitable diagrammatic representation explain in detail the Dining Philosopher
Problem along with its constraints and conditions.Also, write the deadlock-free solution
(pseudocode) for the said problem using semaphores.
(b) With a suitable diagram explain the Access Matrix and various operations (copy, owner,
control, switch) that can be applied to it.
Page 1 of 2
(c) With a suitable diagram explain the Indexed allocation of disk space. Also, describe (5)
three ways to handle the size of index block.
Q.4 (a) Consider a system with 4 frames allocated to a process in the main memory. The (10)
process having the page references 7,0,1,2,0,3,0,4,2,3,0,3,2,1,0,4 to complete its
execution. With the help of a suitable diagram (showing step-by-step execution)
compute the page faults that will occur using Least Recently Used (LRU) and Optimal
Page Replacement (OPR) algorithms. In case of multiple choices for page replacement
in OPR, the First in First out (FIFO) algorithm will be used to resolve conflict. Draw a
diagram to depict Thrashing in operating systems.
(b) A processor uses single-level paging for virtual to physical address translation.The page
table is stored in the main memory. The processor has a translation look-aside buffer
(TLB) to improve page table access time, with a hit rate of 96%.The TLB stores recently
used virtual page numbers and the corresponding frame numbers. So if there is a hit in
TLB, then the processor avoids page table access as frame numbers are available in TLB.
The processor also has a physically addressed cache to improve main memory access
time with a hit rate of 90%. The physically addressed cache has a copy of the
corresponding frames in the main memory. So if there is a hit in the physically addressed
cache, then the processor avoids main memory access as frames are available in the
physically addressed cache. The main memory access time is 100 ns, the physically
addressed cache access time is 10 ns, and the TLB access time is 4ns.
i. Draw the labelled diagram for above mentioned paging scheme. (2)
ii. Assuming that no page faults occur, calculate the average memory access time taken (4)
to access data at a given virtual address.
iii. Further, 80% of the page references generate page faults which are identified by (4)
using valid/invalid bit in page table. Calculate the average memory access time taken
to access data at a given virtual address if time taken to transfer page from disk to
RAM is 200 ns.Assume the time taken to update TLB, cache memory, and page table
is negligible and sufficient free frames are available in main memory to store the
pages.
Q.5 (a) In a scenario of a process execution, there exist 04 processes in a system and table (10)
given below is a snapshot for the same.Apply Round Robin (time quanta=2 units) and
pre-emptive Shortest Job First/Shortest Remaining Time (SRTF) CPU scheduling
algorithms on the scenario given below and compute the waiting time and turnaround
time for each process in both the algorithms with the help of GANTT chart.
(b) With the help of pseudocode, describe in detail the Banker's Algorithm used by (10)
Operating System for avoiding the Deadlock condition.
Page 2 of 2
Roll Number: Name:
ki (Deemed to be University)
Department of Electronics & Communication Engineering
Mid Semester Test
Q1 . a). Draw the process state diagram to explain the various states a "process" undergoes? Mention (3)
different schedulers in the process state diagram.
b). Explain non-preemptive vs preemptive CPU scheduling with examples? (2)
c). What is CPU starvation and how an OS deals with starvation? (2)
Q3. a). Write the conditions for the concurrent processing of two statements? (2)
b). Write a concurrent program using the ' brk-join" data structure for the precedence graph (3)
shown below:
(s4
Q4. a). At a particular time, the value of counting semaphore 'C' is twenty. Find the final value of (2)
the semaphore after twenty-three '13' operations, twenty 'V' operations, five P' operations, and
three 'V' operations.
b). Consider three processes A, B, and C to be scheduled as per the SRTF algorithm. The process (3)
`A' is known to be scheduled first, and when, 'A' has been running for '7' units of time, the
process 'C' has arrived. Process 'C' has run for '1' unit of time, then process 'B' has arrived and
completed running in '2' units of time. Then, what could be the minimum burst time of the
processes 'A' and 'C'?
c). What is a critical-section problem? Briefly explain the three requirements of a solution to the (2)
critical section problem.
Q5. a). Define deadlock and briefly explain the necessary conditions for the occurrence of a (2)
deadlock?
b). Consider a system with three resource types A, B, and C having 10, 5, and 7 instances (5)
respectively. There are 5 processes (P1, P2, P3, P4, and P5) to be executed. P1 has declared its
maximum requirements as 7, 5, and 3, and has acquired 0, 1, and 0 instances of A, B, and C
respectively. Similarly, P2's maximum requirement is 3, 2, and 2, and acquired 2, 0, and 0. P3's
maximum requirement is 9, 0, and 2 and has acquired 3, 0, and 2. P4 has declared 2, 2, and 2 as
its maximum requirement and has acquired 2, 1, and 1. P5's maximum requirement is 4, 3, and
3 and has acquired 0, 0, and 2. If there are 3, 3, and 2 instances of A, B, and C respectively i.e.,
available at this instant. Find a safe sequence using which this system can avoid the deadlock.
Roll Number: Name Group
Attempt/Answer all sub parts like (a), (b), (c) for each question at one place. Do mention
Page No. of your attempt at front page of the answer sheet. Assume missing data (if any).
Show all intermediate computations properly.
Ql. (a). Consider a system with 6 processes where multilevel queue scheduling has been deployed using three
[5]
queues labelled as Ql, Q2 and Q3, with priorities of queues are like, Q1 > Q2 > Q3. The Q I , Q2, and
Q3 queues use the shortest remaining time first (SRTF), first come first serve (FCFS), and round robin
(RR) scheduling with 2 ms time quantum, respectively. The arrival time (ms), burst time (ms), and
execution queues of the processes are iziven in table below.
Process Id Arrival Time Burst Time Queue No.
P1 0 3 Q1
P2 0 4 Q1
P3 7 2 Q2
P4 6 4 Q2
P5 10 5 Q1
P6 5 3 Q3
Conside
1. Draw the Gantt chart showing the sequence of execution for the processes involved in the
system, and also specify the status of Q1, Q2, and Q3 at time instance t=20, i.e. the processes
that reside in the said queues.
2. What is the turn-around time of processes P4 and P6?
3. What are the number context of switches after execution of all process?
(b). With a suitable diagram explain Computer System Structure with its four component. [2]
Q2. (a). With suitable diagrams explain inter-process communication models. Also, explain ways to implement [2]
logical link in message passing inter-process communication model with related issues.
(b). In a system, the following state of process and resources are given: P1--► R1, P5-9R3, P2—► R3,
P2—,R2, R2-4P3, P3—► R3, R3-414, P4---,R4, R4—)P5, P5-4t5, R5—►PI. Draw a suitable resource [2.5]
allocation graph and its corresponding wait-for-graph.
(c). Draw a labelled diagram to showcase the various states of a process. Also, label the suitable transition [2.5]
arrow for short, mid, and long term scheduler for their specific working.
Q3. (a). A system has 5 processes and 4 resource types. The current location and maximum need are [5]
depicted in Table below. Assume that whenever there will be a choice, the process with smaller
id will be allocated the resources first.
(h). Draw an annotated parent - child tree structure [including the return value of each fork 0] for the code [5]
snippet given below. Also, comment on the total count of occurrences for "Mid Semester", and "2023".
[Here, L1,2,3...denotes line number]
1. int main()
2.
3. fork();
4. if (fork() && fork())
5. {
6. printf("M id Semester");
7. fork();
8. }
9. fork();
10. printf("2023");
1 1. return 0;
12. }
Q5. (a). Consider a system with two CPUs as [ 5]
CPU I and CPU2. Graph depicts execution
dependency among various processes P 1
to P7. Edge Pi 4 Pj denotes that the
process Pj is dependent on process Pi and
will start execution after Pi completes its
execution. Draw the GANTT chart for
both the CPUs and compute the minimum
time needed to execute all processes in the
system. Assume that processes in the
system execute in Round Robin mode
with time quantum 2 ms, and the system
has started at time t=0, with Process P 1 at
CPUI . Also, a process cannot share two
CPUs at the same time but different
timestamp. [Here, AT and 13T denotes
arrival time and burst time respectively.]
(b). System call provides the means for a user program to ask the operating system to perform tasks [2]
reserved for the operating system on the user program's behalf. Explain using diagram the
transition from user to kernel mode & vice versa while executing the system call.
Roll Number:
Thapar Institute of Engineering & Technology, Patiala
Department of Electrical and Instrumentation Engineering
End Semester Test (EST)
B.E (EEC)-2nd Year-2223 EVENSEM Course Code: UCS303
Date: May 17, 2023 Course Name: Operating Systems
M. Marks: 40 Name of Faculty: Dr. Alok Kumar Shuida
Note: Attempt all questions in a proper sequence with justification.
Assume missing data, if any suitably.
Q. 1 (a) Consider a disk pack with 16 surfaces, 128 tracks per surface, 256 sectors per track, and (6)
512 bytes of data stored in a bit serial manner in a sector. Answer the following queries:
1 (b) Consider a file system that uses UNIX-like inodes to keep track of the sectors allocated (4)
to files. Assume that disk blocks are 1 KB in size, disk block addresses are 32 bits and
the inode has space for 8 direct blocks, 1 singly indirect block, 1 doubly indirect block,
and 1 triply indirect block. What is the largest disk drive that could be fully utilized by
this system?
Q. 2 (a) What is the purpose of paging in the page tables, explain with a neat diagram. Consider (2+2)
a computer system with a 32-bit logical address and 4-KB page size. The system
supports up to 512 MB of physical memory. How many entries are there in a
conventional single-level page table?
Q. 2 (b) What are the causes of thrashing in computer memory management, explain with a neat (2+3)
diagram. How many page faults occur in Least Recently Used (LRU) page replacement
algorithm for the given reference string: 7 0 1 2 0 3 0 4 2 3 0 3 212 017 0 1, with frame
size is 3?
Q. 3 (a) Consider the famous dining philosophers' problem. N philosophers are sitting around a (3)
table with N forks between them. Each philosopher must pick up both forks on her left
and right before she can start eating. If each philosopher first picks the fork on her left
(or right), then all will deadlock while waiting for the other fork. The goal is to come up
with an algorithm that lets all philosophers eat, without deadlock or starvation. Write a
solution to this problem using condition variables.
Q. 3 (b) Write the pseudo-code of banker's algorithm. The banker's algorithm is being run in a (1.5+1.5)
system with m resource classes and n processes. In the limit of large m and n the number
of operations that must be performed to check a state for safety is proportional to ma
TIP . What are the values of a and b.
Q. 4(a) Suppose the following disk request sequence (track numbers) for a disk with 100 tracks (5)
is given: 45, 20, 90, 10, 50, 60, 80, 25, 70. Assume that the initial position of the R/W
head is on track 50. Find the additional distance (in terms of tracks) that will be
traversed by the R/W head when the Shortest Seek Time First algorithm is used
compared to the Elevator algorithm (assuming that the Elevator algorithm moves
towards 100 when it starts execution).
Q. 4(b) Consider a process with a single CPU burst of 100-time units and a single disk I/O of (3)
1000 time units at the end. If the timer interval is fifteen-time units and the process
scheduling algorithm is round-robin, at most how many times would the process enter
the ready queue before entering the terminated state? Assume that there is a sufficiently
large number of processes of similar nature trying to run on the CPU.
1/1
Q. 5 (a) Consider a parent process P that has forked a child process C in the program below. (4)
int a = 5;
int fd = open(...)
int ret = fork();
if(ret >0) {
close(fd);
a = 6;
...
}
else if(ret==0) {
printf("a=%d\n", a);
read(fd, OS);
}
After the new process is forked, suppose that the parent process is scheduled first,
before the child process. Once the parent resumes after fork, it closes the file descriptor
and changes the value of a variable as shown above. Assume that the child process is
scheduled for the first time only after the parent completes these two changes.
I. What is the value of the variable a as printed in the child process when it is scheduled
next? With proper justification.
II. Will the attempt to read from the file descriptor succeed in the child? With proper
justification.
Q. 5 (b) Instructions related to accessing I/O devices are typically privileged instructions, that (3)
is, they can be executed in kernel mode but not in user mode. Give any 3 reasons why
these instructions are privileged.
2/1
Roll Number:
(Deemed to be University)
1. a) Explain how operating system ensures access control using access matrix, also explain copy, 3
owner and control rights of it.
b) Provide an explanation of the different file access methods along with their respective 3
advantages and disadvantages.
2. a) Explain following terms
i) Masquerading, ii) Trojan Horse, iii) Thrashing, iv) RACE condition 2
b) Explain demand paging. Consider a main memory with five page frames and the following
sequence of page references: 3, 8, 2, 3, 9, 1, 6, 3, 8, 9, 3, 6, 2, 1, 3. Find out total number of 4
page faults if LRU and optimal page replacement method is used.
3. a) A paging scheme uses a Translation Look-aside Buffer (TLB). A TLB-access takes 10 ns
and a main memory access takes 50 ns. What is the effective access time (in ns) if the TLB 2
hit ratio is 90% and there is no page-fault?
b) Explain Peterson's solution with its limitations. 2
C) Consider the methods used by processes P 1 and P2 for accessing their critical sections
whenever needed, as given below. The initial values of shared Boolean variables S1 and S2
are randomly assigned.
PI P2 2
while (51 = S2) ; while (S1 — S2) ;
Critical Section Critical Section
SI = S2; SI = S2;
Find out is it a valid solution for critical section problem or not with proper reasoning.
4 a) Explain Dining-Philosophers problem and solve it using semaphore. 2
b) Consider system is using static memory allocation and have five memory partitions of size
100 KB, 500 KB, 200 KB, 450 KB and 600 KB in same order. If sequence of requests for 4
blocks of size 212 KB, 417 KB, 112 KB and 426 KB in same order come, then which of the
partition allocation algorithm makes the efficient use of memory? Find out internal as well as
external fragmentation.
5 a) Discuss the paging technique, its distinctions from segmentation, and how it addresses 2
external fragmentation problem, also acknowledge its limitations.
b) What is virtual memory, and how does it enhance the efficiency and scalability of modern 3
computer systems?
6 a) Explain belady's anomaly, further assume that the system has 3 page frames, initially all are
empty. Consider the following page reference stream in the given order. 7, 0, 1, 2, 0, 3, 0, 4, 3
2, 3. Find out the number of page faults occur using second chance algorithm.
b) Explain significance of RAID (Redundant Array of Independent Disks) in a system, and what
are the different RAID levels and their respective advantages and disadvantages? 2
7. a) Consider a storage disk with 4 platters (numbered as 0, 1, 2 and 3), 200 cylinders (numbered
as 0, 1, ... , 199), and 256 sectors per track (numbered as 0, 1, ... 255). The following 6
disk requests of the form [sector number, cylinder number, platter number] are received by
the disk controller at the same time:
4
[120, 72, 2], [180, 134, 1], [60, 20, 0], [212, 86, 3], [56, 116, 2], [118, 16, 1]
Currently head is positioned at sector number 100 of cylinder 80, and is moving towards
higher cylinder numbers. The average power dissipation in moving the head over 100
cylinders is 20 milliwatts and for reversing the direction of the head movement once is 15
milliwatts. Power dissipation associated with rotational latency and switching of head
between different platters is negligible. Find out the total power consumption in milliwatts
to satisfy all of the above disk requests using the Shortest Seek Time First disk scheduling
algorithm.
h) What are the different conditions that can contribute to the occurrence of deadlock in an 2
operating system.
Roll Number:
Ei (Deemed to be University)
Department of Electrical and Instrumentation Engineering
Mid Semester Test (MST)
Qi. a. The following program consists of 3 concurrent processes and 3 binary semaphores. The semaphores
are initialized as SO=1, S1=0, S2=0.
Process PO Process P1 Process P2
while (true) { wait (S1); wait (S2);
wait (SO);
(2+3)
Release (SO); release (SO);
print (0);
release (S1);
release (S2);
1
In the above scenario, how many times will process PO print '0'?
b. Define when you should use fork () over the thread. Also, discuss what happens when you call fork 0
in thread?
Q2. a. Does the following code suffice to protect a critical section with two processes p0 and p1 running on
separate processors on a two-processor shared-memory machine, explain in detail. That is, does it meet
all of the requirements for protecting a critical section? The below-mentioned code for process p0. The (2.5+2.5)
code for pl is similar, with each occurrence of 0 replaced by 1. Variable 'turn' is a shared variable.
... /* non-critical-section code */
while(turn I= 0) {}
critical section
turn = 0;
... /* non-critical-section code */
b. What are the three conditions of mutual exclusion? Consider Peterson's algorithm for mutual
exclusion between two concurrent processes i and j. The program executed by process is shown below:
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 mentioned above to guarantee mutual exclusion, write the condition using flag and
turn respect to processes i and j to the predicate P in the while loop.
Q3. a. What is round robin CPU scheduling algorithm? Consider n processes sharing the CPU in a round-
robin fashion. Assuming that each process switch takes s seconds, what must be the quantum size q
(3+2)
such that the overhead resulting from process switching is minimized but, at the same time, each
process is guaranteed to get its turn at the CPU at least every t seconds?
b. What is the effect of time quantum on number of context switches, explain with a neat diagram.
Q4. a. A single processor system has three resource types X, Y and Z, which are shared by three processes.
There are 5 units of each resource type. Consider the following scenario, where the column Alloc
denotes the number of units of each resource type allocated to each process, and the column Request (3+2)
denotes the number of units of each resource type requested by process in order to complete execution.
Show the order of execution of processes (P0, P1, P2) completion. Also, find which of the process will
finish LAST?
Alloc Request
X Y Z X Y Z
PO 1 1
P1 1
P2 1
b. Which necessary condition for deadlock states that a process must be holding one resource and
waiting to acquire additional help by using a resource allocation graph to illustrate your answer?
Q5. Consider the following set of processes, with the length of the CPU burst given in milliseconds:
The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.
a. Draw the Gantt charts that illustrate the execution of these processes using the following scheduling
algorithms: First Come First Serve (FCFS), shortest job first (SJF), and non-preemptive priority (a larger
priority number implies a higher priority) scheduling.
b. What is the turnaround time of each process for each of the scheduling algorithms in part a?
c. Which of the algorithms results in the minimum average waiting time (over all processes) in part a?
Roll Number:
(Deemed to be University)
Q4 Consider the set of 4 processes whose arrival time and burst time are given below-
If the CPU scheduling policy is Priority Scheduling, calculate the average waiting time. (Lower number
means higher priority) and CPU utilization.
Q5 Explain following:
a) Circular wait elimination rule.
b) Deadlock detection using RAG with a suitable example.
c) Process states. 5
d) Aging.
Roll Number:
Note: All questions are compulsory. All parts of a question should be attempted in one place. Assume
missing data, if any suitably.
Q. 1 a) Discuss and draw a labelled diagram for Process Execution Life Cycle. [10]
Q. 2 a) Discuss the. producer consumer problem. Write the pseudo code for both CIO
the process using shared memory.
b). What is the completion time of P1, P2, and P3 using Shortest Remaining E 103
Time First,(SRTF) scheduling algorithm?
Q. 3 a) Draw and explain the labelled diagram of Segmentation for allocating non- [10]
contiguous memory to a process.
b) Explain the Fork() system call and its return values in child process creation [10]
with an example.
Q. 4 Consider a disk storage system with 200 cylinders numbered as 0,1,....,199. Cyl- [20]
inder number 0 starts from center and move in an incremental fashion towards cir-
cumference. The disk requests with following cylinder are received by the disk
controller:
98, 183, 37, 122, 14, 124, 65, 67
Compute the Total Head Movements, when following algorithms have been de-
ployed. Currently head is positioned at cylinder 53. Initial direction of movement
1
is towards higher cylinder for C-LOOK and C-SCAN. Show suitable diagrams and
intermediate computational steps for each case.
i. FCFS
ii. SSTF
iii. C-LOOK
iv. C-SCAN
Q. 5 a) Consider three concurrent processes Pl, P2 and P3 as shown below, which ac- [10]
cess a shared variable B that has been initialized to 200. The process are exe-
cuted on a uniprocessor system running a time-shared operating system. If the
minimum and maximum possible values of B after the three processes have
completed execution are X and Y respectively, calculate the value of X and Y?
P1 P2 P3
"" "" •• "
.... .... ....
B=B+40 B=B-100 B=B+70
.... .... ....
.... .... ....
b) Discuss the difference between Fixed Partitioning and Variable Partitioning [5]
Scheme with examples for contiguous memory allocation.
c) Explain Thrashing with example. Show the relationship between degree of [5]
multiprogramming and CPU utilization with a graph.
***********
2
Roll Number: Name Group
THAPAR INSTITUTE OF ENGINEERING &TECHNOLOGY, PATIALA
Department of Computer Science & Engineering
Operating System (UCS303) — End Semester Examination
I Date: 08/12/2023 & Time: 02:OOPM MM: 100 & WT: 35 & MT: 180 Min
Attempt/Answer any five COMPLETE questions and all sub parts like (a), (b), (c) for each
question at one place. Do mention Page No. of your attempt at front page of the answer
sheet. Assume missing data (if any). Show all intermediate computations properly.
Ql. (a). Consider a system with processor uses 2—level page tables for virtual to physical address
translation. Page tables for both levels are stored in the main memory. Virtual and physical
addresses are both 32 bits wide. The memory is byte addressable. For virtual to physical address
translation, the 10 most significant bits of the virtual address are used as index into the first
level page table while the next 12 bits are used as index into the second level page table. The
10 least significant bits of the virtual address are used as offset within the page. Assume that
the page table entries in both levels of page tables are 4 bytes wide. Show intermediate
calculations to answer the following questions:
(0 Illustrate the translation of logical to physical address in 2—level paging with the [5]
help of a diagram.
(ii) Compute the size of logical address space (LAS), physical address space (PAS), [5]
inner and outer page table size, and number of bits to represent frame number.
(iii) Further, the processor has a translation look-aside buffer (TLB) to improve page [5]
table access time, with a hit rate of 90%. The TLB stores recently used virtual page
numbers and the corresponding frame numbers. So if there is a hit in TLB, then the
processor avoids page table access as frame numbers are available in TLB. The
processor also has a physically addressed cache to improve main memory access
time with a hit rate of 96%. The physically addressed cache has a copy of the
corresponding frames in the main memory. So if there is a hit in the physically
addressed cache, then the processor avoids main memory access as frames are
available in the physically addressed cache. The main memory access time is 100
ns, cache access time is 10 ns, and TLB access time is also 5 ns. Assuming that no
page faults occur, calculate the average memory access time taken to access data at
a given virtual address.
(b). With a suitable diagram explain the RAID 0+1 and RAID 1+0 structure. [5]
Q2. (a). Explain any five categories of viruses related to Operating systems. [5]
(b). Explain any three free-space management techniques under disk management. [5]
(c). Consider a system with fixed partitioning scheme and 4 partitions of sizes 410, 2810, 1610, and [10]
32KB. Best fit memory allocation strategy is utilised to allocate jobs on different partitions. Assuming
that we have same number of processors as the number of partitions to allow parallel processing, i.e.,
four process can execute simultaneously. Compute completion time of all the jobs using GANTT chart
for following jobs. Job J1 J2 J3 J4 J5 J6 J7
Memory Size 2K 14K 3K 16K 10K 25K 3K
Arrival Time 0 0 1 1 2 2 3
Burst Time 2 6 3 7 4 8 5
Q3. (a). With a suitable diagram explain thrashing and its causes? Also, explain two thrashing solutions working [10]
set model and page fault frequency with suitable diagram.
(b). Consider a system with five processes that use the Priority scheduling (preemptive). The [10]
Priority algorithm schedules a new process either when the running process gets blocked on
I/O, a new higher priority process arrives, or when the running process finishes its CPU burst.
Assume that all I/O operations can be overlapped as much as possible, and the process first
spends CPU time, followed by I/O time, and followed by CPU time again. Assume higher
number indicate higher priority. The processes have different arrival and burst times, given as
follows. With the help of GANTT chart, compute average waiting time of the system?
Process Arrival Burst Time Priority
ID Time CPU I/O CPU
P1 0 3 4 1 8
P2 0 2 3 2 6
P3 1 1 3 3 7
P4 1 4 4 4 9
P5 6 2 2 2 4
Q4. (a). Consider a system with 3 frames allocated to a process in the main memory. The process having [10]
the page references 6, 7, 8, 9, 6, 7, 1, 6, 7, 8, 9, 1 to complete its execution. With the help of a
suitable diagram (showing step-by-step execution) compute the page faults that will occur using
First in First Out (FIFO), Most Frequently Used (MFU), Least Recently Used (LRU), and
Optimal Page Replacement (OPR) algorithms. In case of multiple choices for page replacement,
the FWO algorithm will be used to resolve conflict.
(b).. Explain the Readers-Writers Problem along with its constraints and conditions. Also, write the [10]
deadlock-free solution (pseudo code) for the said problem using semaphores.
Q5. (a). Consider a disk storage system with 200 cylinders numbered as 0, 1, ..., 199. Cylinder number [10]
0 starts from centre and move in an incremental fashion towards the circumference. The disk
requests with following cylinder number are received by the disk controller: 55, 58, 39, 18, 90,
160, 150, 38, 184. Compute the Total Head movements and the Number of times Head changes
its direction, when the following algorithms have been deployed. Currently head is positioned
at cylinder 100. The initial direction of movement is towards higher cylinder numbers for SCAN
and C-SCAN. Show suitable diagrams and intermediate computational, steps for each case.
FCFS (ii) SSTF (iii) SCAN (iv) C-S CAN
(i)
(b). Consider the given code segment to analyse the 1. Load Ri, M[lock] [10]
three critical section conditions: mutual 2. CMP Ri, 0
exclusion, bounded waiting, and progress. Pre- 3. JNZ Step 1
emption can occur while executing the given 4. Store M[lock], 1
code. Assume, initial lock value is zero (lock=0) 5. CRITICAL SECTION
and all instructions are atomic. Show that if above 6. Store M[lock], 0
mentioned synchronization conditions are Where, CMP and JNZ denotes comparision
satisfied or not with proper explanation. and jump at non-zero intructions.
Q6. (a). Consider a disk which has 16 platters, and every platters has 2 surfaces, every surface is having [10]
1K tracks. Each track of the disk has 1024 sectors and each of size 512 Bytes. Assume that disk
has an average seek time of 60ns and rotational rate of 720RPM. Show intermediate calculations
to answer the following questions:
(i) What is the capacity of the disk?
(ii) What is the time taken to read 8 consecutive sectors of a track?
(iii) What is the data transfer rate of the disk?
(b). In a computer system, four files of size 11050 bytes, 4990 bytes, 5170 bytes, and 12640 bytes [10]
need to be stored. For storing these files on disk, we are using 100 byte disk blocks. For each
block used to store a file, 4 bytes of bookkeeping information also needs to be stored on the
disk. Consequently, the total space used to store a file is the sum of the space taken to store the
file and the space taken to store the bookkeeping information for the blocks allocated for storing
the file. A disk block can store either bookkeeping information for a file or data from a file, but
not both. Assume that no two process and their bookkepping information stored in same block.
What is the total space and total number of blocks required for storing the above mentioned
files using 100 byte disk blocks? ,,
Roll Number:
main memory access takes 100 ns. What is the TLB access time (in ns) if the TLB hit ratio is 60%
and there is no page fault?
4 a) Consider a system having m resources of the same type. These resources are shared by 3 processes A, 2
B and C which have peak demands of 3, 4 and 6 respectively. For what value of m, deadlock will not
occur?
b) Consider a system with three types of resources (RI, R2, and R3) and four processes (P1, P2, P3, and
2
P4). The current state of the system is represented by the following Resource Allocation Graph
(RAG): P I is holding I unit of RI and is requesting I unit of R2, P2 is holding 2 units of R2 and is
requesting I unit of R3, P3 is holding 1 unit of R3 and is requesting I unit of R I and P4 is holding I
unit of RI and I unit of R3. Draw the Resource Allocation Graph (RAG) for the given scenario.
c) Explain wait() system call and find out output of following code with decision tree:
int main(){
if (fork()) {
fork();} }
printf("EST");
return 0; }
5 a) Explain significance of RAID (Redundant Array of Independent Disks) in a system, and explain 2
b) Consider the set of 5 processes whose arrival time and burst time are given below 4
Process Id Arrival Time Burst Time Priority
P1 0 4 2
P2 I 3 3
P3 2 1 4
P4 3 5 5
P5 4 2 5
Calculate the average waiting time and average turnaround time, using the preemptive priority
scheduling and round robin algorithm (higher number represents higher priority and time quantum is
3-time unit).
6 a) Consider five memory partitions of size 100 KB, 500 KB, 200 KB, 450 KB and 600 KB in same order. 2
If sequence of requests for blocks of size 212 KB, 417 KB, 112 KB and 426 KB in same order come,
then which fixed size partition allocation algorithm makes the efficient use of memory?
b) Explain following:
3
i. Thrashing ii. Race Condition iii. Aging
c) Explain disk structure with a suitable diagram. Consider a 512 GB hard disk with 32 storage surfaces.
3
There are 4096 sectors per track and each sector holds 1024 bytes of data. Find out the number of