SlideShare une entreprise Scribd logo
1  sur  8
MC0085 – Advanced Operating Systems
Question 1 - What is a message passing system? Discuss the desirable features of a message passing system?
Message passing is the paradigm of communication where messages are sent from a sender to one or more
recipients. Forms of messages include (remote) method invocation, signals, and data packets. Message passing
systems have been called "shared nothing" systems because the message passing abstraction hides underlying
state changes that may be used in the implementation of sending messages. Messages are also commonly used in
the same sense as a means of inter-process communication; the other common technique being streams or pipes,
in which data are sent as a sequence of elementary data items instead (the higher-level version of a virtual circuit).
Features
Simplicity Uniform Semantics
o Local communication (communicating processes are on the same node)
o Remote communication (communicating processes are on diff. nodes )
Efficiency ( critical issue, cost effective)
Optimizations
o Reducing the no. of message exchanges
o Minimize the cost of maintaining the connections
o Piggybacking of acknowledges
Reliability (D.S is prone to node crashes or communication. link failure)
o lost messages
o duplicate messages
Correctness
o Atomicity
o Ordered delivery
o Survivability
Flexibility
Security
o Authentication
o Encryption
Portability
o Message passing sys. should itself be portable
o Applications written by using the primitives of the IPC protocols should be portable.
Question 2 - Discuss the implementation of RPC Mechanism in detail.
A remote procedure call (RPC) is an inter-process communication that allows a computer program to cause a
subroutine or procedure to execute in another address space (commonly on another computer on a shared
network) without the programmer explicitly coding the details for this remote interaction. That is, the programmer
writes essentially the same code whether the subroutine is local to the executing program, or remote. When the
software in question uses object-oriented principles, RPC is called remote invocation or remote method
invocation.
Message passing
An RPC is initiated by the client, which sends a request message to a known remote server to execute a specified
procedure with supplied parameters. The remote server sends a response to the client, and the application
continues its process. There are many variations and subtleties in various implementations, resulting in a variety of
different (incompatible) RPC protocols. While the server is processing the call, the client is blocked (it waits until
the server has finished processing before resuming execution).
An important difference between remote procedure calls and local calls is that remote calls can fail because of
unpredictable network problems. Also, callers generally must deal with such failures without knowing whether the
remote procedure was actually invoked. Idempotent procedures (those that have no additional effects if called
more than once) are easily handled, but enough difficulties remain that code to call remote procedures is often
confined to carefully written low-level subsystems.
Sequence of events during a RPC
The client calls the Client stub. The call is a local procedure call, with parameters pushed on to the stack in
the normal way.
The client stub packs the parameters into a message and makes a system call to send the message.
Packing the parameters is called marshalling.
The kernel sends the message from the client machine to the server machine.
The kernel passes the incoming packets to the server stub.
Finally, the server stub calls the server procedure. The reply traces the same steps in the reverse
direction.
Question 3 - Discuss the following with respect to Distributed Shared Memory:
a) Memory Coherence (Consistency) Models
Memory Consistency Model is: A set of rules that the applications must obey if they want the DSM system
to provide the degree of consistency guaranteed by the consistency model.
• Weaker the consistency model, better the concurrency.
• Researchers try to invent new consistency models which are weaker than the existing ones in
such a way that a set of applications will function correctly under the new consistency model.
• Note that an application written for a DSM that implements a stronger consistency model may
not work correctly under a DSM that implements a weaker consistency model
b) Memory Consistency models
i.
Strict consistency: Each read operation returns the most recently written value. This is possible
to implement only in systems with the notion of global time. So,this model is impossible to
implement. Hence, DSM systems based on underlying distributed systems have to use weaker
consistency models.
ii.
Sequential consistency: All processes in the system observe the same order of all memory access
operations on the shared memory. i.e. , if three operations read(r1), write(w1) and read(r2) are
performed on a memory address in that order, then any of the six orderings (r1,w1, r2),
(r2,w1,r1), (w1, r2, r1).... is acceptable provided all processes see the same ordering.
iii.
Causal consistency model: In this model, all write operations that are potentially causally related
are seen by all processes in the same (correct) order. For example, if a process did a read
operation and then performed a write operation, then the value written may have depended in
some way on the value read. A write operation performed by one process P1 is not causally
related to the write operation performed by another process P2 if P1 has read neither the value
written by P2 or any memory variable that was directly or indirectly derived from the value
written by P2 and vice versa.
iv.
Pipelined Random: Access Memory (PRAM) consistency model. In this model, all write
operations performed by a single process are seen by all other processes in the order in which
they were performed. This model can be implemented easily by sequencing the write operations
performed by each node independently. This model is weaker than all the above consistency
models.
v.
Processor Consistency Model: In addition to PRAM consistency, for any memory location, all
processes agree on the same order of all write operations to that location.
vi.
Weak Consistency Model: This model distinguishes between ordinary accesses and
synchronization accesses. It requires that memory become consistent only on synchronization
accesses. ADSM that supports weak consistency model uses a special variable, called
vii.

viii.

c)

synchronization variable. The operations on it are used to synchronize memory. For supporting
weak consistency, the following should be satisfied: All accesses to synchronization variables
must obey sequential consistency semantics.
Release Consistency Model: In the weak consistency model, the entire shared memory is
synchronized when a synchronization variable is accessed by a process i.e.
All changes made to the memory are propagated to other nodes.
All changes made to the memory by other processes are propagated from other nodes
to the process’s node.
Lazy Release consistency model: It is a variation of release consistency model. In this approach,
when a process does a release access, the contents of all the modifications are not immediately
sent to other nodes but they are sent only on demand. i.e. When a process does an acquire
access, all modifications of other nodes are acquired by the process’s node. It minimizes network
traffic.

Implementing Sequential Consistency
Sequential consistency supports the intuitively expected semantics. So, this is the most preferred choice
for designers of DSM system. The replication and migration strategies for DSM design include:
Non-replicated, non-migrating blocks (NRNMBs)
Non-replicated, migrating blocks (NRMBs)
Replicated, migrating blocks (RMBs)
Replicated, non-migrating blocks (RNMBs).
Implementing under NRNMBs strategy:
Under this strategy, only one copy of each block of the shared memory is in the system and its location is
fixed. All requests for a block are sent to the owner node of the block. Upon receiving a request from a
client node, the memory management unit (MMU) and the operating system of the owner node perform
the access request and return the result. Sequential consistency can be trivially enforced, because the
owner node needs to only process all requests on a block in the order it receives.
Disadvantage:
Parallelism is not possible in this strategy
Mapping between blocks and nodes need to be maintained at each node.

