• No results found

Replica-Request Priority Donation

In document Ward_unc_0153D_16612.pdf (Page 139-143)

Chapter 3: Real-Time Nested Locking Protocol ( RNLP )

5.1 k-exclusion

5.1.2 Replica-Request Priority Donation

Job-release priority donation(JRPD)was designed as a progress mechanism for clustered systems (Bran- denburg and Anderson, 2011). In a clustered-scheduled system, comparing priorities across clusters is not very useful, because a high-priority job with respect to one cluster may have a relatively low priority when compared to jobs in another cluster. To ensure progress, JRPD ensures that all resource-holding jobs are scheduled by forcing high-priority jobs to suspend and donate their priority upon release to prevent preemptions of resource-holding jobs. However, this donation can cause release-blocking for any job in the system, not just those that engage in the locking protocol. We demonstrate such behavior in Figure 5.1, in which, at timet=1,J4is released, and is forced to suspend and donate its priority toJ1, so thatJ1remains scheduled.

In a globally scheduled system, priorities can be compared among all tasks, which allows us to adapt the rules of priority donation such that jobs that do not ever require shared resources are never pi-blocked. Thus, there is no release-blocking. To do so, we modify priority donation such that a job donates its priority on replica request instead of job release. Elliott and Anderson (2013) proposed a similar request-time donation mechanism, however their mechanism resulted in increased blocking bounds as compared toR2DGLPwe present here. We call this new definition of priority donation,replica-request priority donation(RRPD). Note that RRPD on its own is not sufficient to ensure progress, but when coupled with a progress mechanism such as priority inheritance, as we will demonstrate with respect to theR2DGLPin Section 5.1.3, yields

desirable worst-case pi-blocking bounds. The rules of the RRPD will be demonstrated later in an example of theR2DGLP.

In the following rules, letJibe a job that requires a replica of`aat timet1. Lett2be the time thatJiissues its replica request. Lett3andt4be the times thatJi’s request is satisfied and completed, respectively. These times are depicted in Figure 5.2. Additionally, letJd be a priority donor ofJi. Also letTxbe the time thatJd first requires a replica of`a.Jdsuspends to letJi complete its replica request.

