• No results found

The k-FMLP

In document Elliott_unc_0153D_15621.pdf (Page 60-63)

Chapter 2: Background and Prior Work

2.1 Multiprocessor Real-Time Scheduling

2.1.7 Multiprocessor k Exclusion Locking Protocols

2.1.7.1 The k-FMLP

Thek-FMLPis simple extension of the globalFMLP-Longto supportk-exclusion.10 It may be used to protect a pool ofk resources shared by taskswithinthe same cluster of processors. The pi-blocking experienced by a job waiting for a resource protected by thek-FMLPisO(n/k)wherenis the number of tasks using the lock. Thek-FMLPis designed as follows.

9The author of this dissertation contributed to the development of the “Optimalk-Exclusion Global Locking Protocol” (O-KGLP) (El- liott and Anderson, 2013). We do not discuss theO-KGLPsince it is obsolesced by theR2DGLP, which analytically dominates the

O-KGLP.

10Thek-FMLPwas designed by the author of this dissertation. We discuss it in this background chapter, rather than a later chapter, because thek-FMLPis a minor contribution. A detailed description and analysis of thek-FMLPmay be found in the online appendix of Elliott and Anderson (2012b) athttp://www.cs.unc.edu/~anderson/papers.html.

k resources FQ 1 FQ2 FQ3 FQ k Resource Holders

Figure 2.9: Queue structure of thek-FMLP.

Structure. The structure of thek-FMLPis illustrated in Figure 2.9. Thek-FMLPusesk FIFO request queues, denoted FQ1,· · ·,FQk. Each queue is assigned to one of thekprotected replicas of resource`j. A jobJienqueues a resource requestRi,j,k onto the queue FQxwhen the job requires a resource. A job with a request at the head of its queue is considered the holder of the associated resource and is ready to run. Jobs with blocked requests are suspended from the processor.

Rules. Thek-FMLPmay compute the length of a FIFO queue FQxatruntimewith either one of two formulas. Under the simplest formulation, the length of FQxis given by thenumberof enqueued requests:

length(FQx),|FQx|. (2.29)

Alternatively, length may be expressed by the critical section lengths of enqueued requests:

length(FQx),

Ri∈FQx

Li, (2.30)

where we reindex the requests in FQx withi. We call the formulation of Equation (2.29)critical-section- oblivious, and the formulation of Equation (2.30)critical-section-aware. We may use either formulation in the following rules that govern thek-FMLP. LetJidenote a job that issues a requestRi,j,kfor resource`j.

F1 WhenJiissuesRi,j,k,Ri,j,kis appended to the queue with the minimum length, min1≤x≤k{length(FQx)}. Jiacquires thexthresource whenRi,j,k is at the head of FQx.

F2 All jobs with queued requests are suspended except for resource holders, which are ready. The effective priority of the resource holder in FQxis set to the maximum priority of all jobs with requests queued in FQx.

F3 WhenJireleases replicaxof resource`j,Ri,j,kis dequeued from FQx, and the job with the next queued request in FQx is granted the newly available resource. If FQx is empty, then an arbitrary pending request (if one exists) from another queue is “stolen” (removed from its queue) and moved to FQx, and the stolen request is granted replicax.11

Blocking Analysis. We provide a summary of the s-oblivious blocking analysis presented by Elliott and Anderson (2012b). We direct the reader to that paper for the rational behind the following claims. For simplicity of presentation, we assume that each job issues one request.

By Rule F1, each request is enqueued on the shortest queue when it is issued, according to the function length(FQx). Thus, thek-FMLPload-balances requests among thekresources. We denote the bound on pi-blocking that a request of jobJifor a replica of a resource`jmay experience under thek-FMLPwith the termbk-FMLPi,j . Under the critical-section-oblivious formulation (Equation 2.29), requestRi,j,kis blocked by at most bk-FMLPi,j = n−1 k ·Lmaxj (2.31)

time units. No request is blocked by more thann−1k requests. Hence, blocking under thek-FMLPisO(n/k). Under the critical-section-aware formulation (Equation 2.30), requestRi,j,k is blocked by at most

bk-FMLPi,j =∑Tl∈T\{Ti}L

max l,j

k (2.32)

time units.12 Although requestRi,j,kmay be blocked by more than

n−1

k

individual requests under this formu- lation,∑Tl∈T\{Ti}L max l,j k < n−1 k

·Lmaxj often holds true, so the critical-section-aware methodmayprovide a tighter bound on blocking. However, the critical-section-aware method requires a more complex implementation of thek-FMLP, as it must be cognizant of the critical section lengths of enqueued requests.

11Request “stealing” does not affect worst-case blocking analysis, but it ensures efficient resource utilization at runtime.

12Tighter blocking bounds under the critical-section-aware method can be obtained by using an integer linear program to determine thelongesttheshortestqueue may be whenRi,j,kis issued.

k resources FQ 1 FQ2 FQ3 FQ k Resource Holders PQ m donors m! " k DQ

Figure 2.10: Queue structure of theR2DGLP.

In document Elliott_unc_0153D_15621.pdf (Page 60-63)