Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 11 Resource Allocation by Mikhail Nesterenko “Distributed Algorithms” by Nancy A. Lynch.

Similar presentations


Presentation on theme: "Chapter 11 Resource Allocation by Mikhail Nesterenko “Distributed Algorithms” by Nancy A. Lynch."— Presentation transcript:

1 Chapter 11 Resource Allocation by Mikhail Nesterenko “Distributed Algorithms” by Nancy A. Lynch

2 Outline specification for resource allocation problems –explicit resource specification, exclusion specification general resource allocation problem –its properties dining philosophers problem –lack of symmetric solution –RightLeft solution generalization to resource allocation problem –coloring –using hierarchical coloring to solve the problem randomized symmetric solution to dining philosophers

3 Explicit Resource and Exclusion Specifications Two ways of describing conflict relationships among users explicit resource specification –a finite set of resources –a subset of resources for each process (to perform its work) two users conflict if their resource sets intersect (see Example 11.1.1) exclusion specification –exclusion set E – a collection of sets of processes which cannot perform their work simultaneously, exclusion set is closed under superset (if a set S contains a subset in E then S is also in E) Example 11.1.2 – exclusion set contains any subset of processes with cardinality greater than 1, Example 11.1.3 – k-exclusion explicit resource spec gives rise to exclusion spec (see.Example 11.1.5) reverse is not true, example?

4 Resource Allocation Problem user cycles through R(emainder), T(rying), C(rticial) and E(xit) regions Properties are similar to MX problem (ch.10) well-formedness – interactions between the users and algorithms are well-formed (no CS access without request, etc.) exclusion – no reachable system state where the set of users is in the exclusion set progress (for T) – if a process is in T then some user enters C (same for E) independent progress (for T) – if process is in T and all conflicting users are in R then eventually the process enters C or some conflicting user enters T (same for E) Note: independent progress is rather weak, any stronger properties?

5 Stronger Liveness Properties of RAP lockout freedom (for T) – if all users always return the resource, then any user that reaches T eventually enters C (same for E) time bound (for T) – – if each user always returns the resource within constant time and time between successive steps of each process is bounded then each user enters C in finite time bounded bypass (from MX, how is it different for RAP?) – while one process remains in T another process can only enter C at most some bounded number of times Lemma 11.1 if resource allocation algorithm has any time bound, then it is lockout- free if an algorithm guarantees well-formedness and lockout-freedome then it also guarantees progress

6 Dining Philosophers Problem (DP) special case of RAP processes (philosophers) are connected in a ring, each pair of neighboring processes has exactly one resource conflict (fork), see Fig 11.1 we only consider solutions with one read-modify-write shared variable associated with each resource symmetric algorithms – processes are identical, shared variables have the same initial values (a process cannot distinguish itself from others) Theorem 11.2 there is no symmetric solution to DP –idea – there is no way to break the symmetry between processes so there is no way for one neighbor to enter C while another waits what’s wrong with the following solution? –each process picks up its right fork (if its available, if not – waits) and then picks up its left fork (if its available, if not – waits)

7 Right-Left DP Solution waiting chain – a set sequence of processes where each consequent process waits on the resource held by the preceding process (see Fig 11.3) –processes in the waiting chain must enter the CS sequentially (is this so?) RightLeftDP solution: odd processes go for the right fork first, even – for the left Theorem 11.4 (simplified) – RightLeftDP solves DP and guarantees, lockout-freedom, independent progress, and a constant time bound

8 Generalization to RAP: Resource Graph assume resources are totally ordered (hierarchical resource allocation) idea – if process I waits for a resource held by process J, then J could only be delayed by waiting for a resource that is strictly larger (in resource ordering) than what I is waiting for resource graph –each node is a resource –two nodes are connected by an edge if there is a process that needs both resources color the resource graph, order colors (see figs 11.4, 11.5) –this way the resources for each process are totally ordered

9 Generalization to RAP: Algorithm each process obtains resources in the increasing order of the colors –each resource has a queue associated with it –process requests resource by placing its index at the end of the queue, process removes its index in E process gets the resource when its index is at the top of the queue a process I may be waiting on another process J only if J is obtaining a higher color –hence, the largest length of the waiting chain is the number of colors in the graph Theorem 11.5 (simplified) If the max number of colors and max number of users of a single resource is constant the coloring algorithm has a constant time bound

10 Randomized DP Algorithm idea – a trying process executes a loop, in each iteration the process randomly selects a fork waits until it is available (why can’t we just drop it and randomly select a different fork?) checks to see if the other is available –if yes – go to C –if no – drop both forks the algorithm –solves DP even if the processes are identical –guarantees exclusion (with certainty) –ensures progress with probability 1

11 Properties of the Randomized Algorithm deterministically guarantees well-formedness, exclusion, and individual progress Example 11.4.1: the randomized algorithm does not deterministically guarantee progress –consider the case where all processes make the same random choices Theorem 11.17 The randomized algorithm guarantees progress with probability 1


Download ppt "Chapter 11 Resource Allocation by Mikhail Nesterenko “Distributed Algorithms” by Nancy A. Lynch."

Similar presentations


Ads by Google