D1 Ji may issue a request for a replica of`aonly if it is among themjobs of highest effective priority that currently require a replica of`a(including jobs with an incomplete request for a replica of`a). If necessary,Ji suspends until it may issue its replica request.

D2 JdbecomesJi’s priority donor a timetxif(i)Jd has one of themhighest base priorities among jobs that currently require a replica of`a,(ii)Jiis the lowest effective-priority job3with an incomplete request for a replica of`aat timetx, and(iii)there aremjobs with an incomplete request for a replica of`a. D3 Ji assumes the priority of its donor (if any)Jd during[t2,t4). Jd is considered to have no effective

priority while it is a donor.

D4 If a jobJddonating its priority toJi is displaced from the set of themhighest base-priority jobs that require a replica of`aby a jobJh, thenJhbecomesJi’s priority donor andJd ceases to be a priority donor. (By Rule D3,Jithus assumesJh’s priority.)

D5 A priority donor is suspended throughout the duration of its donation.

D6 Jdceases to be a priority donor as soon as either(i)Jicompletes its critical section (i.e., at timet4), or (ii)Jd is relieved by Rule D4.

Note that Rules D1-D6 on their own do not necessarily ensure progress. For example, consider a system with two processors, and one replica of`a, in which two lower-priority jobsJl1 and Jl2 have incomplete requests for a replica of`a, and two higher-priority jobsJh1 andJh2 are the priority donors ofJl1 andJl2, respectively. IfJiis released and has one of the highestmeffective priorities in the system, then only one of Jh1 andJh2 has sufficient priority to be scheduled. IfJh1 has a higher priority thanJh2, butJh1 is not donating to the replica holder, than progress is not ensured. For this reason, we require the rules of a locking protocol that utilizes RRPD to also ensure the following progress property.

RRP1 A jobJiwith an incomplete replica request makes progress (i.e., the replica-holding job for whichJiis waiting is scheduled) ifJihas sufficient effective priority to be scheduled.

In theR2DGLP, this property is satisfied through the use of priority inheritance.

Analysis. We next analyze several qualities of RRPD that will later be used to bound the duration of pi-blocking for theR2DGLP.

Lemma 5.1. A jobJi with an incomplete request for a replica of`a has one of the mhighest effective priorities among jobs that require a replica of`a(those that have issued a request, as well as those that are suspended waiting to issue a request, as seen in Figure 5.2).

Proof. By contradiction. AssumeJi has an incomplete request for a replica of`abut does not have one of the mhighest effective priorities among the jobs that require a replica of`a. Thus there are at leastmjobs of higher effective priority thanJithat require a replica of`a. Then either allmof these higher effective-priority jobs have issued requests, or there is at least one such higher effective-priority job that is suspended waiting to issue its request by either Rule D1 or D5. We consider these cases separately.

If allmjobs with higher effective priority thanJithat currently require a replica of`aissued their replica requests beforeJi, thenJiwould not have been allowed to issue its request by Rule D1.

Consider a jobJdthat is one of themjobs of higher effective priority thanJi, which is suspended and waiting to issue its request for a replica of `a. Jd is not suspended by Rule D1, because it has one of the highestmeffective priorities among jobs that currently require a replica of`a. ThusJd must be suspended by Rule D2, and is thus a priority donor. ThereforeJd has no effective priority by Rule D3, because its priority is being donated to a job with an incomplete request for`a(e.g.,Ji).

Lemma 5.2. There are at mostmjobs with an incomplete request for a replica of`aat any time.

Proof. Assume for contradiction that there are more thanmjobs with an incomplete request for a replica of`a. LetJibe the job that issued the(m+1)strequest for a replica of`a. By Rule D1, whenJiissued its request, it was one of themjobs of highest effective priority with an incomplete request for a replica of`a. However, there were alsomjobs with incomplete requests for a replica of`a, that, by Lemma 5.1, had the highestmeffective priorities of jobs that required a replica of`a. This contradicts the assumption thatJiwas allowed to issue a replica request.

Lemma 5.3. A jobJithat has one of the highestmbase priorities among jobs that currently require a replica of`aalso has one of the highestmeffective priorities (with respect to priority donation only) among jobs that currently require a replica of`a.

Proof. The only way for a job’s effective priority to be increased is through priority donation via Rule D2. Priority donation forms a one-to-one relationship between donor and recipient, in which the effective priority of the recipient is elevated while the effective priority of the donor is reduced to zero by Rule D3. Thus, the highestmeffective priorities are equal to the highestmbase priorities among jobs that currently require a replica of`a. Therefore, if a jobJihas one of the highestmbase priorities, thenJiis neither a priority donor nor the recipient of priority donation from another jobJd, and thus also has one of the highestmeffective priorities (with respect to priority donation only) among jobs that currently require a replica of`a.

Lemma 5.4. Under RRPD, if a jobJithat requires a replica of`ais pi-blocked waiting for a replica of`ait either has an incomplete request for a replica of`aor it is a priority donor.

Proof. Assume for contradiction that a jobJiis pi-blocked, does not have an incomplete request for a replica of`a, and is not a priority donor. By Definition 2.2, ifJiis pi-blocked, then it has one of the highestmbase priorities in the system, and by Lemma 5.3 is among the set of the highestmeffective-priority jobs that need a replica of`a. Thus, by Rule D1,Jiwould issue a request for a replica of`a.

Lemma 5.5. A priority donorJd can be pi-blocked during priority donation for at most the maximum duration of time that a job can be pi-blocked with an incomplete request for a replica of`a(i.e., the time betweent2andt4in Figure 5.2), plus one critical section.

Proof. IfJdis pi-blocked while it is a priority donor, then the recipient of its priority donationJihas sufficient effective priority to be scheduled. By Property RRP1,Jimakes progress. ThusJdcan be pi-blocked while it is donor for at most the maximum duration of timeJican be pi-blocked waiting for its request to be satisfied, plusJi’s critical section length.

The rules of RRPD facilitate the design of a simple, optimalk-exclusion locking protocol, which we present next.

Figure 5.3: Queue structure used by the CK-OMLP, which is suboptimal when used with RRPD. Under JRPD, the progress mechanism employed by the CK-OMLP, all replica-holding jobs are scheduled, and thus the total pi-blocking is at mostd(mk)/keLmax. However, under RRPD, ifJhis the only job with sufficient effective priority to be scheduled, then only one replica-holding job will be scheduled. ThusJhmust wait in the wait queue for max((mk1)Lmax,0)time, which is suboptimal.

In document Ward_unc_0153D_16612.pdf (Page 139-143)