You are on page 1of 22

ADVANCED OPERATING SYSTEMS

UNIT 1- BASICS OF OPERATING SYSTEMS

UNIT – 1 BASICS OF OPERATING SYSTEMS

Basics of Operating Systems: What is an Operating System? – Main frame


Systems –Desktop Systems – Multiprocessor Systems – Distributed Systems –
Clustered Systems –Real-Time Systems – Handheld Systems – Feature
Migration – Computing Environments -Process Scheduling – Cooperating
Processes – Inter Process Communication- Deadlocks –Prevention – Avoidance –
Detection – Recovery.

What is an Operating System?


 An operating system is a program/software that acts as an
interface between the user and the computer hardware and
controls the execution of all kinds of programs.
 Ex: Some popular Operating Systems are Ms-Dos, Windows, UNIX,
Linux, Mac OS, OS X, VMS, OS/400, AIX, z/OS, etc.

Classification Of Operating Systems:


 Single-User:
 Just allows one user to use the programs at one time.
 Multi-user:
 Allows two or more users to run programs at the same time.
 Some operating systems permit hundreds or even thousands of
users simultaneously.
 Multiprocessing :
 Supports running a program on more than just in one system.
 Multitasking :
 Allows multiple programs running at the same time.
 Single-tasking/Multithreading:
 Allows different parts of a single program running at any one time.
 Real time:
 Responds to input instantly. Operating systems such as DOS and
UNIX, do not work in real time.
 Real-time operating systems are used to control machinery,
scientific instruments and industrial systems.
Functions of an Operating System / Feature of Operating System:
 Memory Management
 Processor Management
 Device Management
 File Management
 Security
 Control over system performance
 Job accounting
 Error detecting aids
 Coordination between other software and users

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 1|Page
ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

Main frame Systems:


 It’s a IBM (International Business Machines) product.
 A mainframe operating system is a collection of programs that manage a
computer system's internal workings.
 Mainframe operating systems are different from other operating systems
in that they can host multiple operating systems on a single mainframe.
 Mainframes designed to handle very high volume of input and output
(I/O).
 It’s used at accounting, banking sectors, finance, healthcare and
government, scientific research.
 Some of the main operating systems for mainframes are z/OS, z/VM,
z/VSE, Linux for System z, and z/TPF.

Desktop Systems:
 Personal computers – computer system dedicated to a single
user.
 I/O devices – keyboards, mice, display screens, small printers.
 User convenience and responsiveness.
 Can adopt technology developed for larger operating system
often individuals have sole use of computer and do not need
advanced CPU utilization of protection features.
 May run several different types of operating systems
(Windows, MacOS, UNIX, Linux)

Multiprocessor Systems:
 In multiprocessor system, two or more processors work together.
In this system, multiple programs (more than one program) are
executed on different processors at the same time. This type of
processing is known as multiprocessing.
 Some operating systems have features of multiprocessing.
 UNIX is an example of multiprocessing operating system.
 Some versions of Microsoft Windows also support multiprocessing.
 Multiprocessor system is also known as parallel system.
 Mostly the processors of multiprocessor system share the common
system bus, clock, memory and peripheral devices.
 This system is very fast in data processing.

 Advantages of parallel system:


o Increased throughput
o Economical
o Increased reliability
 graceful degradation
 fail-soft systems

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 2|Page
ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

 The multiprocessor systems are further divided into two types;


o (i). Asymmetric multiprocessing system
o (ii). Symmetric multiprocessing system
 Asymmetric multiprocessing
o The multiprocessing system, in which each processor is
assigned a specific task, is known as Asymmetric
Multiprocessing System.
o For example, one processor is dedicated for handling user's
requests, one processor is dedicated for running application
program, and one processor is dedicated for running image
processing and so on. In this system, one processor works as
master processor, while other processors work as slave
processors.
o The master processor controls the operations of system. It
also schedules and distributes tasks among the slave
processors. The slave processors perform the predefined
tasks.
 Symmetric multiprocessing (SMP)
o The multiprocessing system, in which multiple processors
work together on the same task, is known as Symmetric
Multiprocessing System.
o In this system, each processor can perform all types of tasks.
All processors are treated equally and no master-slave
relationship exists between the processors.
o For example, different processors in the system can
communicate with each other. Similarly, an I/O can be
processed on any processor.
o However, I/O must be controlled to ensure that the data
reaches the appropriate processor. Because all the
processors share the same memory, so the input data given
to the processors and their results must be separately
controlled.
o Today all modern operating systems including Windows and
Linux provide support for SMP.
o It must be noted that in the same computer system, the
asymmetric multiprocessing and symmetric multiprocessing
technique can be used through different operating systems.

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 3|Page
ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

Distributed operating system:


 A distributed operating system (DOS) is an essential type of
operating system.
 Distributed systems use many central processors to server
multiple real-time applications and users.
 As a result, data processing jobs are distributed between the
processors.
 Distributed operating system is used to share data and files.
 Distributed applications are running on multiple computers linked
by communications
 The user can handle the data from different locations.
 Processers in a DOS communicate with each other through
communication lines like high speed buses.
Buses:
 A mechanism that transfer data between components inside
computers.
 Real-time example of DOS:

Types of DOS:
There are various types of Distributed Operating systems.
Some of them are as follows:
1. Client-Server System
2. Three-tier
3. N-tier
4. Peer -to-peer
1. Client server system:
 This type of system requires the client to request a resource,
after which the server gives the requested resource.
2. Three-tier:
 The information about the client is saved in the intermediate
tier rather than in the client, which simplifies development.
 This type of architecture is most commonly used in online
applications.
3. N-tier:
 N-tier system is used when the server application needs to
forward requests to additional enterprise services on the
network.

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 4|Page
ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

4. Peer-to-Peer Systems:
 The nodes play an important role in the systems
 This type of system contains nodes that are equal participants
in data sharing.
 Furthermore all the tasks are equally divided between all the
nodes.
 These nodes will interact with each other as required as
“shared resources”.
 To accomplish this is a network is needed.
Issues of distributed system:
1. Heterogeneity
2. Openness
3. Security
4. Scalability
5. Failure Handling
6. Concurrency
7. Transparency

Clustered Systems:
 A cluster is a group of servers and other resources that act like a
single system.
 Cluster systems are similar to parallel systems because
both systems use multiple CPUs.
 The primary difference is that clustered systems are
made up of two or more independent systems linked
together.
 They have independent computer systems and a shared
storage media, and all systems work together to
complete all tasks.
 All cluster nodes use two different approaches to
interact with one another, like message passing
interface (MPI) and parallel virtual machine (PVM).

What is the Clustered System?


 Cluster operating systems are a combination of software and hardware
clusters.
 Hardware clusters aid in the sharing of high-performance disks among all
computer systems, while software clusters give a better environment for all
systems to operate.
 A cluster system consists of various nodes, each of which contains its
cluster software.
 The cluster software is installed on each node in the clustered system, and
it monitors the cluster system and ensures that it is operating properly.
 If one of the clustered system's nodes fails, the other nodes take over its
storage and resources and try to restart.

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 5|Page
ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

 Cluster components are generally linked via fast area networks, and each
node executing its instance of an operating system.
 In most cases, all nodes share the same hardware and operating system,
while different hardware or different operating systems could be used in
other cases.
 The primary purpose of using a cluster system is to assist with weather
forecasting, scientific computing, and supercomputing systems.
 There are two clusters available to make a more efficient cluster. These
are as follows:
1. Software Cluster
2. Hardware Cluster
1. Software Cluster
The Software Clusters allows all the systems to work together.
2. Hardware Cluster
It helps to allow high-performance disk sharing among systems.

Types of Clustered Operating System


There are mainly three types of the clustered operating system:
1. Asymmetric Clustering System
2. Symmetric Clustering System
3. Parallel Cluster System
1. Asymmetric Clustering System
 In the asymmetric cluster system, one node out of all nodes is in hot
standby mode, while the remaining nodes run the essential applications.
 Hot standby mode is completely fail-safe and also a component of the
cluster system.
 The node monitors all server functions; the hot standby node swaps this
position if it comes to a halt.
 Hot standby mode: If any data is lost in the primary system, Hot standby
mode provides an security to the data sharing and backup of the data in
the secondary memory.
2. Symmetric Clustering System
 Multiple nodes help run all applications in this system, and it monitors all
nodes simultaneously.
 Because it uses all hardware resources, this cluster system is more reliable
than asymmetric cluster systems.
3. Parallel Cluster System
 A parallel cluster system enables several users to access similar data on the
same shared storage system.
 The system is made possible by a particular software version and other
apps.

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 6|Page
ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS
Classification of clusters
 Computer clusters are managed to support various purposes, from general-
purpose business requirements like web-service support to computation-
intensive scientific calculations.
 There are various classifications of clusters. Some of them are as follows:
1. Fail over Clusters
 The process of moving applications and data resources from a failed system
to another system in the cluster is referred to as fail-over.
 These are the databases used to cluster important missions, application
servers, mail, and file.
2. Load Balancing Cluster
 The cluster requires better load balancing abilities amongst all available
computer systems.
 All nodes in this type of cluster can share their computing workload with
other nodes, resulting in better overall performance.
 For example, a web-based cluster can allot various web queries to various
nodes, so it helps to improve the system speed.
 When it comes to grabbing requests, only a few cluster systems use the
round-robin method.
3. High Availability Clusters
 These are also referred to as "HA clusters". They provide a high probability
that all resources will be available.
 If a failure occurs, such as a system failure or the loss of a disk volume, the
queries in the process are lost.
 If a lost query is retried, it will be handled by a different cluster computer.
 It is widely used in news, email, FTP servers, and the web.

Advantages and Disadvantages of Cluster Operating System


 Various advantages and disadvantages of the Clustered Operating System
are as follows:

Advantages
Various advantages of Clustered Operating System are as follows:

1. High Availability
 Although every node in a cluster is a standalone computer, the failure of a
single node doesn't mean a loss of service.
 A single node could be pulled down for maintenance while the remaining
clusters take on a load of that single node.

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 7|Page
ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS
2. Cost Efficiency
 When compared to highly reliable and larger storage mainframe computers,
these types of cluster computing systems are thought to be more cost-
effective and cheaper.
3. Additional Scalability
 A cluster is set up in such a way that more systems could be added to it in
minor increments.
 Clusters may add systems in a horizontal fashion.
 It means that additional systems could be added to clusters to improve
their performance, fault tolerance, and redundancy.
4. Fault Tolerance
 Clustered systems are quite fault-tolerance, and the loss of a single node
does not result in the system's failure.
 They might also have one or more nodes in hot standby mode, which allows
them to replace failed nodes.
5. Performance
 The clusters are commonly used to improve the availability and
performance over the single computer systems, whereas usually being
much more cost-effective than the single computer system of comparable
speed or availability.
6. Processing Speed
 The processing speed is also similar to mainframe systems and other types
of supercomputers on the market.

Disadvantages

Various disadvantages of the Clustered Operating System are as follows:


1. Cost-Effective
 One major disadvantage of this design is that it is not cost-effective.
 The cost is high, and the cluster will be more expensive than a non-
clustered server management design since it requires good hardware and a
design.
2. Required Resources
 Clustering necessitates the use of additional servers and hardware, making
monitoring and maintenance difficult.
 As a result, infrastructure must be improved.
3. Maintenance
 It isn't easy to system establishment, monitor, and maintenance this
system.

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 8|Page
ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

Real-Time Systems:
 Real-time operating system (RTOS) is a special-purpose operating
system used in computers that has strict time constraints for any job to
be performed.
 Real-time Operating System is used in environments where a large number
of events, mostly external to the computer system, must be accepted and
processed in a short time or within certain deadlines. It is employed mostly
in those systems in which the results of the computations are used to
influence a process while it is executing.
 Examples of real-time operating systems are airline traffic control
systems, Command Control Systems, airline reservation systems, Heart
pacemakers, Network Multimedia Systems, robots, etc.

Types of RTOS:
Following are the three types of RTOS systems are:
 Hard Real-Time Operating System
 Soft Real-Time Operating System
 Firm Real-Time Operating System

Hard Real-Time Operating System:


 In Hard RTOS, all critical tasks must be completed within the specified
time duration, i.e., within the given deadline. Not meeting the deadline
would result in critical failures such as damage to equipment or even loss
of human life.
 For Example, Let's take an example of airbags provided by carmakers
along with a handle in the driver's seat. When the driver applies brakes at
a particular instance, the airbags grow and prevent the driver's head from
hitting the handle. Had there been some delay even of milliseconds, then
it would have resulted in an accident.
 Scientific experiments, medical imaging systems, industrial control