Implementing under NRMBs strategy
Under this strategy, only the processes executing on one node can read or write a given data item at any
time, so sequential consistency is ensured.
The advantages of this strategy include:
No communication cost for local data access.
Allows applications to take advantage of data access locality
The disadvantages of this strategy include:
Prone to thrashing
Parallelism cannot be achieved in this method also
Locating a block in the NRMB strategy.
d) Centralized – Server Algorithm
A central server maintains a block table containing owner-node and copy-set information for each block.
When a read/write fault for a block occurs at node N, the fault handler at node N sends a read/write
request to the central server. Upon receiving the request, the central-server does the following:
If it is a read request:
adds N to the copy-set field and
sends the owner node information to node N
Upon receiving this information, N sends a request for the block to the owner node.
Upon receiving this request, the owner returns a copy of the block to N.
If it is a write request:
It sends the copy-set and owner information of the block to node N and initializes copy-set to {N}
Node N sends a request for the block to the owner node and an invalidation message to all
blocks in the copy-set.
Upon receiving this request, the owner sends the block to node N

Question 4 - Explain the following with respect to Resource Management in Distributed Systems:
a) Task assignment Approach
Each process is viewed as a collection of tasks. These tasks are scheduled to suitable processor to improve
performance. This is not a widely used approach because:
·
·
·

·
·
·
·

It requires characteristics of all the processes to be known in advance.
This approach does not take into consideration the dynamically changing state of the system.
In this approach, a process is considered to be composed of multiple tasks and the goal is to find an
optimal assignment policy for the tasks of an individual process. The following are typical
assumptions for the task assignment approach:
Minimize IPC cost (this problem can be modeled using network flow model)
Efficient resource utilization
Quick turnaround time
A high degree of parallelism

b) Load – Balancing Approach
In this, the processes are distributed among nodes to equalize the load among all nodes. The scheduling
algorithms that use this approach are known as Load Balancing or Load Leveling Algorithms. These algorithms
are based on the intuition that for better resource utilization, it is desirable for the load in a distributed system
to be balanced evenly.
We can have the following categories of load balancing algorithms:
Static: Ignore the current state of the system. E.g. if a node is heavily loaded, it picks up a task
randomly and transfers it to a random node. These algorithms are simpler to implement but
performance may not be good.
Dynamic: Use the current state information for load balancing. There is an overhead involved in
collecting state information periodically; they perform better than static algorithms.
Deterministic: Algorithms in this class use the processor and process characteristics to allocate
processes to nodes.
Probabilistic: Algorithms in this class use information regarding static attributes of the system such as
number of nodes, processing capability, etc.
Centralized: System state information is collected by a single node. This node makes all scheduling
decisions.
Distributed: Most desired approach. Each node is equally responsible for making scheduling decisions
based on the local state and the state information received from other sites.
Cooperative: A distributed dynamic scheduling algorithm. In these algorithms, the distributed entities
cooperate with each other to make scheduling decisions. Therefore they are more complex and
involve larger overhead than non-cooperative ones. But the stability of a cooperative algorithm is
better than of a non-cooperative one.
Non-Cooperative: A distributed dynamic scheduling algorithm. In these algorithms, individual entities
act as autonomous entities and make scheduling decisions independently of the action of other
entities.
c)

Load – Sharing Approach

Several researchers believe that load balancing, with its implication of attempting to equalize workload on all
the nodes of the system, is not an appropriate objective. This is because the overhead involved in gathering
the state information to achieve this objective is normally very large, especially in distributed systems having a
large number of nodes. In fact, for the proper utilization of resources of a distributed system, it is not required
to balance the load on all the nodes. It is necessary and sufficient to prevent the nodes from being idle while
some other nodes have more than two processes. This rectification is called the Dynamic Load Sharing instead
of Dynamic Load Balancing.
The design of a load sharing algorithms require that proper decisions be made regarding load estimation
policy, process transfer policy, state information exchange policy, priority assignment policy, and migration
limiting policy. It is simpler to decide about most of these policies in case of load sharing, because load sharing
algorithms do not attempt to balance the average workload of all the nodes of the system. Rather, they only
attempt to ensure that no node is idle when a node is heavily loaded. The priority assignments policies and the
migration limiting policies for load-sharing algorithms are the same as that of load-balancing algorithms.
Question 5 - Explain the following with respect to Distributed File Systems:
a)

