Operating Systems Notes (1)
Operating Systems Notes (1)
Chapter 1
Introduction
1
Written By: Mahesh, Nitin, Sunil.
Operating Systems
3) Explain Different Operating System Services in details. [2013, 2014, 2015, 2016]
Ans:- i) Program execution(Run time execution):- Accomplish the task of loading a
program into main memory partitions.
- Initiate program
- Provide for normal termination of program after successful execution.
ii) I/O operations:- Accomplish the task of device allocation and control i/o devices.
- provide for notifying errors, devices status etc.
iii) File system manipulation (Handling):- Accomplish the task of opening a file,
closing the file etc and provide for creating, deleting the files.
v) Accounting: - Accomplish the task of record keeping the system usage by how many
users and for how long (duration) for billing and accounting purposes
- Maintains log system activities for performance analysis and error recovery.
vi) Error detection: - Accomplish the task of error detection and recovery if any. For
instance paper jam on the printer.
- keep track of CPU, memory, I/O‟s device, storage device, file system networking etc..
- Report and/or deliver error massages in case of arithmetic overflow, diide by zero
errors.
vii) Resource Allocation:- Accomplish the task of resource allocation to multiple jobs.
- Reclaim the allocated resource after their use or as and when the job terminates.
viii) Protecting the systems:- Provide for safe computing by employing security scheme
against unauthorized access/ users.
- Authenticate legitimate users with login password and registrations.
2
Written By: Mahesh, Nitin, Sunil.
Operating Systems
ii) Memory Management:- The major function operating system is to manage the
resources of computers. Out of which main memory plays key role in the operation of a
modern computers system.
- Main memory is repository of run-time programs and the relevant data being accessed
and shared by CPU or processor I/O devices.
iii) File Management:- File is collection of related records about an entity is defined by
a file creator, object program, txt data, error report etc.
ex :- a data file may sequence of characters that can be alphanumeric, alphabetic,
pneumonic
- File management designed to provide an uniform log view.
- File management allow creation and deletion of a file.
- File management provides back-up a file for permanent storage for their feature use etc.
3
Written By: Mahesh, Nitin, Sunil.
Operating Systems
Vii) Command Interpreter System:- The primitive unction of O.S is to support and
user interface that determine the interaction with programmers operators or end-users.
- M.S DOS and UNIX O.S have the layer called Shell.
System services:
i) Language Translator: - + interpreters (for ex: java interrupts, basic interpreters)
+ Compilers (for ex: turbo c compiler, Borland c++ compiler)
+ Assembler (for ex: MASM, TASM, assembler for 8086 microprocessor)
ii) Loaders and Linkers:- for program loading execution. The system programs such as
Absolute loaders, re-lockable loaders.
-Linkage, editors, linkers, overlay loaders help assets placing (loading) the assembled
and/or compiler code (object program) into main memory and transfer CPU control to the
first instructors at which the program execution has to begin.
iii) Text editors for file modification and file manipulation: - A system programs such
as screen editors, line editors, Morton editors and several other text editors.
iv) Application program (system utilities for command user needs): - A system
program has applications or utilities such as world processor (M.S world), web browser
(net scope navigators, internet explorer (IE) M.S Excel).
- DBMS packages (ADD) for plotting.
6) What are Loosely Coupled and Tightly Coupled systems (Parallel systems)?
[2013]
Ans:- i) Loosely Coupled:- In this system each & every processors has separate memory
(its own memory). The processors can communicate with each other, but individually
processors can directly access its own „Local Memory‟.
- Loosely Coupled systems employs asymmetric multiprocessing which each slave
processor (CPU) is assigned a specific task and execute user job in parallel, where as a
single master processor (CPU) control & co-ordinate activities of the slave processor.
- It is possible to assign several slave processor (CPU) to execute single user job in
Parallel, in such case given job is broken into Modules.
5
Written By: Mahesh, Nitin, Sunil.
Operating Systems
- Loosely Coupled systems can have a maximum up to 256 CPU‟s. Accessing there own
local memory.
ii) Tightly Coupled systems: - in these systems, all processors shares a common
memory and each processors can run identical copy of operating systems. Concurrently
giving raises to Symmetric multiprocessing (SMP).
- With Symmetric multiprocessing, all processor (CPU) are peers (equal status) and there
is no Master-slave relationship among multiprocessor.
- Even it can perform parallel execution of a single user job. Since processor shares
common memory and executes simultaneously.
- Tightly Coupled parallel system can have a maximum of 16 pees CPU‟s accessing
common memory, there are also know as shared memory parallel computers.
Time Sharing – It is the logical extension of the multiprogramming. It also refers Multi
tasking. Its goal is to provide good response time to interactive sessions of users.
- A time shared OS offers interactive access time to numbers of end-users,
simultaneously.
- Time Sharing support on line data processing and provides mechanism for concurrent
execution of jobs
- It economically feasible due to several users interactive access and almost no wastage of
CPU time.
6
Written By: Mahesh, Nitin, Sunil.
Operating Systems
7
Written By: Mahesh, Nitin, Sunil.
Operating Systems
Chapter - 2
Process Management
2) Explain the process states and operations of processes. [2011, 2014, 2015, 2016]
Process States :
1) Ready:- The process is on the toes control over the CPU or Processer. That is, a ready
process is waiting to be assigned to a processor for continuing its execution.
4) Blocked or Waiting: - The process must wait for some event to occur.
8
Written By: Mahesh, Nitin, Sunil.
Operating Systems
3) Explain in details about PCB (process control block). [2014, 2015, 2016]
Ans:-
A process switches between the running, ready and blocked states, many times, well
before its formal termination.
Each time when a particular process leaves the running state and yet does not encounter
its flag end, then its current state of status must be saved for feature reference.
a) Process state:- indication of the process state as Ready, Running, blocked or waiting
etc..
b) Process number:- Suggest finds this process distinctly as process ID
c) Program counter:- it is register containing address of next instruction to be executed
of this Process.
d) Registers:- A group of registers viz accumulators (A or AC) index registers, stack
pointers general purpose registers and condition codes.
e) CPU Scheduling information: - It suggests the details about the priority of the
process, pointers to ready queue scheduling.
f) Memory Management Information: - It suggests the details about Memory Usage by
this process.
g) Accounting Information:- it suggest the details such as, the allocated CPU time-slice,
the real-time used, process numbers, time limits and account number etc…
h) I/O device status information: - it suggest the details about allocated devices for this
process, list of files opened for this process etc..
9
Written By: Mahesh, Nitin, Sunil.
Operating Systems
- The sole responsibility of selecting a process (for execution) in accordance with some
scheduling policy-is being assigned to an OS module or to a component of process
management called the Scheduler.
5) What are Co-operating Process? Explain briefly. [2011, 2012, 2014, 2016]
Ans: - The processes executing in the operating system environment can be classified
into two types.
1. Independent process 2. Cooperating process
1) Independent process:- It does not share any data with any other process and it will
neither affect nor be affected by any other executing processes in the system.
2) Co-operating process: - It share data with other processes and can directly share
logical address space in Memory.
10
Written By: Mahesh, Nitin, Sunil.
Operating Systems
-Cooperating processes communicate each other via two communication schemes shared
memory and message systems.
b) Throughput: - Suggests that CPU must perform maximum computational tasks in the
shortest interval of time.
- If the CPU bound process is complex and time-consuming then the system throughput
may be just 1 or 2 process completion per unit of time.
- However, throughput rate may increase up to 10 or 20 process completion per unit of
time, provided the processes involved in execution must be simple and short.
11
Written By: Mahesh, Nitin, Sunil.
Operating Systems
c) Turn around Time:- Defines the time elapsed between the time of submission of a
process or job by a user and the time of completion of that process of job.
- Turn around time also includes waiting time in the ready queue, time spent over I/O
completion, waiting to get into memory, waiting time for child process completion etc.,
e) Waiting Time: - Suggest the time spent while waiting for I/O completion, waiting for
CPU in ready queue etc., The sum total of such time quantum‟s expended while waiting
for various subsidiary events to occur or to complete contribute towards increasing Turn
around time.
𝑃1 𝑃2 𝑃3
0 22 26 28
b) SJF Shortest Job First Scheduling: - Name itself indicates, the process in ready
queue having the „Shortest next CPU burst time‟ will be allocated the CPU.
12
Written By: Mahesh, Nitin, Sunil.
Operating Systems
- This would help in selecting shortest job for allocating the CPU next, in case of long-
term job scheduling in a batch system.
- Although the process enters in sequential order p1, p2, p3, p4… in like FCFS
scheduling, the process will be executed in the order p4, p1, p3, p2…
- Now, respective waiting time for individual process in ready queue waiting to get CPU
assignment shown below.
𝑃4 𝑃1 𝑃3 𝑃2
0 2 8 16 26
0+2+8+16
- Average waiting time is = == 6.5 milliseconds.
4
Conclusion
- Priority scheduling can be implemented as either primitive or non-primitive algorithms
- Priority cab be assigned can be defined as either internal or external priority
13
Written By: Mahesh, Nitin, Sunil.
Operating Systems
Advantages of RR scheduling: - 1) For time sharing systems and multi user system.
2) Offers good response and turnaround time.
14
Written By: Mahesh, Nitin, Sunil.
Operating Systems
Advantages of Threads
Responsiveness: - Speedy response to users.
Resource sharing: - hence allowing better utilization of resources.
Economy: - Creating and managing threads becomes easier.
Scalability: - One thread runs on one CPU. In Multithreaded processes, threads
can be distributed over a series of processors to scale.
- Multithreading Models
The user threads must be mapped to kernel threads, by one of the following strategies.
a) Many-To-One Model: -In the many-to-one model, many user-level threads are all
mapped onto a single kernel thread.
-Thread management is handled by the thread library in user space, which is efficient in
nature.
b) One-To-One Model: -The one-to-one model creates a separate kernel thread to handle
each and every user thread.
-Most implementations of this model place a limit on how many threads can be created.
15
Written By: Mahesh, Nitin, Sunil.
Operating Systems
Chapter -3
Process Synchronization and Deadlocks
- The segment of code called Entry Section of process Pi must request the OS permission
to enter in its own critical section.
- The segment of code called critical section perform the critical activities such. as
accessing and/or modifying the shared global variables, writing and/or rewriting,
appending, updating a file, a table of values etc.
- The segment of code called Exit section of process Pi follows critical section and
concludes formal termination of critical section code (zone).
- The segment of code called Remainder section of process.
- The critical-section problem suggests that the critical section code of a process must be
in use.
- Progress:- Assuming that if processes are not executing both in critical and remainder
sections, then these processes can compete as to which one will enter its critical section
next (Process Execution-progress requirement).
16
Written By: Mahesh, Nitin, Sunil.
Operating Systems
Wait (s):-This operation is originally termed as P (for wait -i+ to test) and can be defined
with the following program segment.
Wait (S)
{
While(S<=0)
;
s--; }
signal (S) :- This operation is originally termed as V (for signal to increment) and can
be defined with following program segment.
signal(s)
{
s=s+1; increment
}
4) What is Critical Region? Explain Readers and writers problem.[2011, 2012, 2013]
Ans: - Critical Regions: - Critical regions are one of the fundamental high level
synchronization construct, sometimes referred to as ‘Conditional Critical Region’.
- The critical regions construct eliminate simple errors that occur due to incorrect use of
semaphores as a solutions to Critical-Section Problem.
- For instance when semaphores are used to provide solution to the critical section
problem it is observed in general, the following requirements.
a) All concurrent processes share a semaphore variable mutex
b) Each & every process must execute wait (mutex) well before entering critical section
and signal (mutex) thereafter.
do
wait (mutex);
…….
critical section
…….
17
Written By: Mahesh, Nitin, Sunil.
Operating Systems
signal (mutex)
- Consider the following situation:-
- Observe that order of execution of wait and signal operations on the semaphore
variable mutex has been interchanged in a process and the execution sequence look like
the one shown below :
Signal(mutex)
……..
critical section
…
wait (mutex);
For instance
- First Readers - Writers Problem:- (Preference will be for Readers) Here, no reader
process is made to wait has not obtained any prior permission to access shared file. The
reader can proceed to execute its Read operations.
18
Written By: Mahesh, Nitin, Sunil.
Operating Systems
- Now, the problem starts as when philosophers became hungry and would like to eat
rice!
- When philosophers are busy in thinking about ethics, research etc. they never interact
with each other. But they would attempt at least to pick-up two chopsticks or spoons that
are adjacent to their plates.
- In other words, synchronization problem exist and intern it may lead to deadlock
&Starvation.
- To conclude, Dining - Philosopher problem could be solved by employing semaphores
called „chopsticks‟. This solution provides the necessary synchronization.
19
Written By: Mahesh, Nitin, Sunil.
Operating Systems
- Body of the monitor construct consist of shared variable declarations and a set of one or
more user-defined functions or procedures that represent various operations to be
performed on these abstract data types (i.e., on shared variables).
- In other words, the monitor is characterized by a set of user-defined or programmer
defined operations that are represented via functions.
7) What is Deadlock? Explain the necessary for its occurrence. [2015, 2016]
Ans: - Deadlock is a situation in which two or more processors are waiting on same
resources that are held by each other, this stage is called Deadlock.
- Deadlock situation can occur in a community of co-operating processes or among
competing processes that need exclusive access to one or more resources of a computer
system.
- Deadlock may be the side effects of synchronization techniques.
- In essence the need for inter-process communication among several co-operating
processes gives rise to the need for synchronization.
- As we know that, a deadlock situation presents a problem or scenario where in two or
more processes (P1, P2, P3, etc.,) get in to a hanging state (hold or locked or blocked
state) such that each process is holding a resource that its adjacent or neigh burring
process is requesting the same.
Deadlock Detection
- The deadlock avoidance approach avoid the „Unsafe States‟ although system might
recover from them.
20
Written By: Mahesh, Nitin, Sunil.
Operating Systems
- When Deadlock Detection and Recovery techniques are employed, the system does
now attempt to prevent deadlocks from Occurring. Rather, it allows deadlocks to occur,
tries to detect them.
- Therefore, the detection and recovery strategy must provide for the system the
following two algorithms.
- An algorithm to monitor the state of the system that verify and confirm whether the
deadlock has occurred [Detection].
- An algorithm to recover from Deadlock [Recovery].
- Deadlock Detection Algorithm for Single Instance of each resource type.
This algorithm makes use of variant of resource - allocation graph known as a wait -for
graph. - The deadlocked state occurs in the system if and only if the wait for graph
contains a cycle.
- Deadlock Detection algorithm for multiple instances of each resource type.
- This algorithm makes use of time-varying data structures that are similar to those
involved in banker's algorithm.
-The algorithm checks for every possible sequence of allocations for processes that are
not completed.
- The algorithm is matrix based (the current allocation matrix C and request matrix R)
depends upon comparing these vectors with available resource vector A.
-One alternative approach is to invoke detection algorithm every time when a resource
request is to be processed. This method is expensive interns of considerable overhead on
CPU time.
-An alternative strategy is to check for deadlock detection at every k (say once in 60)
minutes or perhaps only when the CPU utilization drops down below some throughput
(say below 50 percent).
Deadlock Presentation:
a) Elimination of Mutual Exclusion
b) Elimination Hold and wait
c) Elimination of No-preemption
d) Elimination circular wait.
22
Written By: Mahesh, Nitin, Sunil.
Operating Systems
Chapter – 4
Memory Management
- The Basic Method:- Paging Hardware:-The following figure illustrates the hardware
support for paging memory management scheme.
- With this approach, the addresses generated by CPU contain two components.
1) Page number 'p' (in which desired instruction exists)
2) Offset „d‟ in that page 'p' [the exact location (distant) of the desired instruction that
page only].
- this hardware to perform the mapping from user (logical) address space to physical
memory) address space.
24
Written By: Mahesh, Nitin, Sunil.
Operating Systems
- These registers may be either special hardware registers or some reserved area in main
memory.
- Note that the page tables are much smaller in size than the given address space.
- Accordingly, the page table consists of the base address (starting address) of each page
(in physical main memory).
Disadvantages:
1) Overhead associated with each address translation.
2) Extra memory or Registers required to maintain page Tables.
3) Internal Fragmentation and/or Page breakage.
- The following figures depict user’s view of a program (i.e the program' address
space) as a collection of variable-sized segments:
25
Written By: Mahesh, Nitin, Sunil.
Operating Systems
Advantages of swapping:
1) Swapping an increase the degree of multiprogramming, since, swapping can at least
perform load-balancing on an oversubscribed time sharing.
Disadvantages of swapping:
1) Swapping a process, which is blocked for I/O, is a tedious job, since I/O operation may
access user memory asynchronously for I/O buffers.
27
Written By: Mahesh, Nitin, Sunil.
Operating Systems
Two types:
1) Hardware support:- In demand paging memory allocation systems-only part of the
demand handling is performed by the Hardware.
- Majority of the work will be carried out by O.S with the help of paging algorithms.
- The high speed disk space reserved for the purpose of swapping demand pages is
reffered to as Backing store or swap space & the secondary disk storage is termed Swap
Device.
28
Written By: Mahesh, Nitin, Sunil.
Operating Systems
2) Demand pages allocation: Here virtual memory is larger than physical main memory.
a program or job occupies 8 pages in logical physical out of which 4 pages are
accommodate in physical main memory. On demand however, the locking store-hard
disk contains all 8 pages of job‟s virtual address space as contiguous disk blocks.
- Here the page number is used as an index into „Page table‟. The page table provides
mapping of each logical page into physically allocated frame or memory block (page
frame) in physical main memory.
Ans:- We shall list out now the procedural steps being followed by an operating system
while handling a page fault:-
a) Determine whether the memory reference to this page is valid or invalid cross
checking an internal table associated with process control block (PCB).
- If this reference is Invalid, terminate the process. Otherwise, index the page table for the
corresponding page frame in main memory,
b) For the valid reference suppose indexing the page table returns an invalid bit "0" or a
"i" for missing page in main memory, then the hardware generates page fault trap
interrupt to the operating system (OS).
c) The operating system (OS) now performs the action of accessing the secondary
memory - hard disk and acquires (read) the needed or demanded page.
29
Written By: Mahesh, Nitin, Sunil.
Operating Systems
d) The operating system (OS) finds a free page frame in physical main memory and
swaps-in (loads) the missed page from backing store into one such free frame. - To
conclude, this is how the Demand Paging scheme is able to execute a process although
some portions (pages) of it are not currently resident in Main Memory.
Internal Fragmentation:
- The problem of external fragmentation may be solved using compaction technique and
paging technique.
- In technique, the job‟s address space is sub-divided into equal sized pages (1000bytes).
So memory allocated to a process may be little larger than requested memory size.
- If the uniform page size of 1000 bytes each say… Then individual pages are left blank
with differences of 10 bytes, 15 bytes, bytes, 110 bytes etc., respectively.
- This differential (free) left - out memory holes its respective pages is termed internal
Fragments and said to cause Internal Fragmentation.
- This kind of wastage in the last page is also referred to as Page breakage.
- To conclude, internal fragmentation occurs whenever page size does not match the
process's requested memory occupation size.
30
Written By: Mahesh, Nitin, Sunil.
Operating Systems
As processes (say p1,p2, p3,p4,p5….) enters & exit main from memory. The single large
contiguous memory space called Hole is broken down and scattered into number of
uneven sized holes.
- As the time passes i.e., more and more process are loaded into and released from main
memory, the external fragmentation develops.
- Enough memory space available but scattered here and there as unusable memory
chunks or memory fragments of exact sizes.
Chapter – 5
File Management
ii) Size: - The current size of file tells how big the file is at present. That is data
occupation or file contents in that file is indicated in terms of bytes.
iii) Date, time and user-identification:- These attributes keep the track as to when the
file was created. Its last modification or usage most recently accessed and / or modified
for its end users. Such information is required to monitor the protection, security. Etc..
iv) Identifier: It is distinguishing number that uniquely the file within the file system.
This identifier is not accessible or not visible to end –users.
vi) Location: It is pointer to the storage device & to the location of the file on that
device.
vii) Protection: It suggests control right‟s such as who is allowed to perform reading a
file. Writing a file etc…
32
Written By: Mahesh, Nitin, Sunil.
Operating Systems
ii) Open a file: Most systems enforces programmer to open a file explicitly with an open
system call well before using that file.
- It enables system to fetch necessary attributes of that file.
iii) Read a file: The read system call reads data from the given open file at current -file_
position pointer.
- The caller must specify the file pointer or the name of the file (location) and how much
data (bytes, lines) to be read from that file and where exactly the hence read data must be
copied (the buffer location).
ii) Write a file: The write system call writes data to the given file which is opened in
write mode (or append mode). The writing takes place again at current write pointer.
Usually, the system maintains a write pointer to the location in the file as to where
exactly the next write to take place
iii) Append a file: The append system call can only add the supplementary data to the
end of the file. For which caller must open a file in append mode. File appending
operation is restricted form of write operation.
iv) Delete a file:- The delete system call erases the specified file and releases the file
space to the disk: Whenever the file is no longer needed, file deletion operation can be
carried out and the deleted file name will disappear from the directory entry.
v) Seek a file (position or Reposition within a file): The seek system call perform file
seek operation and there by repositions the current file pointer to a specific value (place)
in the file.
After seek operation data can be read from or written to the file from this new position.
Seek operation is an useful choice for updating random access files.
vi) Truncate (contents of) a file: Whenever the structure of the file (its attributes both in
number and field size) is to be preserved and only its contents are to be erased then
truncate system call will do the same. So that file size is truncated to zero and file space
is returned to disk.
vii) Rename a file: The rename system call allow users to change the name of an existing
file. It's not file copying operation.
viii) Close a file: The close system call closes the file and delinks it from main memory
and disk addresses and internal descriptors / tables.
33
Written By: Mahesh, Nitin, Sunil.
Operating Systems
ii) Regular Files:- This is either ASCII files or binary files in general. ASCII files
contain lines of text data (strings of characters).
Binary files exist in two forms i.e., the files with .com and .exe extensions.
Whereas ASCII file contents can be displayed and printed too... Further such file contents
can be edited and interpreted up to the end user convenience.
iii) Character Special Files: emphasize serial input and output and are used to model
serial I/O devices such as video terminals, printers and network I/O. Serial I/O suggest
character-by -character input / output.
iv) Block Special Files: This are used to model disks. Since a disk is written in blocks
(physical records). i.e., block-by-block input/output.
ii) Record Streams kind of File Structure: A High level file system provides record-
streams translation.
iii) Tree structured kind of File Structure: Here file is organized into tree of records.
Records can be of both varying lengths and same lengths.
i) Sequential Access: Sequential access to the file records is defend by current file
position & the current position pointer index records sequence by successive addition to
locate the next record in sequence.
- Sequential access suggest the processing to take place by accessing the records as they
appear in sequential i.e. retrieve one record after another that are all adjacent to each
other.
34
Written By: Mahesh, Nitin, Sunil.
Operating Systems
ii) Direct Access: In direct access, the file is organized as a numbered sequence of fixed
length logical records. Such files allow arbitrary blocks to be read or write.
- The silent feature of direct access method is to provide immediate Random access to
any information.
- Here file must contain new parameter called Block number.
iii) Indexed sequential Access : Combining Sequential access and direct access using
table of indexes to form which is known as the „Indexed sequential Access‟ and indexed
sequential files.
- When a index is created, an index record for each block in the ordered file contains
search key field and pointer to one or more records of individual blocks
35
Written By: Mahesh, Nitin, Sunil.
Operating Systems
3. a) Consider the following set of processes with the length of CPU burst time given in
Milliseconds.
i. Draw Gantt chart illustrating the execution of these processes using pre-emptive SJF,
FCFS and routing robin (quantum =4) scheduling algorithms.
ii. Calculate average waiting time foe each of the scheduling algorithm.
iii. What is the turn around time for process P1 in each of the scheduling algorithm?
b) What is CPU scheduling? Explain the criteria for comparing CPU scheduling algorithm.
8+8=16
4. a) What is critical region? Explain readers and writers problem.
b) Explain the strategies for dealing with deadlocks.
c) Explain banker‟s algorithm. 8+4+4=16
5. a) Consider the following snaphot of a system with 5 processes P1 to P5 and 4 resource types
R1 to R4 have instances R1 , R 2 , R 3 , R 4 = 8, 5, 9, 7 .
Allocation Max
R1 R 2 R 3 R 4 R1 R 2 R 3 R 4
P1 2 0 1 1 P1 3 2 2 4
P2 0 1 2 1 P2 1 2 5 2
P3 4 0 0 3 P3 5 1 1 5
P4 0 2 1 0 P4 1 5 3 0
P5 1 0 3 0 P5 3 0 3 3
36
Written By: Mahesh, Nitin, Sunil.
Operating Systems
37
Written By: Mahesh, Nitin, Sunil.
Operating Systems
1. a) What is an operating system? Explain Distributed and real time systems. 8+8=16
b) Explain various operating system services and system calls.
4. a) What is Scheduling? What are the criteria for CPU scheduling algorithm? 8+8=16
b) Consider the following set of processes with the length of CPU burst time and arrival time given in
milli seconds.
Process Priority Burst time
P1 3 3
P2 1 1
P3 2 3
P4 4 4
P5 5 2
The processes are assumed to arrived in the order P1, P2, P3, P 4 & P5.
i. Draw Gantt chart illustrating the execution of these processes using Fc Fs, SJF a non preemptive
Priority ( a smaller priority number implies a high priority) and routing robin ( RR) (quantum
=1) scheduling algorithms.
ii. What is the turn around time of each process for each of the scheduling algorithm?
iii. What is the waiting time of each process for each of the scheduling algorithm?
38
Written By: Mahesh, Nitin, Sunil.
Operating Systems
6. a) What is page fault? What are the steps following in handling a page fault? Explain with neat
diagram. 8+8=16
b) Consider the following page reference string : 7,0,1,2,0, 3,4,2,3,0,3,2,1,2,0,1,7,0,1.
Find the number of page faults in LRU, FIFO and optimal replacement algorithm (Assumption: 3
frames).
39
Written By: Mahesh, Nitin, Sunil.
Operating Systems
3. a) Consider the following set of processes with the length of CPU burst time and arrival time given in
milli seconds.
Process Burst time Priority
P1 ………. 24 2
P2 ………. 3 0
P3 ………. 3 1
i. Draw Gantt chart illustrating the execution of these processes using FCFS, SJF, non preemptive
Priority , RR (quantum =5 milliseconds).
ii. What is the waiting time and turn around time for each process of each of the scheduling
algorithm
5. a) Consider a system 5 processes p0 through p4 and 3 resource type A, B, C. resource type A has 10
instances, B has 5 instances and C had 7 instances.
40
Written By: Mahesh, Nitin, Sunil.
Operating Systems
Allocation Max
A B C A B C
P0 ……. 0 1 0 P0 …… 7 5 3
P1 …… 2 0 0 P1 ………. 3 2 2
P2 …...... 3 0 2 P2 ……. 9 0 2
P3 ……… 2 1 1 P3 ………. 2 2 2
P4 ……… 0 0 2 P4 ………. 4 3 3
41
Written By: Mahesh, Nitin, Sunil.
Operating Systems
II. a) Define a process. Explain the states transition diagram for process.
b) Explain multiprocessor system.
c) Explain in detail about PCB.
(6+4+6=16)
The processes are assumed to have arrived in the order P1, P2, P3 all at time
i) Draw Gantt chart illustrating the execution of these processes using FCFS, SJF, RR (Quantum =4)
Scheduling.
(4+4+8=16)
IV. a) What is critical section problem? Explain the requirements to solve the critical section
problem.
b) Explain the Banker‟s algorithm (multiple process solution).
c) What is Semaphore? Explain dinning philosophers problem.
(4+8+4+16)
V. a) State and explain the condition that must hold simultaneously for a system to be in deadlock
state.
b) Consider a system 5 processes p0 through P4 and 3 resource type A, B,C. Resources type A
has 10 instances B has 5 instances and C had 7 instances.
42
Written By: Mahesh, Nitin, Sunil.
Operating Systems
(8+8=16)
VIII. Write short notes on any four:
a) Distributed system
b) Parallel processing
c) RR Scheduling
d) Deadlock avoidance
e) Demand paging
f) Directory structure.
(4 x4=16)
43
Written By: Mahesh, Nitin, Sunil.
Operating Systems
II. a) Define a process. Explain various in process control block (PCB) in detail.
b) What is thread? Explain benefits and multithreading models.
(8+8=16)
The processes are assumed to have arrived in the order P0, P1, P2
i. Draw Gantt chart illustrating the execution of these processes using FCFS, SJF, Priority and RR
(quantum =5 milliseconds).
ii. Calculate average waiting time and turn around time. ( 6+10=16)
V. a) Explain paging.
b) Explain segmentation with example.
c) Consider the following page reference string :
1,2,3,4,1,2,5,1,2,3,4,5.
How many page faults would occur for the optimal, FIFO and LUR replacement algorithms,
assuming three frames. (4+6+6=16)
44
Written By: Mahesh, Nitin, Sunil.
Operating Systems
b) What is deadlock? Explain the necessary conditions for its occurrence. (10+6=16)
VII. a) Consider a system 5 processes p0 through P4 and 3 resource type A, B,C. Resources type A
has 10 instances B has 5 instances and C had 7 instances.
b) Explain with an example how resource allocation graph is used to describe deadlock.
(10+6=16)
(4 X 4=16)
8. Write short notes on any four:
a) State transition diagram for process.
b) Multiprocessor system.
c) Multilevel queue scheduling.
d) Semaphores.
e) Schedulers.
45
Written By: Mahesh, Nitin, Sunil.
Operating Systems
3. a) Consider the following set of processes with the length of CPU burst time in milli seconds and
priority.
Process Burst time Priority
P1 6 1
P2 8 3
P3 7 0
P4 3 2
The processes are assumed to arrived in the order P1, P2, P3, P 4.
i. Draw Gantt chart illustrating the execution of these processes using FCFS, SJF, Priority and
Round Robin (Time Quantum =4 milli seconds).
ii. Calculate average waiting time and average turn around time.
iii. Specify which algorithm results in minimal average waiting time.
46
Written By: Mahesh, Nitin, Sunil.
Operating Systems
47
Written By: Mahesh, Nitin, Sunil.