Unit-3 Os CSBS
Unit-3 Os CSBS
Unit-3 Os CSBS
Unit: 3
Work Experience
Education Publications
• NIET, Gr Noida From Nov 2021 to till date
• GNIOT, Gr Noida From Oct 2019 to Nov 2021 • M.Tech (AKTU, Lucknow) Total: 04
• TIAS, Delhi From Jan 2019 to July 2019 • B.Tech (AKTU, Lucknow) International: 2 (DRDO, Delhi)
• SRMSCET, Bareilly From Jan 2017 to Nov 2017
• PHD (pursuing Jamia Millia National: 2
Islamia, Delhi)
1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering fundamentals, and
an engineering specialization for the solution of complex engineering problems.
2. Problem analysis: Identify, formulate, research literature, and analyze complex engineering problems
reaching substantiated conclusions using first principles of mathematics, natural sciences, and engineering
sciences.
3. Design/development of solutions: Design solutions for complex engineering problems and design
system components or processes that meet the specified needs with appropriate consideration for public
health and safety, and cultural, societal, and environmental considerations.
4. Conduct investigations of complex problems: Use research based knowledge and research methods
including design of experiments, analysis and interpretation of data, and synthesis of information to provide
valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern engineering
and IT tools, including prediction and modeling to complex engineering activities, with an understanding of
the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess societal,
health, safety, legal and cultural issues and the consequent responsibilities relevant to the professional
engineering practice.
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 11
Program Outcome
17. Environment and sustainability: Understand the impact of the professional engineering solutions in
societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable
development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of the
engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader in diverse
teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the engineering
community and with the society at large, such as, being able to comprehend and write effective reports and
design documentation, make effective presentations, and give and receive clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the engineering and
management principles and apply these to one’s own work, as a member and leader in a team, to manage
projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change
OPERATING SYSTEM(ACSBS-403)
CODE PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
CO1 3 3 2 2 1 2 - 2 3 2 2 3
CO2 3 3 3 2 2 3 2 2 3 - 1 3
CO3 3 3 2 2 2 2 2 2 2 3 1 3
CO4 3 2 2 3 1 2 2 - 2 - 2 3
CO5 3 1 2 2 2 2 - - 2 2 2 3
PSO1: Apply technical and business knowledge to solve complex problems and face
current business challenges.
PSO2: Explore modern tools and technologies and apply the knowledge to design and
develop solutions for betterment of the society.
CO1 2 1 2 2
CO2 2 2 1 2
CO3 2 3 3 2
CO4 2 2 1 2
CO5 2 2 2 2
PEO1: Engage in successful professional practices in emerging areas of computer science and
business systems and pursue higher education and research.
PEO2: Adapt easily to dynamically changing environment, applying their knowledge in technology
abstraction and common business principles.
PEO3: Demonstrate effective business communication with innovation mindset who can effectively
work in a team and exhibit strong ethics and life values to serve the society.
• Memory hierarchy
• Cache Organization
• Interrupt
• Registers
• Associative memory
For Computer Engineers/Students, it important that they must be aware about the Operating System and
its task because operating system is the first things that is required to communicated with hardware of
computer system like mouse, monitor, mother board, printer, etc. Operating System provides an
environment to users where they can install many more application software to perform their specific
tasks. In short Operating System acts as an interface between Users and Hardware of Computer System.
Operating System also perform the task of Memory Management, Processor Management, Device
Management, File Management, Security Control over system performance, Job accounting, Error
detecting aids and Coordination between other software and users. Some popular Operating Systems
include Linux Operating System, Windows Operating System, VMS, OS/400, AIX, z/OS, etc.
This subject helps students to know about the Operating System in detail and understand the management
of different resources like memory, disk management, process scheduling etc.
https://www.youtube.com/watch?v=mXw9ruZaxzQ
https://www.youtube.com/watch?v=vBURTt97EkA
• Concurrent processes,
• precedence graphs,
• Critical Section,
• Race Conditions,
• Mutual Exclusion,
• Hardware Solution,
• Semaphores,
• Strict Alternation, Peterson’s Solution,
• The Producer / Consumer Problem,
• Peterson’s solution,
• Lamport Bakery solution,
• Semaphores,
• Test and Set operation Event Counters, Monitors, Message Passing,
• A critical section is a code segment that accesses shared variables and has to be executed as an
atomic action.
• It means that in a group of co-operating processes, at a given point of time, only one process
must be executing its critical section.
• If other processes also want to execute its critical section, it must wait until the first one
finishes.
• Critical section: It is the part of the program where shared resources are accessed by various
processes.
• It is the place where shared variable, resources are placed.
• A solution to the critical section problems must satisfy the following three conditions:
1. Mutual exclusion
2. Progress
3. Bounded waiting
4. No assumption related to H/W speed
1. Mutual exclusion Out of a group of co-operating processes, only one process can be in its
critical section at a given point of time.
2. Progress: If no process is in its critical section and if one or more process wants to execute in
critical section than one of these process must be allowed to get into its critical section.
3. Bounded waiting: After a process makes a request for getting into its critical section, there is
a limit for how many other processes can get into their critical section, before this process’s
request is granted. So after the limit time is reached, system must grant the process permission
to get into its critical section.
4. No assumption related to H/W speed
1. A race condition is a condition when there are many processes and every process shares the
data with each other and accessing the data concurrently, and the output of execution depends
on a particular sequence in which they share the data and access.
2. To prevent the race condition, we need to ensure that only one process can access the shared
data at a time. This is the main reason why we need to synchronize the processes. we can
describe the race condition as follows;
• For example, there are two processes P1 and P2 and both P1 and P2 processes are willing to
call the function bankAccount concurrently.
• suppose P1 call the function of bank account by passing the parameters of the function and the
value of the parameter is 200 and similarly, P2 call the function of the bankAccount by passing
the value of the parameter as 100.
• Now, let’s suppose that the previous value of the shared variable is 1100. in this example we
are resuming that process P1 and P2 are executed on the different processors.
•.
Mutual exclusion Out of a group of co-operating processes, only one process can be in its critical
section at a given point of time.
• When two or more process cooperates with each other, their order of execution must be
preserved otherwise there can be conflicts in their execution and inappropriate outputs can be
produced.
• A cooperative process is the one which can affect the execution of other process or can be
affected by the execution of other process. Such processes need to be synchronized so that their
order of execution can be guaranteed.
Semaphore was proposed by Dijkstra in 1965 which is a very significant technique to manage
concurrent processes by using a simple integer value, which is known as a semaphore.
Semaphore is simply an integer variable that is shared between threads.
This variable is used to solve the critical section problem and to achieve process synchronization
in the multiprocessing environment.
Semaphores are of two types:
Binary Semaphore –
• This is also known as mutex lock.
• It can have only two values – 0 and 1.
• Its value is initialized to 1.
• It is used to implement the solution of critical section problems with multiple processes.
Counting Semaphore –
• Its value can range over an unrestricted domain.
• It is used to control access to a resource that has multiple instances.
Advantages of semaphore
• The mutual exclusion principle is followed when you use semaphores because semaphores
allow only one process to enter into the critical section.
• Here, you need not verify that a process should be allowed to enter into the critical section
or not. So, processor time is not wasted here.
Disadvantages of semaphore
• While using semaphore, if a low priority process is in the critical section, then no other
higher priority process can get into the critical section. So, the higher priority process has
to wait for the complete execution of the lower priority process.
• The wait() and signal() functions need to be implemented in the correct order. So, the
implementation of a semaphore is quite difficult.
The following are the problems that might occur in the Producer-Consumer:
• The producer should produce data only when the buffer is not full. If the buffer is full, then the
producer shouldn't be allowed to put any data into the buffer.
• The consumer should consume data only when the buffer is not empty. If the buffer is empty,
then the consumer shouldn't be allowed to take any data from the buffer.
• The producer and consumer should not access the buffer at the same time.
Problem Statement – We have a buffer of fixed size. A producer can produce an item and can place
in the buffer. A consumer can pick items and can consume them. We need to ensure that when a
producer is placing an item in the buffer, then at the same time consumer should not consume any
item. In this problem, buffer is the critical section.
To solve this problem, we need two counting semaphores – Full and Empty.
“Full” keeps track of number of items in the buffer at any given time and
“Empty” keeps track of number of unoccupied slots.
Solution
To solve this problem, we need two counting semaphores – Full and Empty.
“Full” keeps track of number of items in the buffer at any given time and
“Empty” keeps track of number of unoccupied slots.
Intialize
Mutex = 1
full = 0 // intially all slots are empty. Thus full slots are 0
empty = n // All slots are empty intially
do{ • When producer produces an item then the value of “empty” is reduced by
1 because one slot will be filled now.
• The value of mutex is also reduced to prevent consumer to access the
//produce an item buffer.
• Now, the producer has placed the item and thus the value of “full” is
wait(empty); increased by 1.
wait(mutex); • The value of mutex is also increased by 1 because the task of producer has
been completed and consumer can access the buffer.
//place in buffer
signal(mutex);
signal(full);
}while(true)
do{ • As the consumer is removing an item from buffer, therefore the value of
“full” is reduced by 1 and
• The value is mutex is also reduced so that the producer cannot access the
wait(full); buffer at this moment.
wait(mutex); • Now, the consumer has consumed the item, thus increasing the value of
“empty” by 1.
// remove item from • The value of mutex is also increased so that producer can access the buffer
buffer now.
signal(mutex);
signal(empty);
// consumes item
}while(true)
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 55
Lamport Bakery solution
The Bakery algorithm is one of the simplest known solutions to the mutual exclusion
problem for the general case of N process.
Bakery Algorithm is a critical section solution for N processes.
The algorithm preserves the first come first serve property.
•Before entering its critical section, the process receives a number. Holder of the
smallest number enters the critical section.
•If processes Pi and Pj receive the same number
•The numbering scheme always generates numbers in increasing order of
enumeration; i.e., 1, 2, 3, 3, 3, 3, 4, 5, …
Explanation –
Firstly the process sets its “choosing” variable to
be TRUE indicating its intent to enter critical
section.
Then it gets assigned the highest ticket number
corresponding to other processes.
Then the “choosing” variable is set to FALSE
indicating that it now has a new ticket number.
This is in-fact the most important and confusing
part of the algorithm.
It is actually a small critical section in itself !
• Explanation –
The very purpose of the first three lines is that
if a process is modifying its TICKET value
then at that time some other process should not
be allowed to check its old ticket value which
is now obsolete.
• This is why inside the for loop before checking
ticket value we first make sure that all other
processes have the “choosing” variable as
FALSE.
• After that we proceed to check the ticket
values of processes where process with least
ticket number/process id gets inside the critical
section. The exit section just resets the ticket
value to zero.
The essential characteristic is that this instruction is executed atomically. So, if two Test And Set
(C) instructions are executed simultaneously (each on a different CPU), they will be executed
sequentially in some arbitrary order. we can implement mutual exclusion by declaring a Boolean
variable lock, initialized to false, if the machine supports the Test And Set () instruction. The
structure of process P, is shown in below.
Example
do {
while (test and set(&lock)) ;
/* do nothing */
/* critical section */
lock = false;
/* remainder section */
}
while (true);
The Event Counter counts transitions of the clock source and the gating mechanism is simply an
enable switch telling it to either count or ignore the signal. Upon initialization, the count is set to
zero counts and increments plus one on each clock transition. In the simplest form it counts and can
be reset to zero.
1.It is the collection of condition variables and procedures combined together in a special kind of
module or a package.
2.The processes running outside the monitor can’t access the internal variable of the monitor but can
call procedures of the monitor.
3.Only one process at a time can execute code inside monitors.
Syntax:
Wait operation
x.wait() : Process performing wait operation on any condition variable are suspended. The
suspended processes are placed in block queue of that condition variable.
Note: Each condition variable has its unique block queue.
Signal operation
x.signal(): When a process performs signal operation on condition variable, one of the blocked
processes is given chance.
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 62
Message Passing
Message Passing Model
Multiple processes can read and write data to the message
queue without being connected to each other. Messages
are stored on the queue until their recipient retrieves them.
Message queues are quite useful for interprocess
communication and are used by most operating systems.
void philosopher(int i)
{
while (TRUE)
{
think(); /* thinking */
take_forks(i); /* get two forks, block */
eat(); /* eating */
put_forks(i); /* give up forks */
}
}
void take_forks(int i)
{
wait(mutex);
state[i] = HUNGRY;
test(i); // try getting 2
forks signal(mutex);
if state[i] != EATING
wait(s[i]); // block if no forks acquired
}
void test(int i)
{
if ( state[i] == HUNGRY && state[LEFT] != EATING && state[RIGHT] !=
EATING )
{
state[i] = EATING;
signal(s[i]);
}
}
void put_forks(int i)
{
wait(mutex);
state[i] = THINKING;
test(LEFT);
test(RIGHT);
signal(mutex);
}
• Sleeping Barber Barber shop with one barber, one barber chair and N chairs to wait in.
• When no customers the barber goes to sleep in barber chair and must be woken when a
customer comes in.
• When barber is cutting hair new customers take empty seats to wait, or leave if no vacancy.
• Program barber and customers so no race condition exists.
void barber()
{
while (TRUE)
{
wait(customers); // barber is waiting for customer if there is no customer he asleep//
wait(mutex);
waiting = waiting – 1;
signal(barbers);
signal(mutex); cut_hair();
}
} Sleeping Barb
void customer()
{
wait(mutex);
if ( waiting < CHAIRS )
{
waiting = waiting + 1;
signal(customers);
signal(mutex);
wait(barbers);
get_haircut();
}
else
{ signal (mutex); }
}
All the processes that use the shared memory model need to make sure that they are not writing to the
same memory location.
Shared memory model may create problems such as synchronization and memory protection that need
to be addressed.
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 78
Process Generation
The process scheduling is the activity of the process manager that handles the removal of the
running process from the CPU and the selection of another process on the basis of a particular
strategy.
Process scheduling is an essential part of a Multiprogramming operating systems. Such operating
systems allow more than one process to be loaded into the executable memory at a time and the
loaded process shares the CPU using time multiplexing.
Categories of Scheduling
There are two categories of scheduling:
1.Non-preemptive: Here the resource can’t be taken from a process until the process completes
execution. The switching of resources occurs when the running process terminates and moves to a
waiting state.
2.Preemptive: Here the OS allocates the resources to a process for a fixed amount of time. During
resource allocation, the process switches from running state to ready state or from waiting state to
ready state. This switching occurs as the CPU may give priority to other processes and replace the
process with higher priority with the running process.
•A set of processes is in a deadlock state if every process in the set is waiting for an
event (release) that can only be caused by some other process in the same set.
Example
-System has 2 disk drives
-P1 and P2 process each hold one disk drive and each needs another one
2. Hold and wait: a process holding at least one resource is waiting to acquire additional resources
held by other processes .
3. No preemption: a resource can be released only voluntarily by the process holding it, after that
process has completed its task .
4. Circular wait: there exists a set {P0, P1, …, Pn} of waiting processes such that P0 is waiting
for a resource that is held by P1, P1 is waiting for a resource that is held by P2, …, Pn–1 is
waiting for a resource that is held by Pn, and Pn is waiting for a resource that is held by P0.
A resource allocation graph is a set of vertices V and a set of edges E such that:
•V is partitioned into two types:
P = {P1, P2, …, Pn}, the set consisting of all the processes in the system
R = {R1, R2, …, Rm}, the set consisting of all resource types in the system
• Process
• Pi requests instance of Rj
Pi
• Pi is holding an instance of Rj
Pi
Prevention
◦ Ensure that the system will never enter a deadlock state
Avoidance
◦ Ensure that the system will never enter an unsafe state
Detection
◦ Allow the system to enter a deadlock state and then recover
Do Nothing
◦ Ignore the problem and let the user or system administrator respond to
the problem; used by most operating systems, including Windows and
UNIX
• if no resource were ever assigned to a single process exclusively ,we would never have deadlock.
• Shared entities (read only files) don't need mutual exclusion (and aren’t susceptible to deadlock.)
• Require a process to request and be allocated all its resources before it begins execution
• allow a process to request resources only when the process has none
• If a process that is holding some resources requests another resource that cannot be immediately
allocated to it, then all resources currently being held are released
• Pi → Rj → Pj → Rk
• A process will be restarted only when it can regain its old resources, as well as the new ones that it
is requesting.
• Allow preemption - if a needed resource is held by another process, which is also waiting on some
resource, steal it. Otherwise wait.
4. Circular Wait :
• To violate circular wait, we can assign a priority number to each of the resource. A process can't
request for a lesser priority resource. This ensures that not a single process can request a resource
which is being utilized by some other process and no cycle will be formed.
• Requires that the system has some additional a priori information available.
• Simplest and most useful model requires that each process declare the maximum number of resources
of each type that it may need.
• The deadlock-avoidance algorithm dynamically examines the resource-allocation state to ensure that
there can never be a circular-wait condition.
• Resource-allocation state is defined by the number of available and allocated resources, and the
maximum demands of the processes.
• System is in safe state if there exists a sequence <P1, P2, …, Pn> of all the processes in the
systems such that for each Pi, the resources that Pi can still request can be satisfied by currently
available resources + resources held by all the Pj, with j < I
That is:
• If Pi resource needs are not immediately available, then Pi can wait until all Pj have finished
• When Pj is finished, Pi can obtain needed resources, execute, return allocated resources, and
terminate
Assignment
edge Request
edge
Claim Claim
edge edge
Assignment
edge Request
edge
Assignment
Claim edge
edge
• The request can be granted only if converting the request edge to an assignment edge does not result
in the formation of a cycle in the resource allocation graph
• Multiple instances
• Each process must a priori claim maximum use
• When a process requests a resource it may have to wait
• When a process gets all its resources it must return them in a finite amount of time
4.If Finish [i] == true for all i, then the system is in a safe state
1. If Requesti Needi go to step 2. Otherwise, raise error condition, since process has
exceeded its maximum claim
2. If Requesti Available, go to step 3. Otherwise Pi must wait, since resources are not
available
3. Pretend to allocate requested resources to Pi by modifying the state as follows:
Available = Available – Requesti;
Allocationi = Allocationi + Requesti;
Needi = Needi – Requesti;
•If safe the resources are allocated to Pi
•If unsafe Pi must wait, and the old resource-allocation state is restored
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 100
Example (Cont.)(CO3)
Need
ABC
P0 743
P1 122
P2 600
P3 011
P4 431
• The system is in a safe state since the sequence < P1, P3, P4, P2, P0>
satisfies safety criteria
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 101
Example: (CO3)
P1 Request (1,0,2)
• Check that Request Available (that is, (1,0,2) (3,3,2) true
Allocation Need Available
ABC ABC ABC
P0 010 743 230
P1 302 020
P2 302 600
P3 211 011
P4 002 431
• Executing safety algorithm shows that sequence < P1, P3, P4, P0, P2> satisfies safety
requirement
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 102
Deadlock Detection(CO3)
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 103
Single Instance of Each Resource Type(CO3)
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 104
Single Instance of Each Resource Type(CO3)
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 105
Several Instances of a Resource Type(CO3)
•Available: A vector of length m indicates the number of available resources of each type
•Allocation: An n x m matrix defines the number of resources of each type currently allocated
to each process
•Request: An n x m matrix indicates the current request of each process. If Request [i][j] = k,
then process Pi is requesting k more instances of resource type Rj.
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 106
Detection Algorithm(CO3)
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 107
Recovery from Deadlock(CO3)
Process Termination :
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 108
Recovery from Deadlock(CO3)
Resource Preemption :
•Rollback – return to some safe state, restart process for that state
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 109
Concurrent Processing
• Concurrent processing is a computing model in which multiple processors execute instructions
simultaneously for better performance.
• Concurrent means, which occurs when something else happens.
• The tasks are broken into sub-types, which are then assigned to different processors to perform
simultaneously, sequentially instead, as they would have to be performed by one processor.
• Concurrent processing is sometimes synonymous with parallel processing.
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 110
Concurrent Process
• Multiprogramming Environment :
In multiprogramming environment, there are multiple tasks shared by one processor. while a
virtual concert can be achieved by the operating system, if the processor is allocated for each
individual task, so that the virtual concept is visible if each task has a dedicated processor. The
multilayer environment shown in figure.
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 111
Concurrent Process
• Multiprocessing Environment :
In multiprocessing environment two or more processors are used with shared memory. Only one
virtual address space is used, which is common for all processors. All tasks reside in shared
memory. In this environment, concurrency is supported in the form of concurrently executing
processors. The tasks executed on different processors are performed with each other through
shared memory. The multiprocessing environment is shown in figure.
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 112
Concurrent Process
• Distributed Processing Environment :
In a distributed processing environment, two or more computers are connected to each other by a
communication network or high speed bus. There is no shared memory between the processors
and each computer has its own local memory. Hence a distributed application consisting of
concurrent tasks, which are distributed over network communication via messages. The
distributed processing environment is shown in figure.
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 113
Monitor (CO3)
• It is a synchronization technique that enables threads to mutual exclusion and the wait() for a given
condition to become true. It is an abstract data type.
• It has a shared variable and a collection of procedures executing on the shared variable. A process
may not directly access the shared data variables, and procedures are required to allow several
processes to access the shared data variables simultaneously.
• At any particular time, only one process may be active in a monitor. Other processes that require
access to the shared variables must queue and are only granted access after the previous process
releases the shared variables.
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 114
Advantages and Disadvantages of Monitor (CO3)
Advantages
1.Mutual exclusion is automatic in monitors.
2.Monitors are less difficult to implement than semaphores.
3.Monitors may overcome the timing errors that occur when semaphores are used.
4.Monitors are a collection of procedures and condition variables that are combined in a special type
of module.
Disadvantages
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 115
Summary
Concurrent processes, precedence graphs, Critical Section, Race Conditions, Mutual Exclusion,
Hardware Solution, Semaphores, Strict Alternation, Peterson’s Solution, The Producer /
Consumer
Problem, Peterson’s solution, Lamport Bakery solution, Semaphores, Test and Set operation
Event
Counters, Monitors, Message Passing, Classical IPC Problems: Reader’s & Writer Problem,
Dinning
Philosopher Problem, Barber’s shop problem, Inter Process Communication models and
Schemes,
Process generation.
Definition, Necessary and sufficient conditions for Deadlock, Deadlock Prevention, Deadlock
Avoidance: Banker’s algorithm, Deadlock detection and Recovery.
Concurrent Programming: Critical region, conditional Critical region, Monitors, Concurrent
languages,
Communicating Sequential Process (CSP); Deadlocks - prevention, avoidance, detection and
recovery.
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 116
Daily Quiz
1. A solution to the problem of indefinite blockage of low – priority processes is ____________
A. Starvation
B. Wait queue
C. Ready queue
D. Aging
2. Round robin scheduling falls under the category of ____________
A. Non-preemptive scheduling
B. Preemptive scheduling
C. All of the mentioned
D. None of the mentioned
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 117
Daily Quiz
3. The processes that are residing in main memory and are ready and waiting to execute are kept
on a list called _________
A. job queue
B. ready queue
C. execution queue
D. process queue
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 118
Daily Quiz
5. The interval from the time of submission of a process to the time of completion is termed as
____________
A. waiting time
B. turnaround time
C. response time
D. throughput
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 119
Daily Quiz
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 120
Daily Quiz
10. A solution to the problem of indefinite blockage of low – priority processes is ____________
A. Starvation
B. Wait queue
C. Ready queue
D. Aging
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 121
Weekly Assignment 3
• Define PCB
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 122
Faculty Video Links, Youtube & NPTEL Video Links and Online Courses Details
Unit 1 Unit 3
• https://www.youtube.com/watch?v=783 • https://www.youtube.com/watch?v=UczJ7misUEk
KAB-tuE4
• https://www.youtube.com/watch?v=_IxqinTs2Yo
• https://www.youtube.com/watch?v=Bxx
2_aQVeeg
• https://www.youtube.com/watch?v=Za Unit 4
GGKFCLNc0 • https://www.youtube.com/watch?v=IwESijQs9sM
• https://nptel.ac.in/courses/106/105/106 • https://www.youtube.com/watch?v=-orfFhvNBzY
105214/ • https://www.youtube.com/watch?v=2OobPx246zg
&list=PL3-wYxbt4yCjpcfUDz-
Unit 2 TgD_ainZ2K3MUZ&index=10
• https://www.youtube.com/watch?v=NS Unit 5
hBeqTkXnQ • https://www.youtube.com/watch?v=AnGOeYJCv6
• https://www.youtube.com/watch?v=4h • https://www.youtube.com/watch?v=U1Jpvni0Aak
Cih9eLc7M
• https://www.youtube.com/watch?v=9YR
xhlvt9Zo
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 123
MCQ
1. Which of the following scheduling algorithms gives minimum average waiting time?
A. FCFS
B. SJF
C. Round – robin
D. Priority
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 124
MCQ
3. A system is in a safe state only if there exists a ____________
A. safe allocation
B. safe resource
C. safe sequence
D. all of the mentioned
4. Given a priori information about the ________ number of resources of each type that maybe
requested for each process, it is possible to construct an algorithm that ensures that the system will
never enter a deadlock state.
A. Minimum
B. Average
C. Maximum
D. approximate
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 125
MCQ
5. The switching of the CPU from one process or thread to another is called ____________
A. process switch
B. task switch
C. context switch
D. all of the mentioned
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 126
MCQ
A. Allocation – Available
B. Max – Available
C. Max – Allocation
D. Allocation – Max
8. For a deadlock to arise, which of the following conditions must hold simultaneously?
A. Mutual exclusion
B. No preemption
C. Hold and wait
D. All of the mentioned
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 127
MCQ
9. Which of the following is not the state of a process?
A. New
B. Old
C. Waiting
D. Running
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 128
Glossary Questions
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 129
Old Question Papers
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 130
Old Question Papers
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 131
Old Question Papers
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 132
Old Question Papers
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 133
Old Question Papers
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 134
Expected Questions for University Exam
1. Draw the labeled process state transition diagram with describing the various process states.
6. Define PCB.
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 135
Expected Questions for University Exam
9. Consider the following set of four processes, with the length of CPU
burst time given in milliseconds
Process Arrival Time Burst Time
P1 0 7
P2 2 4
P3 4 1
P4 5 4
Draw Gannt chart and find average waiting time and response time
using
• FCFS
• Round Robin (quantum=2)
• SJF and SRTF
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 136
Expected Questions for University Exam
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 137
Recap
Concurrent processes, precedence graphs, Critical Section, Race Conditions, Mutual Exclusion,
Hardware Solution, Semaphores, Strict Alternation, Peterson’s Solution, The Producer / Consumer
Problem, Peterson’s solution, Lamport Bakery solution, Semaphores, Test and Set operation Event
Counters, Monitors, Message Passing, Classical IPC Problems: Reader’s & Writer Problem,
Dinning
Philosopher Problem, Barber’s shop problem, Inter Process Communication models and Schemes,
Process generation.
Definition, Necessary and sufficient conditions for Deadlock, Deadlock Prevention, Deadlock
Avoidance: Banker’s algorithm, Deadlock detection and Recovery.
Concurrent Programming: Critical region, conditional Critical region, Monitors, Concurrent
languages,
Communicating Sequential Process (CSP); Deadlocks - prevention, avoidance, detection and
recovery.
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 138
References
Books :
1. Silberschatz, Galvin and Gagne, “Operating Systems Concepts”, Wiley
2. SibsankarHalder and Alex A Aravind, “Operating Systems”, Pearson Education
3. Harvey M Dietel, “ An Introduction to Operating System”, Pearson Education
4. D M Dhamdhere, “Operating Systems : A Concept basedApproach”, McGraw Hill.
5. Charles Crowley, “Operating Systems: A Design-Oriented Approach”, Tata McGraw Hill
Education”.
6. Stuart E. Madnick & John J. Donovan, “ Operating Systems”, Tata McGraw
3/13/2024 Ms. Rifa Nizam Khan ACSBS0403 Operating System Unit 3 139