The Key Challenges of Distributed Systems
i) Transparency
·
Location: a client cannot tell where a file is located
·
Migration: a file can transparently move to another server
·
Replication: multiple copies of a file may exist
·
Concurrency: multiple clients access the same file
ii) Flexibility - In a flexible DFS it must be possible to add or replace file servers. Also, a DFS should support
multiple underlying file system types (e.g., various Unix file systems, various Windows file systems, etc.)
iii) Reliability - In a good distributed file system, the probability of loss of stored data should be minimized as
far as possible. i.e. users should not feel compelled to make backup copies of their files because of the
unreliability of the system.
iv) Consistency: Employing replication and allowing concurrent access to files may introduce consistency
problems.
v) Security: Clients must authenticate themselves and servers must determine whether clients are authorized
to perform requested operation. Furthermore communication between clients and the file server must be
secured.
vi) Fault tolerance: Clients should be able to continue working if a file server crashes. Likewise, data must not
be lost and a restarted file server must be able to recover to a valid state.
vii) Performance: In order for a DFS to offer good performance it may be necessary to distribute requests
across multiple servers. Multiple servers may also be required if the amount of data stored by a file system is
very large.
viii) Scalability: A scalable DFS will avoid centralized components such as a centralized naming service, a
centralized locking facility, and a centralized file store. A scalable DFS must be able to handle an increasing
number of files and users.
b) Client’s Perspective: File Services
The File service interface represents files as an uninterpreted sequence of bytes that are associated with a set of
attributes (owner, size, creation date, permissions, etc.) including information regarding protection (i.e., access
control lists or capabilities of clients). Moreover, there is a choice between the upload/download model and there
mote access model. In the first model, files are downloaded from the server to the client. Modifications are
performed directly at the client after which the file is uploaded back to the server. In the second model all
operations are performed at the server itself,with clients simply sending commands to the server.
c) File Access Semantics
Ideally, the client would perceive remote files just like local ones. Unfortunately,the distributed nature of a DFS
makes this goal hard to achieve. In the following discussion, we present the various file access semantics available,
and discuss how appropriate they are to a DFS.
Session Semantics: In the case of session semantics, changes to an open file are only locally visible. Only after a
file is closed, are changes propagated to the server (and other clients). This raises the issue of what happens if two
clients modify the same file simultaneously. It is generally up to the server to resolve conflicts and merge the
changes. Another problem with session semantics is that parent and child processes cannot share file pointers if
they are running on different machines.
Immutable Files: Immutable files cannot be altered after they have been closed. In order to change a file, instead
of overwriting the contents of the existing file a new file must be created. This file may then replace the old one as
a whole. This approach to modifying files does require that directories (unlike files) be updatable. Problems with
this approach include a race condition when two clients try to replace the same file as well as the question of what
to do with processes that are reading a file at the same time as it is being replaced by another process.
Atomic Transactions: In the transaction model, a sequence of file manipulations can be executed indivisibly, which
implies that two transactions can never interfere. This is the standard model for databases, but it is expensive to
implement.
d) Server’s Perspective Implementation
Observation about the expected use of a file system can be used to guide the design of a DFS.
·
Most files are small –less than 10k
·
Reading is much more common than writing
·
Usually access is sequential; random access is rare
·
Most files have a short lifetime
·
File sharing is unusual
·
Most processes use only a few files
·
Distinct files classes with different properties exist.
These usage patterns (small files, sequential access, high read-write ratio) would suggest that an update/download
model for a DFS would be appropriate. Note, however, that different usage patterns may be observed at different
kinds of institutions. In situations where the files are large, and are updated more often it may make more sense to
use a DFS that implements a remote access model. Besides the usage characteristics, implementation tradeoffs
may depend on the requirements of a DFS.
e) Stateful Versus Stateless Servers
The file servers that implement a distributed file service can be stateless or Stateful. Stateless file servers do not
store any session state. This means that every client request is treated independently, and not as a part of a new
or existing session. Stateful servers, on the other hand, do store session state. They may, therefore, keep track of
which clients have opened which files, current read and write pointers for files, which files have been locked by
which clients, etc.
The main advantage of stateless servers is that they can easily recover from failure. Because there is no state that
must be restored, a failed server can simply restart after a crash and immediately provide services to clients as
though nothing happened. Furthermore, if clients crash the server is not stuck with abandoned opened or locked
files.
The main advantage of Stateful servers, on the other hand, is that they can provide better performance for clients.
Because clients do not have to provide full file information every time they perform an operation, the size of
messages to and from the server can be significantly decreased. Likewise the server can make use of knowledge of
access patterns to perform read-ahead and do other optimizations. Stateful servers can also offer clients extra
services such as file locking, and remember read and write positions.
Question 6 - Describe the Clock Synchronization Algorithms and Distributed Algorithms in the context of
Synchronization.
Centralized Clock Algorithms
In centralized clock synchronization algorithms one node has a real-time receiver. This node, called the time server
node whose clock time is regarded as correct and used as the reference time. The goal of these algorithms is to
keep the clocks of all other nodes synchronized with the clock time of the time server node. Depending on the role
of the time server node, centralized clock synchronization algorithms are again of two types – Passive Time Sever
and Active Time Server.

1.

2.

Passive Time Server Centralized Algorithm: In this method each node periodically sends a message to the
time server. When the time server receives the message, it quickly responds with a message (“time = T”),
where T is the current time in the clock of the time server node. Assume that when the client node sends
the “time = ?” message, its clock time is T0, and when it receives the “time = T” message, its clock time is
T1. Since T0 and T1 are measured using the same clock, in the absence of any other information, the best
estimate of the time required for the propagation of the message “time = T” from the time server node to
the client’s node is (T1-T0)/2. Therefore, when the reply is received at the client’s node, its clock is
readjusted to T + (T1-T0)/2.
Active Time Server Centralized Algorithm: In this approach, the time server periodically broadcasts its
clock time (“time = T”). The other nodes receive the broadcast message and use the clock time in the
message for correcting their own clocks. Each node has a priori knowledge of the approximate time (Ta)
required for the propagation of the message “time = T” from the time server node to its own node,
Therefore, when a broadcast message is received at a node, the node’s clock is readjusted to the time
T+Ta. A major drawback of this method is that it is not fault tolerant. If the broadcast message reaches
too late at a node due to some communication fault, the clock of that node will be readjusted to an
incorrect value. Another disadvantage of this approach is that it requires broadcast facility to be
supported by the network.

Centralized clock synchronization algorithms suffer from two major drawbacks:
1.

They are subject to single – point failure. If the time server node fails, the clock synchronization operation
cannot be performed. This makes the system unreliable. Ideally, a distributed system, should be more
reliable than its individual nodes. If one goes down, the rest should continue to function correctly.
2.

From a scalability point of view it is generally not acceptable to get all the time requests serviced by a
single time server. In a large system, such a solution puts a heavy burden on that one process.