systems, weapon systems, robots, air traffic control systems, etc.

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 9|Page
ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

Soft Real-Time Operating System:


 This operating system provides some relaxation in the time limit. Soft
RTOS accepts a few delays via the means of the Operating system. In this
kind of RTOS, there may be a closing date assigned for a particular job,
but a delay for a small amount of time is acceptable.
 For Example, This type of system is used in Online Transaction systems
and Livestock price quotation Systems, Multimedia systems, digital audio
systems, etc. Explicit, programmer-defined, and controlled processes are
encountered in real-time systems.

Firm Real-Time Operating System:


 RTOS of this type have to follow deadlines as well. In spite of its small
impact, missing a deadline can have unintended consequences, including
a reduction in the quality of the product.
 For Example, Multimedia applications.

Advantages:
The advantages of real-time operating system are as follows,
1.Maximum consumption: Maximum utilization of devices and systems. Thus
more output from all the resources.
2.Task Shifting: Time assigned for shifting tasks in these systems is very less.
For example, in older systems, it takes about 10 microseconds. Shifting one
task to another and in the largest systems, it takes 3 microseconds.
3.Focus on Application: Focus on running applications and less importance
to applications that are in the queue.
4.Real-Time Operating System in Embedded System: Since the size of
programs is small, RTOS can also be embedded systems like in transport and
others.
5.Error Free: These types of systems are error-free.
6.Memory Allocation: Memory allocation is best managed in these types of
systems.

Disadvantages:
The disadvantages of real-time operating systems are as follows,
1. Limited Tasks: Very few tasks run simultaneously, and their concentration
is very less on few applications to avoid errors.
2. Use Heavy System Resources: Sometimes the system resources are not so
good and they are expensive as well.
3. Complex Algorithms: The algorithms are very complex and difficult for the
designer to write on.
4. Device Driver and Interrupt signals: It needs specific device drivers and
interrupts signals to respond earliest to interrupts.
5. Thread Priority: It is not good to set thread priority as very less prone to
switching tasks.
6. Minimum Switching: RTOS performs minimal task switching.

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 10 | P a g e


ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

Handheld Systems:
 Operating systems for handheld systems are software programs that
manage the hardware and software resources of small portable devices
such as smart phones, tablets, and personal digital assistants (PDAs).
 It is sometimes also known as a Personal Digital Assistant (PDA).
 The popular handheld device in today’s world is Android and iOS.
 These operating systems need a high-processing processor and are also
embedded with various types of sensors.
Types of Handheld Operating Systems are as follows:
1. Palm OS
2. Symbian OS
3. Linux OS
4. Windows
5. Android
6. iOS

Feature Migration:
 Feature migration in operating system is the process of transferring some
or all of the functionalities and settings of an operating system from one
computer to another.
 This can be done for various reasons, such as upgrading to a newer version
of the operating system, switching to a different operating system, or
moving to a more powerful or reliable hardware .
 There are different methods and tools for feature migration, depending on
the source and destination operating systems, the type and amount of data
to be transferred, and the level of automation and customization required.
 Some of the common methods and tools are:
 Windows Server Migration Tools: This is a feature built in to Windows
Server that enables you to migrate server roles, features, operating
system settings, and other data and shares to servers, including later
versions of Windows Server.
 Storage Migration Service: This is a feature of Windows Admin Center
that helps you migrate servers and their data without reconfiguring
applications or users.
 User State Migration Tool (USMT): This is a command-line tool that
allows you to migrate user profiles and data from one Windows computer
to another.
 Windows Easy Transfer: This is a graphical tool that allows you to
transfer files and settings from one Windows computer to another .
 Linux Migration Assistant: This is a tool that helps you migrate your
personal data and settings from a Windows or Linux computer to a Linux
computer .
 Mac Migration Assistant: This is a tool that helps you transfer your
documents, apps, user accounts, and settings from another Mac, or from
a Windows PC, to your Mac.

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 11 | P a g e


ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 12 | P a g e


ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

Computing Environments
 The computing environment involves the collection of computer machinary,
data storage devices, work stations, software applications, and networks
that support the processing and exchange of electronic information
demanded by the software solution.
 Types of Computing Environments: There are

1. Personal Computing Environment:


 In personal computing environment there is a stand-alone machine.
