Download - Distributed process and scheduling
![Page 1: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/1.jpg)
Distributed Process
1
![Page 2: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/2.jpg)
Contents
• Distributed process
• Process Management
– Processor allocation
– Process migration
– Threads
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 2
![Page 3: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/3.jpg)
References:
• Pradeep K. Sinha “Distributed Operation Systems : Concepts and Design” PHI.
• “Process Migration” Dejan S. Milojicic, Fred Douglis, Yves Paindaveine, Richard Wheeler and Songnian Zhou
13/04/2012
Distributed Systems, B.Tech.IV,
SVNIT,Surat 3
![Page 4: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/4.jpg)
Concept of Process
• 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.
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 4
![Page 5: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/5.jpg)
Process management
• Conventional OS:
– deals with the mechanisms 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
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 5
![Page 6: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/6.jpg)
Process management contd…
• 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
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 6
![Page 7: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/7.jpg)
Process Migration
• Process Migration:
– The act of transferring a process between two machines during its execution
– Relocation of a process from its current location (the source node) to another node(the destination node)
• Goals of Process Migration:
– Dynamic load distribution
– Fault resilience
– Improved system administration
– Data access locality
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 7
![Page 8: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/8.jpg)
Process Migration contd…
• Problems with Process Migration:
– Complexity of adding transparent migration
– Lack of compelling commercial argument for OS venders to support process migration
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 8
![Page 9: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/9.jpg)
Process Migration contd… • The flow of execution of a migrating process:
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 9
Source node destination node
Process P1 in
execution
Execution
suspended
Transfer of
control
Execution resumed
Process P1 in
execution
Time
Freezing
Time
![Page 10: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/10.jpg)
Process Migration contd…
• Two types:
– Preemptive process migration
• Process may be migrated during the course of its execution
– Non preemptive process migration
• Process may be migrated before it starts executing on its source node
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 10
![Page 11: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/11.jpg)
Process Migration contd…
• Involves three steps:
– Selection of a process that should be migrated
– Selection of the destination node to which the selected process should be migrated
– Actual transfer of the selected process to the destination node
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 11
![Page 12: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/12.jpg)
Desirable features
• Transperency
– 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 o 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
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 12
![Page 13: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/13.jpg)
Desirable features contd…
• Effiency
– 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 process is currently running should not affect the execution of that process
• Communication between Coprocesses of a job
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 13
![Page 14: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/14.jpg)
Process migration mechanisms
• Four major subactivities
– Freezing and restarting the process
– Transfer of process’s address space
– Forwarding messages meant for the migrant process
– Handling communication between cooperating processes
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 14
![Page 15: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/15.jpg)
Process migration mechanisms
• Mechanisms for freezing and restarting a process
– Immediate and Delayed blocking of the process
• may be blocked immediately or delayed
• if the process is not executing a system call
• if the process is executing a system call but is sleeping at an interruptible priority waiting for a kernel event to occur, it can be immediately blocked from further execution
• -Do- and sleeping at noninterruptible priority waiting for a kernel event to occur, it can not be blocked
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 15
![Page 16: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/16.jpg)
Process migration mechanisms
• Fast and Slow I/O operation
– frozen after the completion of all fast I/O operations
– What about slow I/O operations???
• Information about the open files
– No problem for network transparent execution environment
– What about UNIX like systems??? • creation of link
• Reconstruction of file’s path when required
– What about frequently used files like commands???
– What about temporary files?
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 16
![Page 17: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/17.jpg)
Mechanisms for freezing and restarting a process contd… • Reinstating the process on its destination
node
– Creation of a new process
– Process identifier
– What about the process which was blocked while executing a slow system call????
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 17
![Page 18: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/18.jpg)
UPTO THIS FOR MIDSEMESTER EXAM
13/04/2012 Distributed Systems, B. Tech I, SVNIT,
Surat 18
![Page 19: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/19.jpg)
Process migration mechanisms contd… • Address Space Transfer Mechanisms
– Information to be transferred from source node to destination node: • Process’s state information
• Process’s address space
– Difference between the size of process’s state information and address space
– Possible to transfer the address space without stopping its execution
– Not possible to resume execution until the state information is fully transferred
13/04/2012
Distributed Systems, B.Tech.IV,
SVNIT,Surat 19
![Page 20: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/20.jpg)
Address Space Transfer Mechanisms
• Three methods for address space transfer
– Total Freezing
– Pretransferring
– Transfer on reference
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 20
![Page 21: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/21.jpg)
Address Space Transfer Mechanisms (cont.)
• Total Freezing:
– Execution is stopped while its address space is being transferred
– Simple and easy to implement
– Process is suspended for a long time during migration
– Not suitable for interactive process
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 21
![Page 22: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/22.jpg)
Address Space Transfer Mechanisms(cont.)
• Total Freezing:
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 22
Source node destination node
Migration decision
made
Execution
suspended
Transfer of
address space
Execution resumed
Time
Freezing
Time
![Page 23: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/23.jpg)
Address Space Transfer Mechanisms (cont.)
• Pretransferring (precopying):
– Address space is transferred while the process is still running on the source node
– Initial transfer of the complete address space followed by repeated transfers of the pages modified during previous transfer
– Remaining modified pages are retransferred after the process is frozen for transferring its state information
– Pretransfer operation is executed at a higher priority than all other programs on the source node
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 23
![Page 24: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/24.jpg)
Pretransferring (precopying) (cont.)
– freezing time is reduced
– Total time of migration is increased due to the possibility of redundant page transfers
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 24
![Page 25: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/25.jpg)
Pretransferring(cont.)
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 25
Source node destination node
Migration decision
made
Execution
suspended
Transfer of
address space
Execution resumed
Time
Freezing
Time
![Page 26: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/26.jpg)
Address Space Transfer Mechanisms (cont.)
• Transfer on reference – Based on the assumption that the process tends to use only a
relatively small part of their address space while executing.
– A page of the address space is transferred from its source node to destination node only when referenced
– 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
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 26
![Page 27: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/27.jpg)
Transfer-on-reference
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 27
Source node destination node
Migration decision
made
Execution
suspended
On demand
Transfer of
address space
Execution resumed
Time
Freezing
Time
![Page 28: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/28.jpg)
Process migration mechanisms (cont.)
• Message forwarding mechanisms
– Ensures that all pending, en-route and future messages arrive at the process’s new location
– Classification of the messages to be forwarded:
• Type 1: Messages received at the source node after the process’s execution has been stopped on its source node and process’s execution has not yet been started on its destination node
• Type 2: Message received at the source node after the process’s execution has started on its destination node
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 28
![Page 29: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/29.jpg)
Message forwarding mechanisms contd…
• Type 3: Messages that are to be sent to the migrant process from any other node after it has started executing on the destination node
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 29
![Page 30: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/30.jpg)
Message forwarding mechanisms (cont.)
• Mechanism of Resending the Message
– Messages of type 1 and 2 are returned to the sender as not deliverable or are simply dropped
– Locating a process is required upon the receipt of the nonnegative reply (messages of type 3)
– Drawback: nontransparent to the processes interacting with the migrant process
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 30
![Page 31: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/31.jpg)
Message forwarding mechanisms (cont.)
• Origin Site Mechanism
– Process identifier has the process’s origin site(or home node) embedded in it
– Each site is responsible for keeping information about the current location of all the processes created on it
– Messages are sent to the origin site first and from there they are forwarded to the current location
– Drawbacks: • not good from reliability point of view
• continuous load on migrant process’s original site
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 31
![Page 32: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/32.jpg)
Message forwarding mechanisms (cont.)
• Link Traversal mechanism:
– Uses message queue for storing messages of type 1
– Use of link (a forwarding address) for messages of type 2 and 3
– Link has two components: process identifier and last known location of the process
– Migrated process is located by traversing a series of links
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 32
![Page 33: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/33.jpg)
Message forwarding mechanisms (cont.)
• Link Traversal mechanism:
– Drawbacks:
• poor efficiency
• poor reliability
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 33
![Page 34: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/34.jpg)
Message forwarding mechanisms (cont.)
• Link Update mechanism:
– Processes communicate via location independent links
– During the transfer phase, the source node sends link update message to all relevant kernels
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 34
![Page 35: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/35.jpg)
Process migration mechanisms (cont.)
• Mechanisms for handling coprocesses
– Communication between a process and its subprocesses
– Two different mechanisms
• Disallowing separation of Coprocesses
• home node or origin site concept
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 35
![Page 36: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/36.jpg)
Mechanisms for handling coprocesses
• Disallowing separation of Coprocesses
– 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 processes will be migrated along with it • Concept of logical host
• Process id is structured as {logical host-id, local-index} pair
– Drawback : • Does not allow parallelism within jobs
• Overhead is large when logical host contains several processes
13/04/2012
Distributed Systems, B.Tech.IV,
SVNIT,Surat 36
![Page 37: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/37.jpg)
Mechanisms for handling coprocesses
• home node or origin site concept
– Complete freedom of migrating a process or its subprocesses independently and executing them on different nodes
– Drawback:
• Message traffic and communication cost is significant
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 37
![Page 38: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/38.jpg)
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
13/04/2012
Distributed Systems, B.Tech.IV,
SVNIT,Surat 38
![Page 39: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/39.jpg)
Advantages of process migration(cont.)
• 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
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 39
![Page 40: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/40.jpg)
Distributed Scheduling
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 40
![Page 41: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/41.jpg)
Contents
• Distributed Scheduler
• Motivation
• Issues in load distributing
• Load distributing algorithms
• Load sharing policies
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 41
![Page 42: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/42.jpg)
References:
• Mukesh Singhal, Niranjan Shivaratri. “Advanced concepts in operating systems”. Tata McGraw Hill publication
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 42
![Page 43: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/43.jpg)
Introduction • Need for good resource allocation scheme for
DS
• Distributed scheduler:
A resource management component of a distributed operating system that focuses on judiciously and transparently redistributing the load of the system among the computers such that the overall performance of a system is maximized.
• More suitable for LANs than WANs
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 43
![Page 44: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/44.jpg)
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 44
![Page 45: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/45.jpg)
Motivation • Need for load distributing because of
– Random arrival of tasks
– Random CPU service requirements
• Needed both for heterogeneous and homogeneous systems
• E.g. system of N identical and independent servers Let p be the utilization for each server
P0 = 1 – p; the probability that a server is idle
P be the probability that the system is in a state in which at least one task is waiting for service and at least one server is idle
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 45
![Page 46: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/46.jpg)
Motivation contd…
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 46
![Page 47: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/47.jpg)
Motivation contd… • Some Observations:
– For moderate system utilization the value of P is high i.e. higher potential for load distribution
– At high system utilization the value of P is low i.e. lower potential for load distribution
– At low system utilization the value of P is again low
– As the number of the server in the system increases, P remains high even at high system utilization
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 47
![Page 48: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/48.jpg)
Issues in Load Distributing
• Some terminology
– Performance of a system
• one of the metric is average response time of task which is the length of the time interval between its origination and completion
– Defining proper load index
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 48
![Page 49: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/49.jpg)
Issues in Load Distributing contd…
• Load
– CPU queue length as a load indicator
– CPU utilization as a load indicator
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 49
![Page 50: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/50.jpg)
Classification of load distributing algorithms
• Goal of Load distributing algorithm
– To transfer load from heavily loaded computers to idle or lightly loaded computers
• broadly characterized as
– Static
• Decision is hard wired in the algorithm using a priory knowledge of the system
– Dynamic
• Make use of system state information to make load distributing decisions
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 50
![Page 51: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/51.jpg)
Classification of load distributing algorithms contd…
– Adaptive
• Special class of dynamic algorithm
• they adapt their activities by dynamically changing the parameters of the algorithm to suit the changing system state
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 51
![Page 52: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/52.jpg)
Load balancing vs. Load sharing
• unshared state :
– A state in which one computer lies idle while at the same time tasks contend for service at another computer
• to reduce the likelihood of unshared state
• Load balancing algo:
– Attempt to equalize the loads at all computers
– Higher overhead than load sharing algo
• anticipatory task transfer
– To reduce the duration of unshared state
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 52
![Page 53: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/53.jpg)
Preemptive vs. Nonpreemptive transfers • Preemptive:
– Transfer of a task that is partially executed
• Non preemptive:
– Transfer of a task that has not yet started execution
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 53
![Page 54: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/54.jpg)
Components of Load Distributing algorithm
• Four components
– Transfer policy • Determines whether a node is in a suitable state to participate in a
task transfer
– Selection policy • determines which task should be transferred
– Location policy • determines to which node a task selected for transfer should be
sent
– Information policy • responsible for triggering the collection of system state
information
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 54
![Page 55: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/55.jpg)
Transfer Policy
• Threshold policy
– Thresholds are expressed in terms of units of load
– Decided upon the origination of new task
– Concept of sender and receiver
• On detecting imbalance in load amongst nodes in system
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 55
![Page 56: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/56.jpg)
Selection Policy • Selects a task for transfer
• Simplest approach: to select the newly originated task
• Overhead incurred in task transfer should be compensated by the reduction in the response time realized by the task
• Factors to consider:
– Overhead incurred by transfer should be minimal
– Number of location dependent system calls made by the selected task should be minimal
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 56
![Page 57: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/57.jpg)
Location Policy • To find suitable nodes to share load(sender or
receiver)
• Widely used method : polling
– Either serially or in parallel
– Either randomly or on a nearest-neighbor basis
• Alternative to polling
– Broadcast a query to find out if any node is available for load sharing
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 57
![Page 58: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/58.jpg)
Information Policy • To decide when, where and what information
about the states of other nodes on the system should be collected
• One of three types:
– Demand driven
• Node collects the state of the other nodes only when it becomes either a sender or a receiver
• dynamic policy
• can be sender-initiated, receiver-initiated or symmetrically initiated
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 58
![Page 59: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/59.jpg)
Information Policy contd…
– Periodic
• Nodes exchange load information periodically
• Do not adapt their activity to the system state
• Benefits are minimal at high system loads ???
– State change driven
• Nodes disseminate state information whenever their state changes by a certain degree
• Centralized and decentralized policy
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 59
![Page 60: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/60.jpg)
Load distributing algorithms
• Sender initiated algorithms
• Receiver initiated algorithms
• Symmetrically initiated algorithms
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 60
![Page 61: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/61.jpg)
Sender-Initiated algorithms • Initiative by overloaded node (sender) to send a task
to an underloaded node(receiver)
• Transfer policy :
– Threshold policy based on CPU queue length
• Selection Policy:
– Consider only newly arrived tasks for transfer
• Location policy:
– Random : • no remote state information
• task is transferred to a node selected at random
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 61
![Page 62: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/62.jpg)
Sender-Initiated algorithms
– Random :
• Useless task transfer can occur
• Treating a transferred task
• Thrashing problem : – Solution : limit the number of times a task can be transferred
• Substantial performance improvement over no load sharing at all
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 62
![Page 63: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/63.jpg)
Sender-Initiated algorithms
– Threshold
• Polling a node to determine whether it is receiver or not
• PollLimit , limit on no. of nodes to poll
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 63
![Page 64: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/64.jpg)
Sender-Initiated algorithms
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 64
![Page 65: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/65.jpg)
Sender-Initiated algorithms
– Shortest
• Choose best receiver for a task
• Make use of CPU queue length
• Information policy
– Demand driven
• Stability
– Instability at high system load
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 65
![Page 66: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/66.jpg)
Receiver-Initiated Algorithms
• Initiation by an underloaded node (receiver)
• Transfer policy – Threshold policy based on CPU queue length.
– Triggered when the task departs
• Selection policy – Any
• Location policy – Threshold policy
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 66
![Page 67: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/67.jpg)
Receiver-Initiated Algorithms (cont.)
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 67
![Page 68: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/68.jpg)
Receiver-Initiated Algorithms (cont.)
• Information policy
– Demand-driven type.
• Stability
– Do not cause system instability at high load. Why????
– Do not cause system instability at low load. Why????
• Drawback
– Most transfers are preemptive.
– What about sender-initiated algorithms????
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 68
![Page 69: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/69.jpg)
Comparison of Sender-Initiated and Receiver-Initiated Algorithms
• Stability
• Robustness
– Has an edge over the sender-initiated policies.
• Performs acceptably with a single value of threshold over entire load spectrum while sender-initiated policies requires adaptive location policy
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 69
![Page 70: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/70.jpg)
Comparison of Sender-Initiated and Receiver-Initiated Algorithms contd…
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 70
![Page 71: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/71.jpg)
Symmetrically Initiated Algorithms
• Both senders and receivers search for receivers and senders respectively
• Advantages and disadvantages of both sender and receiver initiated algorithms.
• Above average algorithm.
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 71
![Page 72: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/72.jpg)
The above average algorithm
• Proposed by Krueger and Finkel
• Tries to maintain the load at each node within an acceptable range of system average
• Why not exact system average ????
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 72
![Page 73: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/73.jpg)
Transfer Policy • Use two adaptive thresholds:
– Equidistant from the node’s estimate of the average load across all nodes
– E.g. average load is 2 the lower threshold = 1 and the upper threshold = 3
• A node whose load is greater than upper threshold a sender
• A node whose load is less than lower threshold a receiver.
• Nodes that have loads between these thresholds lie within the acceptable range, so they are neither senders nor receivers.
13/04/2012
Distributed Systems, B.Tech.IV,
SVNIT,Surat 73
![Page 74: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/74.jpg)
Location Policy
• The location policy has the following two components: – Sender-initiated component
– Receiver-initiated component
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 74
![Page 75: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/75.jpg)
Sender-initiated component
• Sender node: – TooHigh message
– TooHigh timeout alarm
• Receiver node – TooLow timeout alarm
– accept message
– AwaitingTask timeout alarm
– Increases load before accepting a task. Why????
• What if sender receives TooLow message while waiting for Accept message??
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 75
![Page 76: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/76.jpg)
Sender-initiated component contd…
• On expiration of TooHigh timeout, if no Accept message is received, – Sender infers that its estimate of the average
system load is too low
– Hence, it broadcasts a ChangeAverage message to increase the average load estimate at the other nodes.
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 76
![Page 77: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/77.jpg)
Receiver-initiated component
• A node, on becoming a receiver, broadcasts a TooLow message, set a TooLow timeout, and starts listening for a TooHigh message.
• If a TooHigh message is received, the receiver performs the same actions that it does under sender-initiated negotiation
• If the TooLow timeout expires before receiving any TooHigh message, the receiver broadcasts a ChangeAverage message to decrease the average load estimate at the other nodes
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 77
![Page 78: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/78.jpg)
Selection and Information Policy
• Selection policy
– This algorithm can make use of any of the approaches discussed earlier.
• Information policy
– Demand-driven.
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 78
![Page 79: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/79.jpg)
Symmetrically initiated algorithm
• average system load is determined individually at each node
• load balancing actions adapts to the state of the communication network as well
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 79
![Page 80: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/80.jpg)
Adaptive Algorithms
• A stable symmetrically initiated algorithm
• A stable sender initiated algorithm
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 80
![Page 81: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/81.jpg)
A stable symmetrically initiated algorithm
• Instability in previous algorithms is due to indiscriminate polling by sender’s negotiation component.
• Utilize the information gathered during polling to classify the nodes in the system as either Sender/overloaded, Receiver/underloaded, or OK.
• The knowledge concerning the state of node is maintained by a data structure at each node: a sender list, a receiver list, and an OK list.
• Initially, each node assumes that every other node is a receiver.
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 81
![Page 82: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/82.jpg)
Transfer policy
• A threshold policy where decisions are based on CPU queue length.
• Trigger when a new task originates or when a task departs.
• Two threshold values: a lower threshold (LT), an upper threshold (UT).
• A node is said to be a sender if its queue length > UT, a receiver if its queue length < LT, and OK if LT ≤ node’s queue length ≤ UT.
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 82
![Page 83: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/83.jpg)
Location policy
• Sender initiated component
• Receiver initiated component
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 83
![Page 84: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/84.jpg)
Sender initiated component
• Triggered when node becomes sender
• Sender polls a node at the head of the receiver lists to determine whether it is receiver or not
• Processing at the polled node:
• Processing when the response arrives from the polled node:
• Polling stops if, – A suitable receiver is found
– The number of polls reaches a PollLimit
– The receiver list at the sender node becomes empty
– And the task is processed locally
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 84
![Page 85: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/85.jpg)
Receiver initiated component • Nodes polled are selected in following order,
– Head to tail in senders list
– Tail to head in OK list
– Tail to head in receivers list
• Receiver polls the selected node to determine whether it is sender
• Processing if polled node is sender
• Processing if polled node is not a sender
• Polling process stops if, – A sender is found
– If the receiver is no longer a receiver
– No. of polls reaches a PollLimit
13/04/2012
Distributed Systems, B.Tech.IV,
SVNIT,Surat 85
![Page 86: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/86.jpg)
Selection and Information Policy
• Selection policy:
– The sender initiated component considers only newly arrived tasks for transfer.
– The receiver initiated component can make use of any of the approaches discussed earlier.
• Information policy: demand-driven.
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 86
![Page 87: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/87.jpg)
Discussion
• Future sender initiated polls at high system loads are prevented. How???
• What about Receiver initiated component at low system load ???
• Positive effect of updating the receiver list
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 87
![Page 88: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/88.jpg)
A stable sender initiated algorithm
• Two desirable properties:
– It does not cause instability
– Load sharing is due to non-preemptive transfer only.
• Uses the sender initiated load sharing component of the stable symmetrically initiated algorithm
• Has a modified receiver initiated component to attract the future non-preemptive task transfers from sender nodes.
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 88
![Page 89: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/89.jpg)
A stable sender initiated algorithm
• The data structure (at each node) of the stable symmetrically initiated algorithm is augmented by a array called statevector.
• The statevector is used by each node to keep track of which list (senders, receivers, or OK) it belongs to at all the other nodes in the system.
• When a sender polls a selected node, the sender’s statevector is updated to reflect that the sender now belongs the senders list at the selected node, the polled node update its statevector based on the reply it sent to the sender node to reflect which list it will belong to at the sender
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 89
![Page 90: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/90.jpg)
A stable sender initiated algorithm
• The receiver initiated component is replaced by the following protocol: – When a node becomes a receiver, it informs all the nodes that are are
misinformed about its current state. The misinformed node are those nodes whose receivers lists do not contain the receiver’s ID.
– The statevector at the receiver is then updated to reflect that it now belongs to the receivers list at all those nodes that were informed of its current state.
– By this technique, this algorithm avoids the receivers sending broadcast messages to inform other nodes that they are receivers.
• No preemptive transfers of partly executed tasks here.
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 90
![Page 91: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/91.jpg)
Performance comparision
• Symmetrically initiated load sharing
• Stable load sharing algorithms
• Performance under heterogeneous workloads
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 91
![Page 92: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/92.jpg)
Symmetrically initiated load sharing
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 92
![Page 93: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/93.jpg)
Stable load sharing algorithms
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 93
![Page 94: Distributed process and scheduling](https://reader034.vdocument.in/reader034/viewer/2022042607/5560cadfd8b42a3c158b49a1/html5/thumbnails/94.jpg)
Selecting a suitable load sharing algorithm
1. System under consideration never attains high loads
2. Systems that can reach high loads
3. Systems that experiences a wide range of load fluctuations
4. Systems that experiences a wide range of fluctuations in load and has a high cost of the migration of partly executed tasks
5. Systems that experiences heterogeneous work arrival
13/04/2012 Distributed Systems, B.Tech.IV,
SVNIT,Surat 94