Distributed Scheduling 1 Motivation System performance can potentially be improved by appropriately transferring the load from heavily loaded computers to idle or lightly loaded computers. Load Resource (CPU) queue lengths are good indicators of load because they correlate well with the task response time. Measuring queue length is very straight forward and requires minimal processing. Simply using CURRENT queue length as a load indicator can result in a node accepting tasks while other tasks it accepted earlier are still in transit. CPU utilization another indicator of load. Involves background task that can require more processing. 2 Load distribution algorithms Static Dynamic Load balancing Load sharing Preemptive and non-preemptive transfers. 3 Static process scheduling Except for some very special cases, scheduling to optimize tasks span are NP-complete Algorithms attempt to approximate to obtain near optimal solution to the problem 4 Dynamic load sharing and load balancing The assumption of prior knowledge of processes is not realistic for most distributed applications Without knowledge of computational requirements we must rely on a decentralized dynamic process assignment Performance goals are: Maximum utilization of system Fairness to processes Improved throughput and computation time (or meeting real-time deadline) Load balancing is a stronger requirement than load sharing It achieves close to equal workload for each processor It has the effect of reducing the average turnaround time of the processes 5 Real-time scheduling Operating system must ensure that certain actions are taken within some specified time Hard real-time System is correct if every single task is guaranteed to meet its deadline Soft real-time System is working if not too many deadlines are missed The goal of real-time scheduling is to find a feasible schedule to meet all deadlines 6 Rate monotonic scheduling Simplest type of real-time scheduling Very popular and effective Assumptions: Tasks are periodic No communication is needed between tasks Task priorities are static Tasks with short periods have less time to complete before their deadline than tasks with longer deadlines High priority is assigned to tasks with small periods than tasks with large periods Can achieve 69% CPU utilization given enough unique priority levels 7 Load distributing algorithms Transfer policy Use of a threshold. 8 Selection policy Selects a task for transfer. The overhead incurred in the transfer of the task should be compensated for by the reduction in the response time. Tasks that will take longer to execute are better able to absorb the task transfer overhead. A small size task carries less overhead and is therefore less expensive to transfer. Location-dependent calls should be minimal. Another approach is to transfer a task only if its response time will be improved upon transfer. An approach is to only select newly arrived tasks for transfer. 9 Location policy To find a suitable node to share load. Polling. - Use of threshold. Broadcast a query. Random - Uses no state information. - Can transfer to a heavily loaded CPU. - Can limit the number of times a task can be transferred. - Possible instability. 10 Information policy When, where and how information is to be collected. Demand-driven. Sender initiated. Receiver initiated. symmetrically initiated. Periodic. State-change-driven. 11 Sender-initiated algorithms Load distributing activity initiated by an overloaded node attempting to send a task to an under-loaded node. Could cause system instability. Receiver-initiated algorithms Load distributing activity initiated by an under-loaded node attempting to obtain a task from an overloaded node. Can not cause system instability. Most transfers are preemptive. Symmetrically initiated algorithms At low system loads, sender-initiated component is more successful in finding under-loaded nodes. At high system loads, the receiver-initiated component is more successful in finding overloaded nodes. 12 Adaptive, symmetrically initiated algorithm Utilizes the information gathered during polling to classify the nodes in the system as either sender/overloaded, receiver/under-loaded, or OK. Sender-initiation deactivated at high system loads. Uses sender-initiated load sharing at low system loads, receiver-initiated load sharing at high loads, and symmetrically initiated load sharing at moderate loads, the stable symmetrically initiated algorithm achieves improved performance over a wide range of system loads while preserving system stability. 13 Performance of load sharing algorithms Average response time of tasks vs. system load Assuming homogenous system load – all nodes have the same long-term task arrival rate Even a very elementary load distribution scheme provides substantial performance improvement over a system that does not use load distribution. Elementary load distribution algorithm such as the sender-initiated algorithm using random location policy COM + does not provide any load-balancing, J2EE and CORBA provide it through third party tools from IBM, BAE, etc. 14 Comparison: Receiver-initiated load sharing vs. Sender-initiated At light to moderate system loads: Sender-initiated algorithm performs marginally better At high system loads: Receiver-initiated algorithm performs substantially better Receiver-initiated algorithm maintains system stability It’s polls generally find busy nodes, while sender-initiated polls waste resources and are ineffective 15 Comparison: Symmetrically initiated load sharing Takes advantage of the sender-initiated load sharing at low system loads Receiver-initiated load sharing at high system loads And both policies at moderate loads Performance Matches or is better than the sender-initiated policy Better than the receiver-initiated policy at low to moderate loads Still suffers from instability at high system loads - Due to the ineffective polling of the sender-initiated component of the algorithm 16 Comparison: Stable symmetrically initiated load sharing Approaches the optimal load-sharing Performance due to knowledge of the system due to polling However requires expensive preemptive task transfers Selection of a suitable load sharing algorithm 17 Task Migration Receiver-initiated transfers require preemptive task transfers Preemptive task transfers must not disrupt service to users Task placement vs. task migration Task migration must save and transfer: Task state Register Stack Virtual memory address space Files and file/device descriptors Buffered messages Location transparency required 18 19