Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 41

PROCESS & RESOURCE MANAGEMENT

Process Management: Process Migration, Resource


Management: Introduction- Load Balancing Approach – Load
Sharing Approach- Deadlocks-Models of Deadlock-Deadlock
Detection in distributed systems.
Process

• An operating system abstraction representing an instance of a running computer


program.
• Consists of data, stack, register contents, and the state specific to the underlying
OS.
• Can have one or more threads of control.
• Consists of their own stack and register contents but share a process’s
address space and signals.
Process Management

• Conventional OS deals with the mechanism and policies for sharing the processor
of the system among all processes.
• Distributed Operating System To make best possible use of the processing
resources of the entire system by sharing them among all processes.
• Three concepts to achieve this goal:
• Processor allocation: Deals with the process of deciding which
process should be assigned to which processor.
• Process migration: Deals with the movement of a process from its current
location to the processor to which it has been assigned.
• Threads: Deals with fine-grained parallelism for better utilization of the
processing capability of the system.
Process Migration

• Relocation of a process from its current location to another node.


• Process may be migrated:
• Before it starts executing on its source node (non-preemptive process
migration)
• Or during the course of its execution (preemptive process migration)
Process Migration
Desirable Features
• Transparency
• Object class level
• System call and interprocess communication level
• Minimal Interference
• Can be done by minimizing freezing time
• Freezing time: a time for which the execution of the process is stopped for transferring its information to the
destination node.
• Minimal Residual Dependencies
• Migrated process should not continue to depend on its previous node once it has started executing on new
node
• Efficiency
• Time required of migrating a process
• The cost of locating an object
• The cost of supporting remote execution once the process is migrated
• Robustness
• The failure of a node other than the one on which a should not affect the execution of that process
• Communication between coprocesses of a job
• Directly able to communicate with each other irrespective of their location.
Process Migration: Benefits

• Better response time and execution speed-up


• Dynamic load balancing among multiple nodes
• Higher throughput and effective resource utilization
• Migrating I/O and CPU-bound processes to file and cycle servers.
• Reducing network traffic
• Migrating processes closer to the resources they are using most heavily.
• Improving system reliability
• Migrating processes from a site in failure to more reliable sites.
• Replicating and migrating critical processes to a remote.
Process Migration Mechanism

• Four major activities


1. Freezing the process on its source node and restarting it on its destination
node.
2. Transferring the process’s address space from its source node to its destination
node.
3. Forwarding messages meant for the migration process.
4. Handling communication between cooperating processes that have been
separated as a result of process migration.
Mechanism of freezing and restarting a process

• Freezing the process:


The execution of the process is suspended in the source node and the state of
information is transferrer to its destination node and from there it is restarted.

• Issues:
1. Immediate and delayed blocking of the process
2. Fast and slow I/O operations
3. Information about open files
4. Reinstating the process on its destination node
Reinstating the process on its Destination node:

• On the destination node, an empty process state is created.


• Once all the state of the migrating process has been transferred from the sources
to destination node and copied into the empty state, new copy of the process is
unfrozen and old copy is deleted.
• The process is restarted on its destination node in whatever state it was in before
being migrated.
Address space Transfer Mechanism

• The migration of a process involves the transfer of following information from the
source node to the destination node.
• Process’s state (Computation state, Communication state)
• Process’s address space (Code, data, program stack)
• Possible to transfer the address space without stopping its execution.
• Not possible to resume execution until the state information is fully transferred.
• Three methods for address space transfer
1. Total freezing
2. Pre-transferring
3. Transfer on reference
 Total Freezing
Source node destination node
 Execution is stopped
Time
while its address Execution
is suspended Migration
decision
space being
transferred made

 Process is suspended
for a long Transfer of
address
time during Freezing
Time
space
Execution
migration resumed

 Simple and easy


to implement
 Not suitable
for interactive
process
 Pretransferring (precopying) destination node
Source node
 Address space is transferred
Time
while the process is still running
on the source node Migration decision
made
 Initial transfer of the
address space followed by Execution suspended
complete
repeated transfers of the Transfer of
address
Freezing
modified during previous transfer
pages space
Time
Execution
 Remaining modified pages resumed
retransferred
are after the process is
frozen for transferring its state
information
 freezing time is reduced
 Pretransfer operation is executed
at a higher priority than
all other programs
on the source node
Total time of migration is increased due to the possibility of redundant page
transfers
 Transfer on reference Source destination
node node
 Based on the assumption that Time
the process tends to use only a
Execution Migration
relatively small part of their Freezing suspended decision
address space while Time made
Execution
executing. resumed
 A
transferred
page of thefrom
address
itsspace is On demand
node
sourceto destination node only Transfer of
when referenced address space

 Demand driven copy on


reference approach
Switching time is very short and independent of the size of the address space
Not efficient in terms of cost
Imposes continued load on process’s source node
Results in failure if source node fails or reboots
Message Forwarding mechanism

Resending the message


Messages are returned to the sender as not deliverable or are simply dropped, with
the assurance that the sender of the message is storing a copy of the data and is
prepared to retransmit it.

