Unit 2 Advanced Operating Systems 23pcsce24!3!1
Unit 2 Advanced Operating Systems 23pcsce24!3!1
Unit 2 Advanced Operating Systems 23pcsce24!3!1
Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 1|Page
ADVANCED OPERATING SYSTEMS
UNIT 2- DISTRIBUTED OPERATING SYSTEMS
3. N-tier:
N-tier system is used when the server application needs to
forward requests to additional enterprise services on the
network.
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.
1. Heterogeneity:
Different networks, hardware, operating system, programming
languages. We setup protocols to solve these hetrogenetics
o Middleware: A software layer that provides a programming
abstraction as well as masking the heterogeneity.
o Mobilecode: code that can be sent from one computer to
another and run at the destination.
2. Transparency:
Transparency ensures that the distributed system should be perceived
as a single entity by the users or the application programmers rather
than a collection of autonomous systems, which is cooperating.
The user should be unaware of where the services are located and the
transfer from a local machine to a remote one should be transparent.
3. Openness:
The openness of the distributed system is determined primarily by the
degree to which new resource -sharing services can be made available
for use by a variety of client programs.
Open systems are characterized by the fact that their key interfaces
are published.
Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 2|Page
ADVANCED OPERATING SYSTEMS
UNIT 2- DISTRIBUTED OPERATING SYSTEMS
4. Concurrency:
There is a possibility that several clients will attempt to access a shared
resource at the same time.
Any object that represents a shared resource in a distributed system
must ensure that it operates correctly in a concurrent environment.
5. Security:
The security of an information system has three components
confidentially, integrity, and availability.
Encryption protects shared resources and keeps sensitive information
secrets when transmitted.
6. Scalability:
The scalability of the system should remain efficient even with a
significant increase in the number of users and resources connected.
7. Failure Handling or (Resilience to Failure):
When some faults occur in hardware and the software program, it may
produce incorrect results or they may stop before they have completed
the intended computation so corrective measures should to implement to
handle this case.
Failure handling is difficult in distributed systems because the failure is
partial i.e., some components fail while others continue to function.
Communication Primitives:
Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 3|Page
ADVANCED OPERATING SYSTEMS
UNIT 2- DISTRIBUTED OPERATING SYSTEMS
Blocking
o SEND primitive does not return the control to the user process
until message has been sent or acknowledgement has been
received.
Advantage:
o Program behavior is predictable.
Drawback:
o Lack of flexibility in programming
Synchronous vs. Asynchronous Primitives
Synchronous
o SEND primitive is blocked until corresponding RECEIVE
primitive is executed at the target computer.
o Also known as rendezvous.
Asynchronous
o Messages are buffered.
o SEND primitive does not block even if there is no corresponding
execution of the RECEIVE primitive.
o The corresponding RECEIVE primitive can be either blocking or
non-blocking.
o Drawback: buffering message is more complex, as it involves
creating, manging & destroying buffers.
Details to be handled in Message Passing
o Pairing of Response with Requests
o Data Representation
o Sender should know the address of Remote machine
o Communication and System failures
Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 4|Page
ADVANCED OPERATING SYSTEMS
UNIT 2- DISTRIBUTED OPERATING SYSTEMS
Lamport”s Logical clock:
Lamport”s logical clock was created by Leslie Lamport”s.
It is a procedure to determine the order of the events occurring.
A Lamport logical clock is a numerical software counter value
maintained in each process.
Conceptually this logical clock can be thought of as a clock only has
meaning in relationship to messages moving between processes.
When a process receives a message it resynchronizes it logical clock
with that sender.
Algorithm:
Happened before relation (->): a -> b, means ‘a’ happened before ‘b’.
Logical Clock: The criteria for the logical clocks are :
o [C1]: Ci(a) < Ci(b), [Ci -> Logical Clock, If ‘a’ happened before ‘b’,
then time of ‘a’ will be less than ‘b’ in a particular process.
o [C2]: Ci(a) < Cj(b), [Clock value of Ci(a) is less than Cj(b)]
o Since time cannot run backwards.
Event countering example :
o Three systems P1, P2, P3….
o Events a, b, c…
o Local Event counters on each
system.
o Systems occasionally communicate.
o If a & b are Events in same process
and a occurs before b, then a -> b
is true.
Lamport”s algorithm:
Each message carries a time stamp of the sender’s clock.
When a message arrives:
if receivers clock< message timestamp
Set system clock to (message timestamp+1)
else do nothing
clock must be advanced between any two events in the same
process
Dr. S.Sivakumar, Assistant Professor, PG Department of Computer Science, C.Mutlur, Chidambaram. 5|Page
ADVANCED OPERATING SYSTEMS
UNIT 2- DISTRIBUTED OPERATING SYSTEMS
Example: Lamport”s logical clocks
Three processes each with its own clock.
The clocking at different rates.
Deadlock:
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. 6|Page
ADVANCED OPERATING SYSTEMS
UNIT 2- DISTRIBUTED 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:
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. 7|Page
ADVANCED OPERATING SYSTEMS
UNIT 2- DISTRIBUTED 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:
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. 8|Page
ADVANCED OPERATING SYSTEMS
UNIT 2- DISTRIBUTED 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. 9|Page
ADVANCED OPERATING SYSTEMS
UNIT 2- DISTRIBUTED OPERATING SYSTEMS
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.
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.
1. Google's Kubernetes:
Background:
o Kubernetes is an open-source container orchestration platform
initially developed by Google and now maintained by the Cloud
Native Computing Foundation (CNCF).
Key Features:
o Kubernetes provides automated deployment, scaling, and
management of containerized applications. It abstracts away the
underlying infrastructure and allows users to define application
requirements declaratively.
Challenges:
o Kubernetes needed to address the challenges of managing
distributed applications across a dynamic and heterogeneous
environment efficiently. This involved designing robust scheduling,
networking, and service discovery mechanisms.
Applications:
o Kubernetes is widely used for deploying and managing microservices-
based applications, providing scalability, resilience, and portability
across different cloud and on-premises environments.
2. Apache Spark:
Background:
o Apache Spark is an open-source distributed computing framework
designed for processing large-scale datasets in parallel.
Key Features:
o Spark provides an in-memory computing engine that supports a
variety of workloads, including batch processing, real-time stream
processing, machine learning, and graph analytics.
Challenges:
o Spark needed to address the challenges of efficiently distributing
computation across a cluster of machines while providing fault
tolerance and high throughput. This involved designing distributed
data structures, task scheduling, and fault recovery mechanisms.
Applications:
o Spark is widely used in big data analytics for processing and
analyzing large datasets, powering applications such as data
warehousing, ETL (Extract, Transform, Load) pipelines, and real-time
analytics.
Background:
o Apache Hadoop is an open-source distributed computing framework
for storing and processing large datasets across clusters of
commodity hardware.
Key Features:
o Hadoop consists of two main components: Hadoop Distributed File
System (HDFS) for distributed storage and MapReduce for
distributed processing. It provides fault tolerance, scalability, and
high throughput.
Challenges:
o Hadoop needed to address the challenges of efficiently distributing
data and computation across a cluster of machines while providing
fault tolerance and scalability. This involved designing distributed file
storage, data replication, and parallel processing frameworks.
Applications:
o Hadoop is widely used for batch processing of large datasets in
various domains, including web search, e-commerce, social media,
and bioinformatics.
2. Coda:
Coda is a distributed file system developed at Carnegie Mellon
University. It is designed to provide transparent access to files across a
network of computers, even in the presence of disconnections and
network partitions.
Coda employs a client-server architecture with disconnected operation
support. Clients cache copies of files locally and can continue working
with them even when disconnected from the network. Changes made
locally are later synchronized with the server.
Coda's design emphasizes scalability, fault tolerance, and performance
optimization, making it suitable for distributed computing environments
where users need access to files regardless of network connectivity.
In summary, while both NFS and Coda are distributed file systems, they
have different architectures, features, and use cases. NFS is widely used for
network file sharing in traditional client-server environments, while Coda is
designed for distributed computing environments with support for
disconnected operation and transparent access to files across networks.
NFS Model
NFS Architecture: