Sunteți pe pagina 1din 22

Unit 5

Distributed operating systems - Clock synchronization algorithms – Threads – Design issues of


threaded packages – Design and implementation issues of processor allocation algorithms –
Distributed file system.

1. Clock Synchronization

Logical Clocks - to provide consistent event ordering


Physical Clocks - clocks whose values must not deviate from the real time by more than a certain
amount
Use of Synchronized Clocks

1. At-Most-Once Message Delivery


2. Clock-Based Cache Consistency

*********************************************************************************************
2. Clock Synchronization Algorithms

1. Cristian's Algorithm
2. The Berkeley Algorithm
3. Averaging Algorithms
4. Multiple External Time Sources

Cristian's Algorithm (Absolute Clock Synchronization)


The Berkeley Algorithm (Relative Clock Synchronization)
Averaging Algorithms (decentralized clock synchronization algorithm)
• Divide time into fixed-length resynchronization intervals.
• The ith interval starts at T0+iR and runs until T0+(i+1)R, where T0 is an agreed upon moment in
the past, and R is a system parameter.
• At the beginning of each interval, every machine broadcasts the current time according to its
clock.

Multiple External Time Sources

*********************************************************************************************
3. Threads

1. Introduction to Threads
2. Thread Usage
3. Design Issues for Threads Packages
4. Implementing a Threads Package
a. Implementing Threads in User Space
b. Implementing Threads in the Kernel
c. Scheduler Activations
5. Threads and RPC

1. Introduction to Threads

Thread or lightweight process


Each thread runs strictly sequentially and has its own program counter and stack to keep track of
where it is.
Memory layout for a multithreaded process

2. Thread Usage
3. Design Issues for Threads Packages

A set of primitives (e.g., library calls) available to the user relating to threads is called a threads
package.

One technique that is commonly used in threads packages is the mutex, which is a kind of watered-
down semaphore. A mutex is always in one of two states, unlocked or locked. Two operations are
defined on mutexes. The first one, LOCK, attempts to lock the mutex. If the mutex is unlocked,
the LOCK succeeds and the mutex becomes locked in a single atomic action.
create_global("bufptr");
set_global("bufptr", &buf);
bufptr = read_global("bufptr");

4. Implementing a Threads Package

a. Implementing Threads in User Space


b. Implementing Threads in the Kernel
c. Scheduler Activations

5. Threads and RPC

*********************************************************************************************
4. Processor Allocation

1. Allocation Models
2. Design Issues for Processor Allocation Algorithms
3. Implementation Issues for Processor Allocation Algorithms
4. Example Processor Allocation Algorithms
a. A Graph-Theoretic Deterministic Algorithm
b. A Centralized Algorithm
c. A Hierarchical Algorithm
d. A Sender-Initiated Distributed Heuristic Algorithm
e. A Receiver-Initiated Distributed Heuristic Algorithm
f. A Bidding Algorithm

A distributed system consists of multiple processors. These may be organized as a collection of


personal workstations, a public processor pool, or some hybrid form.

1. Allocation Models

Nonmigratory allocation algorithms:


When a process is created, a decision is made about where to put it. once placed on a machine,
the process stays there until it terminates.

Migratory allocation algorithms:


A process can be moved even if it has already started execution. while migratory strategies
allow better load balancing, they are more complex and have a major impact on system design.

Goals:
• Maximize CPU utilization - maximize the number of cpu cycles.
• Minimize mean response time - minimize the response ratio.

2. Design Issues for Processor Allocation Algorithms

5 Issues
1. Deterministic versus heuristic algorithms.
2. Centralized versus distributed algorithms.
3. Optimal versus suboptimal algorithms.
4. Local versus global algorithms.
5. Sender-initiated versus receiver-initiated algorithms.
3. Implementation Issues for Processor Allocation Algorithms
• Measuring Load
i. Count The Number Of Processes On Each Machine
ii. Count Only Processes That Are Running Or Ready
iii. Fraction Of Time The CPU Is Busy
iv. Fraction Of Time Spent In The Idle Loop
• Timer Interrupts
• How Overhead Is Dealt With
• Complexity
i. Seldom
• Stability

4. Example Processor Allocation Algorithms

a. A Graph-Theoretic Deterministic Algorithm

b. A Hierarchical Algorithm
c. A Centralized Algorithm

d. A Sender-Initiated Distributed Heuristic Algorithm


Overloaded server
1. Sender picks a machine at random and sends process there. If receiver cannot handle it, it
randomly picks another machine, etc., until some machine accepts it or a hop count is exceeded
2. Sender picks a machine at random and sends a probe to enquire about its availability. Continues
until machine accepts process or probe limit is exceeded
3. Sender probes k machines for their loads. Sends process to machine with lowest load.

e. A Receiver-Initiated Distributed Heuristic Algorithm


Under loaded receiver
1. When a machine is idle, it sends a probe to a randomly chosen computer to ask for work
2. Continues until somebody sends it work, or timer lapses
3. Better than previous algo when system is overloaded

f. A Bidding Algorithm

*********************************************************************************************
5. Distributed File Systems

1. Distributed File System Design

a. The File Service Interface


b. The Directory Server Interface

i. Naming Transparency

ii. Two-Level Naming


Most distributed systems use some form of two-level naming.
• Files (and other objects) have symbolic names such as prog.c, for use by people,
• But they can also have internal, binary names for use by the system itself.
Symbolic Link
A symbolic link is a directory entry that maps onto a (server, file name) string, which can be looked up
on the server named to find the binary name. The symbolic link itself is just a path name.

2. Semantics of File Sharing


3. Distributed File System Implementation

a. File Usage

b. System Structure
c. Caching

Various ways of doing caching in client memory.


(a) No caching.
(b) Caching within each process.
(c) Caching in the kernel.
(d) The cache manager as a user process.
i. Cache Consistency

d. Replication

i. Update Protocols
4. An Example: Sun's Network File System
Sun Microsystem's Network File System (NFS)
a. NFS Architecture
b. NFS Protocols
c. NFS Implementation
Figure: NFS layer structure
5. Trends In Distributed File Systems

a. New Hardware
b. Scalability
c. Wide Area Networking
d. Mobile Users
e. Fault Tolerance
f. Multimedia

*********************************************************************************************

S-ar putea să vă placă și