Complete program resides on computer and executed there. Different
stand-alone machines that constitute a personal computing environment
are laptops, mobiles, printers, computer systems, scanners etc. That we
use at our homes and offices.
2. Time-Sharing Computing Environment:
 In Time Sharing Computing Environment multiple users share system
simultaneously. Different users (different processes) are allotted different
time slice and processor switches rapidly among users according to it.
 For example, student listening to music while coding something in an IDE.
Windows 95 and later versions, Unix, IOS, Linux operating systems are the
examples of this time sharing computing environment.
3. Client Server Computing Environment:
 In client server computing environment two machines are involved i.e.,
client machine and server machine, sometime same machine also serve as
client and server.
 In this computing environment client requests resource/service and server
provides that respective resource/service. A server can provide service to
multiple clients at a time and here mainly communication happens through
computer network.

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 13 | P a g e


ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

4. Distributed Computing Environment:


 In a distributed computing environment multiple nodes are connected
together using network but physically they are separated. A single task is
performed by different functional units of different nodes of distributed
unit.
 Here different programs of an application run simultaneously on different
nodes, and communication happens in between different nodes of this
system over network to solve task.
5. Grid Computing Environment:
 In grid computing environment, multiple computers from different locations
works on single problem. In this system set of computer nodes running in
cluster jointly perform a given task by applying resources of multiple
computers/nodes. It is network of computing environment where several
scattered resources provide running environment for single task.
6. Cloud Computing Environment:
 In cloud computing environment on demand availability of computer
system resources like processing and storage are availed. Here computing
is not done in individual technology or computer rather it is computed in
cloud of computers where all required resources are provided by cloud
vendor.
 This environment primarily comprised of three services i.e software-as-a-
service (SaaS), infrastructure-as-a-service (IaaS), and platform-as-a-service
(PaaS).
7. Cluster Computing Environment:
 In cluster computing environment cluster performs task where cluster is a
set of loosely or tightly connected computers that work together.
 t is viewed as single system and performs task parallel that’s why also it is
similar to parallel computing environment. Cluster aware applications are
especially used in cluster computing environment.

Process Scheduling:
 CPU is always busy in Multiprogramming. Because CPU switches
from one job to another job.
 But in simple computers CPU sit idle until the I/O request granted.
Scheduling is an important OS function.
 All resources are scheduled before use. (CPU, memory, devices…..)
Process scheduling is an essential part of 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.

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 14 | P a g e


ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

 Scheduling Objectives
o Maximize throughput.
o Maximize number of users receiving acceptable response times.
o Be predictable.
o Balance resource use.
o Avoid indefinite postponement.
o Enforce Priorities.
o Give preference to processes holding key resources

Cooperating Processes:
 The concurrent processes executing in the operating system may be
either independent processes or cooperating processes.
 Independent process cannot affect or be affected by the execution
of another process
 Cooperating process can affect or be affected by the execution of
another process
 Advantages of process cooperation
1. Information sharing
2. Computation speed-up
3. Modularity
4. Convenience

Inter Process Communication:


 Operating systems provide the means for cooperating processes to
communicate with each other via an interprocess communication
(PC) facility.
 IPC provides a mechanism to allow processes to communicate and
to synchronize their actions.IPC is best provided by a message
passing system.
 Mechanism for processes to communicate and to synchronize their
actions
 Message system – processes communicate with each other without
resorting to shared variables
 IPC facility provides two operations:
o send(message) – message size fixed or variable
o receive(message)
 If P and Q wish to communicate, they need to:
o establish a communication link between them exchange
messages via send/receive
 Implementation of communication link
o physical (e.g., shared memory, hardware
bus)
o logical (e.g., logical properties)

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 15 | P a g e


ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

Basic structure:
 If processes P and Q want to communicate, they must send
messages to and receive messages from each other; a
communication link must exist between them.
 Physical implementation of the link is done through a hardware
bus , network etc,
 There are several methods for logically implementing a link and the
operations:
1. Direct or indirect communication
2. Symmetric or asymmetric communication
3. Automatic or explicit buffering
4. Send by copy or send by reference
5. Fixed-sized or variable-sized messages

Naming
 Processes that want to communicate must have a way to refer to
each other. They can use either direct or indirect communication.

1. Direct Communication
 Processes must name each other explicitly:
o send (P, message) – send a message to process P
o receive(Q, message) – receive a message from process Q
 Properties of communication link
o Links are established automatically
o A link is associated with exactly one pair of communicating
processes
o Between each pair there exists exactly one link
o The link may be unidirectional, but is usually bi-directional
2. Indirect Communication
 With indirect communication, the messages are sent to and
received from mailboxes, or ports.
 The send and receive primitives are defined as follows:
o Send (A, message) Send a message to mailbox A.
o Receive (A, message) Receive a message from mailbox A.
 Messages are directed and received from mailboxes (also referred to
as ports)
o Each mailbox has a unique id
o Processes can communicate only if they share a mailbox
 Properties of communication link
o Link established only if processes share a common mailbox
o A link may be associated with many processes
o Each pair of processes may share several communication
links
o Link may be unidirectional or bi-directional

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 16 | P a g e


ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

3. Buffering
 A link has some capacity that determines the number of message
that can reside in it temporarily. This property can be viewed as a
queue of messages attached to the link.
 There are three ways that such a queue can be implemented.
o Zero capacity: Queue length of maximum is 0. No message is
waiting in a queue. The sender must wait until the recipient
receives the message. (message system with no buffering)
o Bounded capacity: The queue has finite length n. Thus at most
n messages can reside in it.
o Unbounded capacity: The queue has potentially infinite length.
Thus any number of messages can wait in it. The sender is
never delayed
4. Synchronization
 Message passing may be either blocking or non-blocking.
1. Blocking Send - The sender blocks itself till the message sent by
it is received by the receiver.
2. Non-blocking Send - The sender does not block itself after
sending the message but continues with its normal operation.
3. Blocking Receive - The receiver blocks itself until it receives the
message.
4. Non-blocking Receive – The receiver does not block itself.

Deadlocks:
 Deadlock is a situation where a set of processes are blocked because each
process is holding a resource and waiting for another resource acquired by
some other process.

Deadlock Characteristics:
 The deadlock has the following characteristics
1. Mutual Exclusion
2. Hold and Wait
3. No preemption
4. Circular Wait

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 17 | P a g e


ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

1. Mutual Exclusion:
 Only one process can use a resource at any given time i.e. the resources
are non-sharable.
 At least one resource must be held non-sharable; i.e. only a single process
at a time can utilize the resources.
 If another process demands that resources, the request must be
postponed until the resource is released.
 One or more than one resource is non-sharable (only one process can use
at a time).
 For Example:

2. Hold and wait:


 A process is holding at least one resource at a time and is waiting to
acquire other resources held by some other process.
 A job must hold at least one resource and wait to obtain supplementary
resources currently being held by several other processes.
 For example:

3. No preemption:
 The resource can be released by a process voluntarily i.e. after execution
of the process.
 Resources can’t be anticipated; i.e., a resource can get released only
willingly by the process holding it, and then after that, the process has
completed its task.
 For Example:

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 18 | P a g e


ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

4. Circular wait:
 A set of processes are waiting for each other in a circular fashion. For
example, let’s say there are a set of processes {p0,p1,p2,p3}such that p0
depends on p1,
 P1 depends on p2, p2 depends p3 and p3 depends p0.
 This creates a circular relation between all these processes and they have
to wait forever to be executed.
 The circular-wait situation implies the hold-and-wait state or condition;
hence, all four conditions are not entirely independent. they are
interconnected among each other.
 For Example:

Method for handling Deadlock:


1. Deadlock Ignorance
2. Deadlock prevention
3. Deadlock Avoidance
4. Deadlock detection and recovery

1. Deadlock Ignorance:
 In the Deadlock ignorance method, the OS acts like the deadlock never
occurs and completely ignores it even if the deadlock occurs.
 This method only applies if the deadlock occurs very rarely.
 The algorithm is very simple.
 It says” if the deadlock occurs, simply reboot the system and act like the
deadlock never occurred.”

2. Deadlock prevention:
 The possibility of deadlock is excluded before making requests, by
eliminating one of the necessary conditions for deadlock.
 Example: Only allowing traffic from one direction, will exclude the
possibility of blocking the road.
 The operating system takes steps to prevent deadlocks from occurring by
ensuring that the system is always in a safe state, where deadlocks cannot
occur.

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 19 | P a g e


ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

 Some ways of prevention are as follows


o Preempting resources:
• Take the resources from the process and assign them to other
processes.
o Rollback:
• When the process is taken away from the process, roll back and
restart it.
o Aborting:
• Aborting the deadlocked processes.
o Sharable resource:
• If the resource is sharable, all processes will get all resources, and a
deadlock situation won’t come.

3. Deadlock Avoidance:
 The Operating system runs an algorithm on requests to check for a safe
state. Any request that may result in a deadlock is not granted.
 Example: Checking each car and not allowing any car that can block the
road. If there is already traffic on the road, then a car coming from the
opposite direction can cause blockage.
 In deadlock avoidance, the request for any resource will be granted if the
resulting state of the system doesn’t cause deadlock in the system.

4. Deadlock Detection and Recovery:


 Deadlock detection and recovery is the process of detecting and resolving
deadlocks in an operating system.
 A deadlock occurs when two or more processes are blocked, waiting for
each other to release the resources they need.
 This can lead to a system-wide stall, where no process can make progress.

DEADLOCK DETECTION:
 Detecting deadlocks is one of the most important steps in preventing
them.
 A deadlock can happen anytime when two or more processes are trying to
acquire a resource, and each process is waiting for other processes to
release the resource.
 The deadlock can be detected in the resource-allocation graph as shown in
fig below.

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 20 | P a g e


ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

 This graph checks if there is a cycle in the Resource Allocation Graph and
each resource in the cycle provides only one instance, If there is a cycle in
this graph then the processes will be in a deadlock state.
 So always remember detecting deadlocks is one of the most important
steps in preventing them.

DEADLOCK RECOVERY:
 A traditional operating system such as Windows doesn’t deal with
deadlock recovery as it is a time and space-consuming process.
 Real-time operating systems use Deadlock recovery.

1. Killing the process:–


 Killing all the processes involved in the deadlock.
 Killing process one by one.
 After killing each process check for deadlock again and keep repeating
the process till the system recovers from deadlock.
 Killing all the processes one by one helps a system to break circular
wait conditions.

2. Resource Preemption:–
 Resources are preempted from the processes involved in the deadlock,
and preempted resources are allocated to other processes so that there
is a possibility of recovering the system from the deadlock. In this
case, the system goes into starvation.

3. Concurrency Control:–
 Concurrency control mechanisms are used to prevent data
inconsistencies in systems with multiple concurrent processes.
 These mechanisms ensure that concurrent processes do not access
the same data at the same time, which can lead to inconsistencies and
errors.
 Deadlocks can occur in concurrent systems when two or more
processes are blocked, waiting for each other to release the resources
they need.
 This can result in a system-wide stall, where no process can make
progress. Concurrency control mechanisms can help prevent
deadlocks by managing access to shared resources and ensuring that
concurrent processes do not interfere with each other.

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 21 | P a g e


ADVANCED OPERATING SYSTEMS
UNIT 1- BASICS OF OPERATING SYSTEMS

Advantages of Deadlock Detection and Recovery in Operating


Systems:
1. Improved System Stability:
 Deadlocks can cause system-wide stalls, and detecting and resolving
deadlocks can help to improve the stability of the system.
2. Better Resource Utilization:
 By detecting and resolving deadlocks, the operating system can ensure
that resources are efficiently utilized and that the system remains
responsive to user requests.
3. Better System Design:
 Deadlock detection and recovery algorithms can provide insight into
the behavior of the system and the relationships between processes
and resources, helping to inform and improve the design of the
system.

Disadvantages of Deadlock Detection and Recovery in Operating


Systems:
1. Performance Overhead:
 Deadlock detection and recovery algorithms can introduce a significant
overhead in terms of performance, as the system must regularly check
for deadlocks and take appropriate action to resolve them.
2. Complexity:
 Deadlock detection and recovery algorithms can be complex to
implement, especially if they use advanced techniques such as the
Resource Allocation Graph or Time stamping.
3. False Positives and Negatives:
 Deadlock detection algorithms are not perfect and may produce false
positives or negatives, indicating the presence of deadlocks when they
do not exist or failing to detect deadlocks that do exist.
4. Risk of Data Loss:
 In some cases, recovery algorithms may require rolling back the state
of one or more processes, leading to data loss or corruption.

Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 22 | P a g e

You might also like