Distributed Algorithms
We know that externally synchronized clocks are also internally synchronized. That is, if each node’s clock is
independently synchronized with real time, all the clocks of the system remain mutually synchronized. Therefore, a
simple method for clock synchronization may be to equip each node of the system with a real time receiver so that
each node’s clock can be independently synchronized with real time. Multiple real time clocks (one for each node)
are normally used for this purpose. Theoretically, internal synchronization of clocks is not required in this
approach. However, in practice, due to inherent inaccuracy of real-time clocks, different real time clocks produce
different time. Therefore, internal synchronization is normally performed for better accuracy. One of the following
two approaches is used for internal synchronization in this case.
Global Averaging Distributed Algorithms: In this approach, the clock process at each node broadcasts its local
clock time in the form of a special “resync” message when its local time equals T0+iR for some integer I, where T0
is a fixed time in the past agreed upon by all nodes and R is a system parameter that depends on such factors as
the total number of nodes in the system, the maximum allowable drift rate, and so on. i.e. a resync message is
broadcast from each node at the beginning of every fixed length resynchronization interval. However, since the
clocks of different nodes run slightly different rates, these broadcasts will not happen simultaneously from all
nodes. After broadcasting the clock value, the clock process of a node waits for time T, where T is a parameter to
be determined by the algorithm. During this waiting period, the clock process records the time, according to its
own clock, when the message was received. At the end of the waiting period, the clock process estimates the skew
of its clock with respect to each of the other nodes on the basis of the times at which it received resync messages.
It then computes a fault-tolerant average of the next resynchronization interval. The global averaging algorithms
differ mainly in the manner in which the fault-tolerant average of the estimated skews is calculated.
The simplest algorithm is to take the average of the estimated skews and use it as the correction for the local
clock. However, to limit the impact of faulty clocks on the average value, the estimated skew with respect to
each node is compared against a threshold, and skews greater than the threshold are set to zero before
computing the average of the estimated skews.
In another algorithm, each node limits the impact of faulty clocks by first discarding the m highest and m
lowest estimated skews and then calculating the average of the remaining skews, which is then used as the
correction for the local clock. The value of m is usually decided based on the total number of clocks (nodes).

Contenu connexe

Tendances

Tutorial on Parallel Computing and Message Passing Model - C1
Tutorial on Parallel Computing and Message Passing Model - C1Tutorial on Parallel Computing and Message Passing Model - C1
Tutorial on Parallel Computing and Message Passing Model - C1
Marcirio Chaves
 
Dsm (Distributed computing)
Dsm (Distributed computing)Dsm (Distributed computing)
Dsm (Distributed computing)
Sri Prasanna
 
dos mutual exclusion algos
dos mutual exclusion algosdos mutual exclusion algos
dos mutual exclusion algos
Akhil Sharma
 

Tendances (20)

Tutorial on Parallel Computing and Message Passing Model - C1
Tutorial on Parallel Computing and Message Passing Model - C1Tutorial on Parallel Computing and Message Passing Model - C1
Tutorial on Parallel Computing and Message Passing Model - C1
 
Program and Network Properties
Program and Network PropertiesProgram and Network Properties
Program and Network Properties
 
Lecture 3 parallel programming platforms
Lecture 3   parallel programming platformsLecture 3   parallel programming platforms
Lecture 3 parallel programming platforms
 
Introduction to parallel processing
Introduction to parallel processingIntroduction to parallel processing
Introduction to parallel processing
 
Parallel Processing Concepts
Parallel Processing Concepts Parallel Processing Concepts
Parallel Processing Concepts
 
Message Passing Systems
Message Passing SystemsMessage Passing Systems
Message Passing Systems
 
program partitioning and scheduling IN Advanced Computer Architecture
program partitioning and scheduling  IN Advanced Computer Architectureprogram partitioning and scheduling  IN Advanced Computer Architecture
program partitioning and scheduling IN Advanced Computer Architecture
 
Parallel programming model
Parallel programming modelParallel programming model
Parallel programming model
 
Distributed shared memory ch 5
Distributed shared memory ch 5Distributed shared memory ch 5
Distributed shared memory ch 5
 
Dsm (Distributed computing)
Dsm (Distributed computing)Dsm (Distributed computing)
Dsm (Distributed computing)
 
Distributed Systems Theory for Mere Mortals
Distributed Systems Theory for Mere MortalsDistributed Systems Theory for Mere Mortals
Distributed Systems Theory for Mere Mortals
 
Replication in the Wild
Replication in the WildReplication in the Wild
Replication in the Wild
 
Chapter 4 pc
Chapter 4 pcChapter 4 pc
Chapter 4 pc
 
Lecture 2 more about parallel computing
Lecture 2   more about parallel computingLecture 2   more about parallel computing
Lecture 2 more about parallel computing
 
Client Centric Consistency Model
Client Centric Consistency ModelClient Centric Consistency Model
Client Centric Consistency Model
 
Distributed Shared Memory
Distributed Shared MemoryDistributed Shared Memory
Distributed Shared Memory
 
Consistency protocols
Consistency protocolsConsistency protocols
Consistency protocols
 
dos mutual exclusion algos
dos mutual exclusion algosdos mutual exclusion algos
dos mutual exclusion algos
 
Limitations of memory system performance
Limitations of memory system performanceLimitations of memory system performance
Limitations of memory system performance
 
CS6601 DISTRIBUTED SYSTEMS
CS6601 DISTRIBUTED SYSTEMSCS6601 DISTRIBUTED SYSTEMS
CS6601 DISTRIBUTED SYSTEMS
 

En vedette

MC0084 – Software Project Management & Quality Assurance - Master of Computer...
MC0084 – Software Project Management & Quality Assurance - Master of Computer...MC0084 – Software Project Management & Quality Assurance - Master of Computer...
MC0084 – Software Project Management & Quality Assurance - Master of Computer...
Aravind NC
 
MC0083 – Object Oriented Analysis &. Design using UML - Master of Computer Sc...
MC0083 – Object Oriented Analysis &. Design using UML - Master of Computer Sc...MC0083 – Object Oriented Analysis &. Design using UML - Master of Computer Sc...
MC0083 – Object Oriented Analysis &. Design using UML - Master of Computer Sc...
Aravind NC
 
Time travel
Time travelTime travel
Time travel
hplap
 

En vedette (6)

MC0084 – Software Project Management & Quality Assurance - Master of Computer...
MC0084 – Software Project Management & Quality Assurance - Master of Computer...MC0084 – Software Project Management & Quality Assurance - Master of Computer...
MC0084 – Software Project Management & Quality Assurance - Master of Computer...
 
MC0083 – Object Oriented Analysis &. Design using UML - Master of Computer Sc...
MC0083 – Object Oriented Analysis &. Design using UML - Master of Computer Sc...MC0083 – Object Oriented Analysis &. Design using UML - Master of Computer Sc...
MC0083 – Object Oriented Analysis &. Design using UML - Master of Computer Sc...
 
MC0086 Internal Assignment (SMU)
MC0086 Internal Assignment (SMU)MC0086 Internal Assignment (SMU)
MC0086 Internal Assignment (SMU)
 
Time travel
Time travelTime travel
Time travel
 
Distributed Systems Real Life Applications
Distributed Systems Real Life ApplicationsDistributed Systems Real Life Applications
Distributed Systems Real Life Applications
 
Time travel
Time travelTime travel
Time travel
 

Similaire à MC0085 – Advanced Operating Systems - Master of Computer Science - MCA - SMU DE

CS8603_Notes_003-1_edubuzz360.pdf
CS8603_Notes_003-1_edubuzz360.pdfCS8603_Notes_003-1_edubuzz360.pdf
CS8603_Notes_003-1_edubuzz360.pdf
KishaKiddo
 
Lec+3-Introduction-to-Distributed-Systems.pdf
Lec+3-Introduction-to-Distributed-Systems.pdfLec+3-Introduction-to-Distributed-Systems.pdf
Lec+3-Introduction-to-Distributed-Systems.pdf
samaghorab
 

Similaire à MC0085 – Advanced Operating Systems - Master of Computer Science - MCA - SMU DE (20)

Client Server Model and Distributed Computing
Client Server Model and Distributed ComputingClient Server Model and Distributed Computing
Client Server Model and Distributed Computing
 
Talon systems - Distributed multi master replication strategy
Talon systems - Distributed multi master replication strategyTalon systems - Distributed multi master replication strategy
Talon systems - Distributed multi master replication strategy
 
Parallel and Distributed Computing Chapter 6
Parallel and Distributed Computing Chapter 6Parallel and Distributed Computing Chapter 6
Parallel and Distributed Computing Chapter 6
 
Chapter 6-Consistency and Replication.ppt
Chapter 6-Consistency and Replication.pptChapter 6-Consistency and Replication.ppt
Chapter 6-Consistency and Replication.ppt
 
6.distributed shared memory
6.distributed shared memory6.distributed shared memory
6.distributed shared memory
 
CS8603_Notes_003-1_edubuzz360.pdf
CS8603_Notes_003-1_edubuzz360.pdfCS8603_Notes_003-1_edubuzz360.pdf
CS8603_Notes_003-1_edubuzz360.pdf
 
CHP-4.pptx
CHP-4.pptxCHP-4.pptx
CHP-4.pptx
 
Designing Application over mobile environment
Designing Application over mobile environmentDesigning Application over mobile environment
Designing Application over mobile environment
 
Chapter 10
Chapter 10Chapter 10
Chapter 10
 
Dos unit3
Dos unit3Dos unit3
Dos unit3
 
Distributed system notes unit I
Distributed system notes unit IDistributed system notes unit I
Distributed system notes unit I
 
01-MessagePassingFundamentals.ppt
01-MessagePassingFundamentals.ppt01-MessagePassingFundamentals.ppt
01-MessagePassingFundamentals.ppt
 
Lec+3-Introduction-to-Distributed-Systems.pdf
Lec+3-Introduction-to-Distributed-Systems.pdfLec+3-Introduction-to-Distributed-Systems.pdf
Lec+3-Introduction-to-Distributed-Systems.pdf
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMS
 
Parallel Processing (Part 2)
Parallel Processing (Part 2)Parallel Processing (Part 2)
Parallel Processing (Part 2)
 
Compiler design
Compiler designCompiler design
Compiler design
 
distcomp.ppt
distcomp.pptdistcomp.ppt
distcomp.ppt
 
distcomp.ppt
distcomp.pptdistcomp.ppt
distcomp.ppt
 
distcomp.ppt
distcomp.pptdistcomp.ppt
distcomp.ppt
 
Replication in Distributed Systems
Replication in Distributed SystemsReplication in Distributed Systems
Replication in Distributed Systems
 

Plus de Aravind NC (7)

MC0082 –Theory of Computer Science
MC0082 –Theory of Computer ScienceMC0082 –Theory of Computer Science
MC0082 –Theory of Computer Science
 
Master of Computer Application (MCA) – Semester 4 MC0080
Master of Computer Application (MCA) – Semester 4  MC0080Master of Computer Application (MCA) – Semester 4  MC0080
Master of Computer Application (MCA) – Semester 4 MC0080
 
Master of Computer Application (MCA) – Semester 4 MC0079
Master of Computer Application (MCA) – Semester 4  MC0079Master of Computer Application (MCA) – Semester 4  MC0079
Master of Computer Application (MCA) – Semester 4 MC0079
 
Master of Computer Application (MCA) – Semester 4 MC0078
Master of Computer Application (MCA) – Semester 4  MC0078Master of Computer Application (MCA) – Semester 4  MC0078
Master of Computer Application (MCA) – Semester 4 MC0078
 
Master of Computer Application (MCA) – Semester 4 MC0077
Master of Computer Application (MCA) – Semester 4  MC0077Master of Computer Application (MCA) – Semester 4  MC0077
Master of Computer Application (MCA) – Semester 4 MC0077
 
Master of Computer Application (MCA) – Semester 4 MC0076
Master of Computer Application (MCA) – Semester 4  MC0076Master of Computer Application (MCA) – Semester 4  MC0076
Master of Computer Application (MCA) – Semester 4 MC0076
 
Google x
Google xGoogle x
Google x
 

Dernier

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Dernier (20)

Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 

MC0085 – Advanced Operating Systems - Master of Computer Science - MCA - SMU DE

  • 1. MC0085 – Advanced Operating Systems Question 1 - What is a message passing system? Discuss the desirable features of a message passing system? Message passing is the paradigm of communication where messages are sent from a sender to one or more recipients. Forms of messages include (remote) method invocation, signals, and data packets. Message passing systems have been called "shared nothing" systems because the message passing abstraction hides underlying state changes that may be used in the implementation of sending messages. Messages are also commonly used in the same sense as a means of inter-process communication; the other common technique being streams or pipes, in which data are sent as a sequence of elementary data items instead (the higher-level version of a virtual circuit). Features Simplicity Uniform Semantics o Local communication (communicating processes are on the same node) o Remote communication (communicating processes are on diff. nodes ) Efficiency ( critical issue, cost effective) Optimizations o Reducing the no. of message exchanges o Minimize the cost of maintaining the connections o Piggybacking of acknowledges Reliability (D.S is prone to node crashes or communication. link failure) o lost messages o duplicate messages Correctness o Atomicity o Ordered delivery o Survivability Flexibility Security o Authentication o Encryption Portability o Message passing sys. should itself be portable o Applications written by using the primitives of the IPC protocols should be portable. Question 2 - Discuss the implementation of RPC Mechanism in detail. A remote procedure call (RPC) is an inter-process communication that allows a computer program to cause a subroutine or procedure to execute in another address space (commonly on another computer on a shared network) without the programmer explicitly coding the details for this remote interaction. That is, the programmer writes essentially the same code whether the subroutine is local to the executing program, or remote. When the software in question uses object-oriented principles, RPC is called remote invocation or remote method invocation. Message passing An RPC is initiated by the client, which sends a request message to a known remote server to execute a specified procedure with supplied parameters. The remote server sends a response to the client, and the application continues its process. There are many variations and subtleties in various implementations, resulting in a variety of different (incompatible) RPC protocols. While the server is processing the call, the client is blocked (it waits until the server has finished processing before resuming execution).
  • 2. An important difference between remote procedure calls and local calls is that remote calls can fail because of unpredictable network problems. Also, callers generally must deal with such failures without knowing whether the remote procedure was actually invoked. Idempotent procedures (those that have no additional effects if called more than once) are easily handled, but enough difficulties remain that code to call remote procedures is often confined to carefully written low-level subsystems. Sequence of events during a RPC The client calls the Client stub. The call is a local procedure call, with parameters pushed on to the stack in the normal way. The client stub packs the parameters into a message and makes a system call to send the message. Packing the parameters is called marshalling. The kernel sends the message from the client machine to the server machine. The kernel passes the incoming packets to the server stub. Finally, the server stub calls the server procedure. The reply traces the same steps in the reverse direction. Question 3 - Discuss the following with respect to Distributed Shared Memory: a) Memory Coherence (Consistency) Models Memory Consistency Model is: A set of rules that the applications must obey if they want the DSM system to provide the degree of consistency guaranteed by the consistency model. • Weaker the consistency model, better the concurrency. • Researchers try to invent new consistency models which are weaker than the existing ones in such a way that a set of applications will function correctly under the new consistency model. • Note that an application written for a DSM that implements a stronger consistency model may not work correctly under a DSM that implements a weaker consistency model b) Memory Consistency models i. Strict consistency: Each read operation returns the most recently written value. This is possible to implement only in systems with the notion of global time. So,this model is impossible to implement. Hence, DSM systems based on underlying distributed systems have to use weaker consistency models. ii. Sequential consistency: All processes in the system observe the same order of all memory access operations on the shared memory. i.e. , if three operations read(r1), write(w1) and read(r2) are performed on a memory address in that order, then any of the six orderings (r1,w1, r2), (r2,w1,r1), (w1, r2, r1).... is acceptable provided all processes see the same ordering. iii. Causal consistency model: In this model, all write operations that are potentially causally related are seen by all processes in the same (correct) order. For example, if a process did a read operation and then performed a write operation, then the value written may have depended in some way on the value read. A write operation performed by one process P1 is not causally related to the write operation performed by another process P2 if P1 has read neither the value written by P2 or any memory variable that was directly or indirectly derived from the value written by P2 and vice versa. iv. Pipelined Random: Access Memory (PRAM) consistency model. In this model, all write operations performed by a single process are seen by all other processes in the order in which they were performed. This model can be implemented easily by sequencing the write operations performed by each node independently. This model is weaker than all the above consistency models. v. Processor Consistency Model: In addition to PRAM consistency, for any memory location, all processes agree on the same order of all write operations to that location. vi. Weak Consistency Model: This model distinguishes between ordinary accesses and synchronization accesses. It requires that memory become consistent only on synchronization accesses. ADSM that supports weak consistency model uses a special variable, called
  • 3. vii. viii. c) synchronization variable. The operations on it are used to synchronize memory. For supporting weak consistency, the following should be satisfied: All accesses to synchronization variables must obey sequential consistency semantics. Release Consistency Model: In the weak consistency model, the entire shared memory is synchronized when a synchronization variable is accessed by a process i.e. All changes made to the memory are propagated to other nodes. All changes made to the memory by other processes are propagated from other nodes to the process’s node. Lazy Release consistency model: It is a variation of release consistency model. In this approach, when a process does a release access, the contents of all the modifications are not immediately sent to other nodes but they are sent only on demand. i.e. When a process does an acquire access, all modifications of other nodes are acquired by the process’s node. It minimizes network traffic. Implementing Sequential Consistency Sequential consistency supports the intuitively expected semantics. So, this is the most preferred choice for designers of DSM system. The replication and migration strategies for DSM design include: Non-replicated, non-migrating blocks (NRNMBs) Non-replicated, migrating blocks (NRMBs) Replicated, migrating blocks (RMBs) Replicated, non-migrating blocks (RNMBs). Implementing under NRNMBs strategy: Under this strategy, only one copy of each block of the shared memory is in the system and its location is fixed. All requests for a block are sent to the owner node of the block. Upon receiving a request from a client node, the memory management unit (MMU) and the operating system of the owner node perform the access request and return the result. Sequential consistency can be trivially enforced, because the owner node needs to only process all requests on a block in the order it receives. Disadvantage: Parallelism is not possible in this strategy Mapping between blocks and nodes need to be maintained at each node. Implementing under NRMBs strategy Under this strategy, only the processes executing on one node can read or write a given data item at any time, so sequential consistency is ensured. The advantages of this strategy include: No communication cost for local data access. Allows applications to take advantage of data access locality The disadvantages of this strategy include: Prone to thrashing Parallelism cannot be achieved in this method also Locating a block in the NRMB strategy. d) Centralized – Server Algorithm A central server maintains a block table containing owner-node and copy-set information for each block. When a read/write fault for a block occurs at node N, the fault handler at node N sends a read/write request to the central server. Upon receiving the request, the central-server does the following:
  • 4. If it is a read request: adds N to the copy-set field and sends the owner node information to node N Upon receiving this information, N sends a request for the block to the owner node. Upon receiving this request, the owner returns a copy of the block to N. If it is a write request: It sends the copy-set and owner information of the block to node N and initializes copy-set to {N} Node N sends a request for the block to the owner node and an invalidation message to all blocks in the copy-set. Upon receiving this request, the owner sends the block to node N Question 4 - Explain the following with respect to Resource Management in Distributed Systems: a) Task assignment Approach Each process is viewed as a collection of tasks. These tasks are scheduled to suitable processor to improve performance. This is not a widely used approach because: · · · · · · · It requires characteristics of all the processes to be known in advance. This approach does not take into consideration the dynamically changing state of the system. In this approach, a process is considered to be composed of multiple tasks and the goal is to find an optimal assignment policy for the tasks of an individual process. The following are typical assumptions for the task assignment approach: Minimize IPC cost (this problem can be modeled using network flow model) Efficient resource utilization Quick turnaround time A high degree of parallelism b) Load – Balancing Approach In this, the processes are distributed among nodes to equalize the load among all nodes. The scheduling algorithms that use this approach are known as Load Balancing or Load Leveling Algorithms. These algorithms are based on the intuition that for better resource utilization, it is desirable for the load in a distributed system to be balanced evenly. We can have the following categories of load balancing algorithms: Static: Ignore the current state of the system. E.g. if a node is heavily loaded, it picks up a task randomly and transfers it to a random node. These algorithms are simpler to implement but performance may not be good. Dynamic: Use the current state information for load balancing. There is an overhead involved in collecting state information periodically; they perform better than static algorithms. Deterministic: Algorithms in this class use the processor and process characteristics to allocate processes to nodes. Probabilistic: Algorithms in this class use information regarding static attributes of the system such as number of nodes, processing capability, etc. Centralized: System state information is collected by a single node. This node makes all scheduling decisions.
  • 5. Distributed: Most desired approach. Each node is equally responsible for making scheduling decisions based on the local state and the state information received from other sites. Cooperative: A distributed dynamic scheduling algorithm. In these algorithms, the distributed entities cooperate with each other to make scheduling decisions. Therefore they are more complex and involve larger overhead than non-cooperative ones. But the stability of a cooperative algorithm is better than of a non-cooperative one. Non-Cooperative: A distributed dynamic scheduling algorithm. In these algorithms, individual entities act as autonomous entities and make scheduling decisions independently of the action of other entities. c) Load – Sharing Approach Several researchers believe that load balancing, with its implication of attempting to equalize workload on all the nodes of the system, is not an appropriate objective. This is because the overhead involved in gathering the state information to achieve this objective is normally very large, especially in distributed systems having a large number of nodes. In fact, for the proper utilization of resources of a distributed system, it is not required to balance the load on all the nodes. It is necessary and sufficient to prevent the nodes from being idle while some other nodes have more than two processes. This rectification is called the Dynamic Load Sharing instead of Dynamic Load Balancing. The design of a load sharing algorithms require that proper decisions be made regarding load estimation policy, process transfer policy, state information exchange policy, priority assignment policy, and migration limiting policy. It is simpler to decide about most of these policies in case of load sharing, because load sharing algorithms do not attempt to balance the average workload of all the nodes of the system. Rather, they only attempt to ensure that no node is idle when a node is heavily loaded. The priority assignments policies and the migration limiting policies for load-sharing algorithms are the same as that of load-balancing algorithms. Question 5 - Explain the following with respect to Distributed File Systems: a) The Key Challenges of Distributed Systems i) Transparency · Location: a client cannot tell where a file is located · Migration: a file can transparently move to another server · Replication: multiple copies of a file may exist · Concurrency: multiple clients access the same file ii) Flexibility - In a flexible DFS it must be possible to add or replace file servers. Also, a DFS should support multiple underlying file system types (e.g., various Unix file systems, various Windows file systems, etc.) iii) Reliability - In a good distributed file system, the probability of loss of stored data should be minimized as far as possible. i.e. users should not feel compelled to make backup copies of their files because of the unreliability of the system. iv) Consistency: Employing replication and allowing concurrent access to files may introduce consistency problems. v) Security: Clients must authenticate themselves and servers must determine whether clients are authorized to perform requested operation. Furthermore communication between clients and the file server must be secured. vi) Fault tolerance: Clients should be able to continue working if a file server crashes. Likewise, data must not be lost and a restarted file server must be able to recover to a valid state.
  • 6. vii) Performance: In order for a DFS to offer good performance it may be necessary to distribute requests across multiple servers. Multiple servers may also be required if the amount of data stored by a file system is very large. viii) Scalability: A scalable DFS will avoid centralized components such as a centralized naming service, a centralized locking facility, and a centralized file store. A scalable DFS must be able to handle an increasing number of files and users. b) Client’s Perspective: File Services The File service interface represents files as an uninterpreted sequence of bytes that are associated with a set of attributes (owner, size, creation date, permissions, etc.) including information regarding protection (i.e., access control lists or capabilities of clients). Moreover, there is a choice between the upload/download model and there mote access model. In the first model, files are downloaded from the server to the client. Modifications are performed directly at the client after which the file is uploaded back to the server. In the second model all operations are performed at the server itself,with clients simply sending commands to the server. c) File Access Semantics Ideally, the client would perceive remote files just like local ones. Unfortunately,the distributed nature of a DFS makes this goal hard to achieve. In the following discussion, we present the various file access semantics available, and discuss how appropriate they are to a DFS. Session Semantics: In the case of session semantics, changes to an open file are only locally visible. Only after a file is closed, are changes propagated to the server (and other clients). This raises the issue of what happens if two clients modify the same file simultaneously. It is generally up to the server to resolve conflicts and merge the changes. Another problem with session semantics is that parent and child processes cannot share file pointers if they are running on different machines. Immutable Files: Immutable files cannot be altered after they have been closed. In order to change a file, instead of overwriting the contents of the existing file a new file must be created. This file may then replace the old one as a whole. This approach to modifying files does require that directories (unlike files) be updatable. Problems with this approach include a race condition when two clients try to replace the same file as well as the question of what to do with processes that are reading a file at the same time as it is being replaced by another process. Atomic Transactions: In the transaction model, a sequence of file manipulations can be executed indivisibly, which implies that two transactions can never interfere. This is the standard model for databases, but it is expensive to implement. d) Server’s Perspective Implementation Observation about the expected use of a file system can be used to guide the design of a DFS. · Most files are small –less than 10k · Reading is much more common than writing · Usually access is sequential; random access is rare · Most files have a short lifetime · File sharing is unusual · Most processes use only a few files · Distinct files classes with different properties exist. These usage patterns (small files, sequential access, high read-write ratio) would suggest that an update/download model for a DFS would be appropriate. Note, however, that different usage patterns may be observed at different kinds of institutions. In situations where the files are large, and are updated more often it may make more sense to use a DFS that implements a remote access model. Besides the usage characteristics, implementation tradeoffs may depend on the requirements of a DFS.
  • 7. e) Stateful Versus Stateless Servers The file servers that implement a distributed file service can be stateless or Stateful. Stateless file servers do not store any session state. This means that every client request is treated independently, and not as a part of a new or existing session. Stateful servers, on the other hand, do store session state. They may, therefore, keep track of which clients have opened which files, current read and write pointers for files, which files have been locked by which clients, etc. The main advantage of stateless servers is that they can easily recover from failure. Because there is no state that must be restored, a failed server can simply restart after a crash and immediately provide services to clients as though nothing happened. Furthermore, if clients crash the server is not stuck with abandoned opened or locked files. The main advantage of Stateful servers, on the other hand, is that they can provide better performance for clients. Because clients do not have to provide full file information every time they perform an operation, the size of messages to and from the server can be significantly decreased. Likewise the server can make use of knowledge of access patterns to perform read-ahead and do other optimizations. Stateful servers can also offer clients extra services such as file locking, and remember read and write positions. Question 6 - Describe the Clock Synchronization Algorithms and Distributed Algorithms in the context of Synchronization. Centralized Clock Algorithms In centralized clock synchronization algorithms one node has a real-time receiver. This node, called the time server node whose clock time is regarded as correct and used as the reference time. The goal of these algorithms is to keep the clocks of all other nodes synchronized with the clock time of the time server node. Depending on the role of the time server node, centralized clock synchronization algorithms are again of two types – Passive Time Sever and Active Time Server. 1. 2. Passive Time Server Centralized Algorithm: In this method each node periodically sends a message to the time server. When the time server receives the message, it quickly responds with a message (“time = T”), where T is the current time in the clock of the time server node. Assume that when the client node sends the “time = ?” message, its clock time is T0, and when it receives the “time = T” message, its clock time is T1. Since T0 and T1 are measured using the same clock, in the absence of any other information, the best estimate of the time required for the propagation of the message “time = T” from the time server node to the client’s node is (T1-T0)/2. Therefore, when the reply is received at the client’s node, its clock is readjusted to T + (T1-T0)/2. Active Time Server Centralized Algorithm: In this approach, the time server periodically broadcasts its clock time (“time = T”). The other nodes receive the broadcast message and use the clock time in the message for correcting their own clocks. Each node has a priori knowledge of the approximate time (Ta) required for the propagation of the message “time = T” from the time server node to its own node, Therefore, when a broadcast message is received at a node, the node’s clock is readjusted to the time T+Ta. A major drawback of this method is that it is not fault tolerant. If the broadcast message reaches too late at a node due to some communication fault, the clock of that node will be readjusted to an incorrect value. Another disadvantage of this approach is that it requires broadcast facility to be supported by the network. Centralized clock synchronization algorithms suffer from two major drawbacks: 1. They are subject to single – point failure. If the time server node fails, the clock synchronization operation cannot be performed. This makes the system unreliable. Ideally, a distributed system, should be more reliable than its individual nodes. If one goes down, the rest should continue to function correctly.
  • 8. 2. From a scalability point of view it is generally not acceptable to get all the time requests serviced by a single time server. In a large system, such a solution puts a heavy burden on that one process. Distributed Algorithms We know that externally synchronized clocks are also internally synchronized. That is, if each node’s clock is independently synchronized with real time, all the clocks of the system remain mutually synchronized. Therefore, a simple method for clock synchronization may be to equip each node of the system with a real time receiver so that each node’s clock can be independently synchronized with real time. Multiple real time clocks (one for each node) are normally used for this purpose. Theoretically, internal synchronization of clocks is not required in this approach. However, in practice, due to inherent inaccuracy of real-time clocks, different real time clocks produce different time. Therefore, internal synchronization is normally performed for better accuracy. One of the following two approaches is used for internal synchronization in this case. Global Averaging Distributed Algorithms: In this approach, the clock process at each node broadcasts its local clock time in the form of a special “resync” message when its local time equals T0+iR for some integer I, where T0 is a fixed time in the past agreed upon by all nodes and R is a system parameter that depends on such factors as the total number of nodes in the system, the maximum allowable drift rate, and so on. i.e. a resync message is broadcast from each node at the beginning of every fixed length resynchronization interval. However, since the clocks of different nodes run slightly different rates, these broadcasts will not happen simultaneously from all nodes. After broadcasting the clock value, the clock process of a node waits for time T, where T is a parameter to be determined by the algorithm. During this waiting period, the clock process records the time, according to its own clock, when the message was received. At the end of the waiting period, the clock process estimates the skew of its clock with respect to each of the other nodes on the basis of the times at which it received resync messages. It then computes a fault-tolerant average of the next resynchronization interval. The global averaging algorithms differ mainly in the manner in which the fault-tolerant average of the estimated skews is calculated. The simplest algorithm is to take the average of the estimated skews and use it as the correction for the local clock. However, to limit the impact of faulty clocks on the average value, the estimated skew with respect to each node is compared against a threshold, and skews greater than the threshold are set to zero before computing the average of the estimated skews. In another algorithm, each node limits the impact of faulty clocks by first discarding the m highest and m lowest estimated skews and then calculating the average of the remaining skews, which is then used as the correction for the local clock. The value of m is usually decided based on the total number of clocks (nodes).