Disadvantage:
The message forwarding mechanism of process migration operation is non-
transparent to the process interacting with the migrant process.
Origin site Mechanism
• Each site is responsible for keeping information about the current location of all
the processes created on it.
• Messages for a particular process are always first sent to its original site.
• The origin site then forwards the message to the process’s current location.

Disadvantage:
• Failure of the origin site will disrupt the message forwarding mechanism.
Link Traversal Mechanism
• To redirect message, a message queue for the migrant process is created on its
source node.
• A forwarding address known as link is left at the source node pointing to the
destination of the migrant process.
• Components of link: unique process identifier, last known location.

Disadvantage:
Several link may have to be traversed to locate a process from a node and if any
node in chain of link fails, the process cannot be located.
Link update Mechanisms

Link update message


• Tells the new address of each link held by the migrant process.
• Acknowledged for synchronization purposes.
Mechanism for Handling Coprocesses

• To provide efficient communication between a process and its sub processes


which might have been migrated on different nodes.

Mechanism:
• Disallowing separation of coprocesses.
• Home node or original site concept.
Disallowing Separation of coprocesses
• Easiest method of handling communication between coprocesses is to disallow
their separation.

Methods:
• By Disallowing the migration of processes that wait for one or more of their
children to complete.
• By ensuring that when a parent process migrates, its children process will be
migrated along with it.
• Disadvantage: It does not allow the use of parallelism within jobs.
Home node or Origin Sites Concept
• Used for communication between a process and its sub process when the two are
running on different nodes.
• Allows the complete freedom of migrating a process or its sub process
independently and executing them on different nodes of the system.

• Disadvantage: All communication between a parent process and its children


processes take place via the home node.
• The message traffic and communication cost increase considerably.
Advantages of process
migration
 Reducing average response time of processes
 Speeding up individual jobs
 Execute tasks of a job concurrently
 To migrate a job to a node having faster CPU
 Gaining higher throughput
 Using suitable load balancing policy
 Utilizing resources effectively
 Depending on the nature of the process, it can be migrated to the most suitable node
 Reducing network traffic
 Migrate the process closer to the resources it is using most heavily
 To migrate and cluster two or more processes which frequently
communicate with each other, on the same node
 improving system reliability
 Migrating critical process to more reliable node
 Improving system security
 A sensitive process may be migrated and run on the secure node
Resource Management in
Distributed Systems
• Distributed systems contain a set of resources interconnected by a network
• Processes are migrated to fulfill their resource requirements
• Resource manager are to control the assignment of resources to processes
• Resources can be logical (shared file) or physical (CPU)
• We consider a resource to be a processor
Types of process scheduling techniques
• Task assignment approach
• User processes are collections of related tasks.
• Tasks are scheduled to improve performance.
• Load-balancing approach
• Tasks are distributed among nodes so as to equalize the workload of nodes of the
system
• Load-sharing approach
• Simply attempts to avoid idle nodes while processes wait for being
processed
Desirable features of a scheduling algorithm
• No need of Prior Knowledge about Processes
• User does not want to specify information about characteristic and requirements
• Dynamic in nature
• Decision should be based on the changing load of nodes and not on fixed static policy
• Quick decision-making capability
• Algorithm must make quick decision about the assignment of task to nodes of system
• Balanced system performance and scheduling overhead
• Great amount of information gives more intelligent decision, but increases overhead
• Stability
• Unstable when all processes are migrating without accomplishing any useful work
• It occurs when the nodes turn from lightly-loaded to heavily-loaded state and vice versa
• Scalability
• A scheduling algorithm should be capable of handling small as well as large networks
•Fault tolerance
• Should be capable of working after the crash of one or more nodes of the system
• Fairness of Service
• More users initiating equivalent processes expect to receive the same quality of service
Load Balancing Approach

• Maximizes total system throughput.


Static versus Dynamic
•Static algorithms use only information about the average behavior of the system.
•Static algorithms ignore the current state or load of the nodes in the system.
•Dynamic algorithms collect state information and react to system state if it changed.
•Static algorithms are much more simpler.
•Dynamic algorithms are able to give significantly better performance.

Deterministic versus Probabilistic


•Deterministic algorithms use the information about the properties of the nodes and
the characteristic of processes to be scheduled.
•Probabilistic algorithms use information of static attributes of the system (e.g. number of
nodes, processing capability, topology) to formulate simple process placement rules.
•Deterministic approach is difficult to optimize.
•Probabilistic approach has poor performance.
Centralized versus Distributed
•Centralized approach collects information to server node and makes assignment
decision.
•Distributed approach contains entities to make decisions on a predefined set of
nodes.
•Centralized algorithms can make efficient decisions, have lower fault-tolerance.
•Distributed algorithms avoid the bottleneck of collecting state information and react
faster.
Cooperative versus Noncooperative
•In Noncooperative algorithms entities act as autonomous ones and make scheduling
decisions independently from other entities.
•In Cooperative algorithms distributed entities cooperate with each other.
•Cooperative algorithms are more complex and involve larger overhead.
•Stability of Cooperative algorithms are better.
Issues in designing Load-balancing algorithms
• Load estimation policy
• determines how to estimate the workload of a node
• Process transfer policy
• determines whether to execute a process locally or remote
• State information exchange policy
• determines how to exchange load information among nodes
• Location policy
• determines to which node the transferable process should be sent
• Priority assignment policy
• determines the priority of execution of local and remote processes
• Migration limiting policy
• determines the total number of times a process can migrate
Load-sharing approach
Drawbacks of Load-balancing approach
• Load balancing technique with attempting equalizing the workload on all the nodes
is not an appropriate object since big overhead is generated by gathering exact state
information.
• Load balancing is not achievable since number of processes in a node is always
fluctuating and temporal unbalance among the nodes exists every moment.
Basic ideas for Load-sharing approach
• It is necessary and sufficient to prevent nodes from being idle while some other
nodes have more than two processes.
• Load-sharing is much simpler than load-balancing since it only attempts to ensure
that no node is idle when heavily node exists.
• Priority assignment policy and migration limiting policy are the same as that for the
load-balancing algorithms.
Policies for load sharing

• Load estimation policies try only to check if a node is idle or busy, e.g. via measuring CPU
utilization.
• Process transfer policies May use single or double threshold policies i.e. in single, a node
already executing one process may transfer others. In double however, anticipation is a
factor i.e. nodes about to be underutilized are given more processes.
• Location Policies which may take the forms of:-
• Sender-initiated policy - in which sender node decides where to send process.
• Receiver-initiated policy - in which receiver node decides from where to get the
process.
• State information exchange policies A node normally exchanges state info only when its
state changes that takes either of the forms below.
• Broadcast when state changes.
• Poll when state changes.
DEADLOCK
• A deadlock occurs when a set of processes requests resources that are
already occupied by other processes in the group.
• Because each process possesses a resource and waits for another resource
held by another process, the execution of two or more processes is blocked.
Four requirements must be met for a deadlock to occur :
• Mutual Exclusion
At least one resource in the system must be able to be used by only one process at
a time.
• Hold & Wait
There must be a process that retains a resource while waiting for another resource
acquired by some other process.
• No Preemption
It means that resources cannot be taken forcefully from one process and handed
over to another.
• Circular Wait
All processes must wait for the resource in a cyclic fashion, with the last process
waiting for the first process’s resource.
Distributed system deadlocks

• A Distributed system is a Network of Machines that can exchange information with each other
through Message-passing.
• Helps in resource sharing.
• If the sequence of resource allocation to processes is not controlled, a deadlock may occur.
• COMMON METHODS TO HANDLE DEADLOCK:
Ignore
Detection
Prevent
Avoid
• Types of Distributed Deadlock:
Resource Deadlock
Communication Deadlock
Resource Deadlock
• A resource deadlock occurs when two or more processes wait permanently for
resources held by each other.
• A process that requires certain resources for its execution, and cannot proceed
until it has acquired all those resources.

Deadlock Situation: Suppose a system is running 2 processes P1 &


P2 and they want the resources R1 & R2.
P1 owns R1 & waits to get R2 resource while P2 owns R2 & waits to get
R1 resource. In this way, P1 waits for P2 to complete & P2 waits for P1 to
get complete & hence a deadlock.
• Process 1 has R1, R2, and requests resources R3. It will not execute if any one of
them is missing. It will proceed only when it acquires all requested resources i.e.
R1, R2, and R3.
Communication Deadlock

• A communication deadlock occurs among a set of processes when they are


blocked waiting for messages from other processes in the set in order to start
execution but there are no messages in transit between them.
• When there are no messages in transit between any pair of processes in the
set, none of the processes will ever receive a message.
• This implies that all processes in the set are deadlocked.
• Process waits for communicating with another process in a set of processes. In
a situation where each process in a set, is waiting to communicate with another
process which itself is waiting to communicate with some other process.
• In a Distributed System network, Process 1 is trying to communicate with Process
2, Process 2 is trying to communicate with Process 3 and Process 3 is trying to
communicate with Process 1. In this situation, none of the processes will get
unblocked and a communication deadlock occurs.
Difference between Resource and Communication Deadlocks in Distributed Systems :

S. No Communication Deadlock Resource Deadlock

In the communication model, before a process can


continue, it may know the identification of the It is not directly known which transaction is
1. processes from which it must receive a message to dependent on which other transaction.
communicate.

In the communication model, a process cannot In the resource allocation model, a process cannot
2. proceed with the execution until it can communicate proceed with the execution until it receives all the
with one of the processes for which it is waiting. resources for which it is waiting.

3. Waiting (by processes) is done for messages. Waiting (by processes) is done for resources.

If each process in the set is waiting to communicate If each process in the set seeks resources held by
with another process in the set, and no process in another process in the set, and it must obtain all the
4. the set ever begins any additional communication requested resources before it can become
until it receives the communication for which it is unblocked, the process set is resource-deadlocked.
waiting, the set is communication-Deadlocked.

5. Cannot be prevented by a safe state. Can be prevented by a safe state.

You might also like