[ieee 2012 ieee 17th conference on emerging technologies & factory automation (etfa 2012) -...

4
On Variations of the Suspension-Based Multiprocessor Priority Ceiling Syncronization Protocol Andreu Carminati Department of Automation and Systems Florian´ opolis, Brasil Email: [email protected] omulo Silva de Oliveira Department of Automation and Systems Florian´ opolis, Brasil Email: [email protected] Abstract In this paper we propose and evaluate suspension- based variations of the Multiprocessor Priority Ceiling Protocol (MPCP). The variations are compared with ex- isting protocols for the same system model, which is par- titioned and static priority scheduling. We present varia- tions of the MPCP that improve in some cases the system schedulability. Some variations are actually simplifica- tions that favor the implementation in real systems. 1 Introduction The goal of this paper is to investigate new suspension- based variations of the Multiprocessor Priority Ceiling Synchronization Protocol (MPCP [8, 7]) for static priority and partitioned scheduling. Schedulability tests are pro- vided for these new variations and they are compared with two existing protocols for the same system model (parti- tioned and static priority scheduling): the Multiprocessor Priority Ceiling Protocol for Shared Memory (MPCP) and the Flexible Multiprocessor Locking Protocol (FMLP). In this paper we consider only global resources in both equa- tions and in the empirical comparison of protocols. Previous studies have shown that, for multiprocessor systems, there is not a synchronization protocol that dom- inates all others in all situations. It is always possible to hand craft a task set that favors one or another existing protocol. We present in this paper suspension-based vari- ations of the MPCP that improve in some cases the sys- tem schedulability. Some variations are actually simplifi- cations that favor the implementation in real systems. 2 System Model In this work it is considered only partitioned and static priority scheduling of periodic task sets. The notation that will be used throughout the text is the same as in [5], because we based the schedulabil- ity analysis of the protocols in that article. A task τ i with period T i on a processor P (τ i ) is defined by τ i : ((C i,1 ,C 0 i,1 ,C i,2 ,C 0 i,2 , ..., C 0 i,s(i)-1 ,C i,s(i) ),T i ) Where s(i) is the number of normal execution segments of τ i and s(i) - 1 is the number of critical section seg- ments of τ i . C i,j is the WCET of the j th normal execu- tion segment whereas C 0 i,j is the WCET of the j th critical section segment. C i is the total WCET of the task τ i . The execution time of each task is segmented into sections of normal execution and critical sections. The worst-case ex- ecution time of a task τ i can be calculated as the sum of all task segments: C i = s(i) j=1 C i,j + s(i)-1 k=1 C 0 i,k . τ i,j is the j th normal execution segment of a task τ i whereas τ 0 i,j is the j th critical section segment of a task τ i and R(τ i,j ) is the resource corresponding to that segment. Given two tasks τ i and τ j , if i<j then the priority of τ i is higher than the priority of τ j . 2.1 Blocking Aware Response Time Analysis Based on the notation presented and the blocking times, one can calculate the response time of a task: W n+1 i = C i + B r i + I n i + B low (1) In Equation 1, C i is the task WCET, B r i is the total remote blocking time, I n i represents the interference im- posed by higher priority tasks. B low represents the block- ing time imposed by lower priority tasks. The initial value of the convergence must be W 0 i = C i +B r i . This blocking time exists because a task can be prevented from executing at its release as the result of a lower priority task running on a non-preemptive way (inside a critical section in this case). For suspension-based protocols, the calculation of interference must be done by Equation 2. I n i = X h<i&τ h P (τi) W n i + B r h T h C h (2) In Equation 2, the blocking time of a higher priority task appears as an increasing of a lower priority task WCRT. This equation captures an effect called back-to- back execution[5], where a task suffers additional interfer- ence from auto-suspending (when blocked on some mu- tex) higher-priority tasks. This happens because a higher 1 978-1-4673-4737-2/12/$31.00 ©2012 IEEE

Upload: romulo-silva

Post on 28-Mar-2017

217 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: [IEEE 2012 IEEE 17th Conference on Emerging Technologies & Factory Automation (ETFA 2012) - Krakow, Poland (2012.09.17-2012.09.21)] Proceedings of 2012 IEEE 17th International Conference

On Variations of the Suspension-Based Multiprocessor Priority CeilingSyncronization Protocol

Andreu CarminatiDepartment of Automation and Systems

Florianopolis, BrasilEmail: [email protected]

Romulo Silva de OliveiraDepartment of Automation and Systems

Florianopolis, BrasilEmail: [email protected]

Abstract

In this paper we propose and evaluate suspension-based variations of the Multiprocessor Priority CeilingProtocol (MPCP). The variations are compared with ex-isting protocols for the same system model, which is par-titioned and static priority scheduling. We present varia-tions of the MPCP that improve in some cases the systemschedulability. Some variations are actually simplifica-tions that favor the implementation in real systems.

1 Introduction

The goal of this paper is to investigate new suspension-based variations of the Multiprocessor Priority CeilingSynchronization Protocol (MPCP [8, 7]) for static priorityand partitioned scheduling. Schedulability tests are pro-vided for these new variations and they are compared withtwo existing protocols for the same system model (parti-tioned and static priority scheduling): the MultiprocessorPriority Ceiling Protocol for Shared Memory (MPCP) andthe Flexible Multiprocessor Locking Protocol (FMLP). Inthis paper we consider only global resources in both equa-tions and in the empirical comparison of protocols.

Previous studies have shown that, for multiprocessorsystems, there is not a synchronization protocol that dom-inates all others in all situations. It is always possible tohand craft a task set that favors one or another existingprotocol. We present in this paper suspension-based vari-ations of the MPCP that improve in some cases the sys-tem schedulability. Some variations are actually simplifi-cations that favor the implementation in real systems.

2 System Model

In this work it is considered only partitioned andstatic priority scheduling of periodic task sets. Thenotation that will be used throughout the text is thesame as in [5], because we based the schedulabil-ity analysis of the protocols in that article. A taskτi with period Ti on a processor P (τi) is defined

by τi : ((Ci,1, C′

i,1, Ci,2, C′

i,2, ..., C′

i,s(i)−1, Ci,s(i)), Ti)Where s(i) is the number of normal execution segmentsof τi and s(i) − 1 is the number of critical section seg-ments of τi. Ci,j is the WCET of the jth normal execu-tion segment whereas C

i,j is the WCET of the jth criticalsection segment. Ci is the total WCET of the task τi. Theexecution time of each task is segmented into sections ofnormal execution and critical sections. The worst-case ex-ecution time of a task τi can be calculated as the sum ofall task segments: Ci =

∑s(i)j=1 Ci,j+

∑s(i)−1k=1 C

i,k. τi,j isthe jth normal execution segment of a task τi whereas τ

i,j

is the jth critical section segment of a task τi and R(τi,j)is the resource corresponding to that segment.

Given two tasks τi and τj , if i < j then the priority ofτi is higher than the priority of τj .

2.1 Blocking Aware Response Time AnalysisBased on the notation presented and the blocking

times, one can calculate the response time of a task:

Wn+1i = Ci +Bri + Ini +Blow (1)

In Equation 1, Ci is the task WCET, Bri is the totalremote blocking time, Ini represents the interference im-posed by higher priority tasks. Blow represents the block-ing time imposed by lower priority tasks. The initial valueof the convergence must beW 0

i = Ci+Bri . This blockingtime exists because a task can be prevented from executingat its release as the result of a lower priority task runningon a non-preemptive way (inside a critical section in thiscase). For suspension-based protocols, the calculation ofinterference must be done by Equation 2.

Ini =∑

h<i&τh∈P (τi)

⌈Wni +BrhTh

⌉Ch (2)

In Equation 2, the blocking time of a higher prioritytask appears as an increasing of a lower priority taskWCRT. This equation captures an effect called back-to-back execution[5], where a task suffers additional interfer-ence from auto-suspending (when blocked on some mu-tex) higher-priority tasks. This happens because a higher

1978-1-4673-4737-2/12/$31.00 ©2012 IEEE

Page 2: [IEEE 2012 IEEE 17th Conference on Emerging Technologies & Factory Automation (ETFA 2012) - Krakow, Poland (2012.09.17-2012.09.21)] Proceedings of 2012 IEEE 17th International Conference

priority task can suspend itself in the middle of its execu-tion and come to preempt a task (lower priority) more thanonce during its activation. An upper bound for this typeof interference is Brh, that must be added to Wn

i as a kindof jitter. The calculation of the blocking time caused bylower priority tasks can be done by Equation 3.

Blow = s(i)×∑

l>i&τl∈P (τi)

max1≤k<s(l)

C′

l,k (3)

In Equation 3, every time a task blocks (in the worst-case, a task will block on every resource acquisition at-tempt) and also before its activation, it will allow lowerpriority tasks to execute. This lower priority tasks canblock on resources. When the lower priority task receivesthe resource, it will preempt the higher priority tasks, be-cause all synchronization protocols execute critical sec-tions with priority higher than normal priorities.Bri,j defines the remote blocking corresponding to the

maximum waiting time experienced by task τi when it re-quests the jth global critical section. The total remoteblocking of a task τi is denoted by Bri and can be cal-culated using the following equation, which sums all pos-sible blocking times of each critical section (Equation 4):

Bri =s(i)−1∑q=1

Bri,q (4)

How the values of Bri,q are calculated depends on eachprotocol.

3 Existing Protocols

The Multiprocessor Priority Ceiling Protocol was pro-posed by Rajkumar [7], and was based on the DistributedMultiprocessor Priority Ceiling Protocol [8] (which inturn was based on the Priority Ceiling Protocol [9]). Thefirst proposed version considered only systems whosememory spaces were local to the processor. In this paperwe consider only UMA systems.

The Flexible Multiprocessor Locking Protocol [1] wasproposed for global and partitioned EDF scheduling andPfair PD2. The extension for partitioned static priorityis presented in [3]. It can be used with both partitionedand global scheduling and it is agnostic as to the type ofexecution control policy adopted (suspension or spin).

4 New Variations of MPCP

Table 1 summarizes the characteristics of the existingprotocols. Regarding queuing policy in case of block-ing and whether the protocol allows preemption of criticalsections or not. For example, the MPCP allows preemp-tion because each critical section can be executed with adifferent ceiling, while the FMLP execute critical sectionsin a fully non-preemptive way.

`````````ProtocolFeatures Access or-

der

Pree

mpt

able

Prio

.ord

er

FIFO

Existing protocolsMPCP:[7] x xFMLP long:[1] xFMLP+[2] x x

Proposed in this paperMPCPNP: xMPCPF: x x

Table 1. Comparison between the suspen-sion based protocols

4.1 Proposed Variation 1: MPCP non-preemptiveThis first variation (MPCPNP) is to access critical sec-

tions in a non-preemptive way (similar to the FMLP). Thischange only affects, remote blocking. This is due to thefact that all low-priority tasks, regardless of the ceiling ofthe requested resource, could potentially block higher pri-ority tasks on the same processor. This becomes clear withthe following example: Task “A” (high priority) blocks ina global resource, then a task “B” (lower priority, on thesame processor) begins to run and blocks in another globalresource with ceiling lower than the resource that causedthe blocking of “A”. Later “A” receives the resource andresumes its execution and shortly thereafter, task “B” alsoreceives its resource, but cannot execute its critical section(it is a lower priority critical section). When task “A” fi-nally releases the resource, it will enter a normal executionsegment and will be preempted by “B” which will executeits lower priority critical section. In short, a normal exe-cution segment of a higher priority task can be preemptedby any other critical section of a lower priority task.

For the case of remote blocking, the waiting time for aresource will be increased, because now the execution or-der of different critical sections on the same processor willbe FIFO. Instead of the task waiting only for the executionof the critical section itself, added to the critical sectionswith higher ceiling, it will have to wait (in the worst case)all critical sections of the remote processor.

4.1.1 Schedulability Analysis

To calculate the response time we use the convergence ofEquation 1. The worst-case (W

i,k) response time of a crit-ical section C

i,k:

W′

i,k = C′

i,k +∑

τu∈P (τi)

max1≤v≤s(u)

C′

u,v (5)

In Equation 5, in the worst case, a job when ready toexecute inside a critical section must wait for the largestcritical section of each active job, like in the FMLP.

Page 3: [IEEE 2012 IEEE 17th Conference on Emerging Technologies & Factory Automation (ETFA 2012) - Krakow, Poland (2012.09.17-2012.09.21)] Proceedings of 2012 IEEE 17th International Conference

Finally, Bri,j represents the remote blocking for a taskτi in acquiring the critical global C

i,j . This block-ing time is limited by the convergence (where Br,0i,j =

maxl>i&(τ

′l,u)∈R(τi,j)

(C′

l,u)):

Br,n+1i,j = max

l>i&(τ′l,u)∈R(τi,j)

(W′

l,u)

+∑

h<i&(τ′h,v∈R(τi,j))

(⌈Br,ni,jTh

⌉+ 1

)(W

h,v) (6)

In Equation 6, in the worst case, a task τi can beblocked by only one lower priority task τl that has thelargest critical section protected by R(τi,j), which is exe-cuting inside the critical section when task τi tries to ob-tain the resource. However, task τi can be blocked for sev-eral higher priority tasks, multiple times each. This factoris equal to MPCP Br,n+1

i,j .

4.2 Proposed Variation 2: MPCP with FIFO queuingThe second variation (MPCPF) changes the order in

which blocked tasks access a particular resource. In thissecond variation, blocked tasks access resources in FIFOorder of request. This does not mean that this variationis equal to FMLP for static priority, because with FMLP,tasks access resources in FIFO order non-preemptively.This variation is also different from FMLP+, because ituses different tiebreaker rules. In FMLP+, ties are re-solved by timestamps of resource requisition time and inMPCPF the rules are the same of MPCP.

4.2.1 Schedulability Analysis

To calculate the response time, we use the convergenceof Equation 1. The worst-case response time of a criticalsection C

i,k is the sum of the largest critical section ofeach task, whose ceiling is higher than the ceiling of C

i,k,and is given by:

W′

i,k = C′

i,k +∑

τu∈P (τi)

max1≤v≤s(u)&gc(u,v)>gc(i,k)

C′

u,v (7)

Finally, Bri,j represents the remote blocking for a taskτi in acquiring the global critical section C

i,j . As thequeuing is FIFO, in the worst case, the task will have towait for all other tasks that access the resource in the caseof the suspension-based version (Equation 8).

Bri,j =∑

h 6=i&(τ′h,v∈R(τi,j))

W′

h,v (8)

5 Empirical Comparison of Schedulability

For the sake of naming the following convention isused: PLAIN denotes the simple analysis of response

time, ignoring locks, will be used only as a base line.MPCP represents the classical MPCP, MPCPNP repre-sents the MPCP non-preemptive. MPCPF represents theMPCP with FIFO queuing and FMLP-LONG long versionof FMLP.

For partitioning we used a variation of the algorithmRM-FFDU [6]. The fit function (check if the inclusion ofa task keeps the system schedulable) uses the schedula-bility tests from the previous sections. The parameter ofcomparison used, as in [5], is the number of processorsrequired to run a given system.

The experiments were performed disregarding the ef-fects of overheads. The sets of periodic tasks with implicitdeadlines were generated (30 sets for each configuration)according to the article [5]. In this paper, we used theUUniFast-Discard [4]. The task periods were randomlygenerated in the interval [10ms, 100ms]. Computationtimes were calculated based on the previous values.

Experiment 1 - Variation of the size of critical sec-tions: In the systems generated, each task accesses twoglobal critical sections, and each resource is shared by twotasks. The sections varied in the range [5, 1280] µs, dou-bling the size at each test. The results are shown in Figure1. The results of classical MPCP and FMLP are similar,where the tendency is the first to be better for longer sec-tions and the second for shorter sections, but not with asignificant difference.

5 10 20 40 80 160 320 640 12808.0

10.0

12.0

14.0

16.0

18.0

20.0

22.0

24.0

26.0

PLAIN MPCP MPCPNP MPCPF FMLP-LONG

Critical Section Size (usecs)

Num

ber

of P

roce

ssor

s N

eede

d (a

vera

ge)

Figure 1. Experiment 1

Experiment 2 - Variation of the Number of Jobs perProcessor: Initially it starts with 40 tasks, and increasesthe number of tasks successively until 96, while maintain-ing system utilization equal to 8. For this experiment twocritical sections are also used by each task and two tasksper resource. The results are shown in Figure 2. The bestresult was with MPCPF and the worst with MPCPNP.

Experiment 3 - Variation of the Number of Usersper Resource: In the third experiment, the parameter thatis varied is the number of tasks per resource (keeping40 tasks and two critical sections per task). The numbervaries from 2 to 16 users for each resource, always multi-plying by two at each test. The results are shown in Figure3. In this experiment, as the number of users increases,FIFO queuing protocols have a tendency to increase the

Page 4: [IEEE 2012 IEEE 17th Conference on Emerging Technologies & Factory Automation (ETFA 2012) - Krakow, Poland (2012.09.17-2012.09.21)] Proceedings of 2012 IEEE 17th International Conference

5 6 7 8 9 10 11 128.0

12.0

16.0

20.0

24.0

28.0

32.0

36.0

40.0

44.0

48.0

52.0

PLAIN MPCP MPCPNP MPCPF FMLP-LONG

Number of Tasks per Processor (initially)

Num

ber

of P

roce

ssor

s N

eede

d (a

vera

ge)

Figure 2. Experiment 2

number of processors required. But even when the num-ber of users reaches 16, the MPCPF still performs betterthan the MPCPNP.

2 4 8 168.0

12.0

16.0

20.0

24.0

28.0

32.0

36.0

40.0

PLAIN MPCP MPCPNP MPCPF FMLP-LONG

Lockers per Resource

Num

ber

of P

roce

ssor

s N

eede

d (a

vera

ge)

Figure 3. Experiment 3

5.0.2 Comments

Overall, the results were different from those in [5] dueto: different task set generator, although with the same pa-rameters (used UUniFast-Discard to generate the utiliza-tions), different allocation algorithm (we use a variationof RM-FFDU, and in [5] it was used a BFD variation)and finally, other protocols were also evaluated. In fact,evaluating protocols based on allocation is subject to theeffects caused by partitioning anomalies. Evaluating theresults based on partitioning, one can see that for the testscenarios evaluated, the difference between the protocolsis not very significant. For example, the non-preemptivevariation (MPCPNP) needed more processors to schedulethe system. However, this may be cost-effective as it maysimplify real implementations, it does not require the cal-culation of the ceiling, not to mention the feasibility ofusing it in soft real-time systems. We noticed that for theset of tests performed, MPCPF showed better results in thefirst two experiments. In the third test, the FIFO queuingcaused the MPCPF to have worse results than in previoustests, but still behaving well.

6 Conclusions

In this paper it was presented two variations of theMPCP protocol, together with the corresponding schedu-lability analysis. In some sense, both proposed variationscan also be seen as variations of FMLP, since they includefeatures common to both protocols. The paper presentedempirical comparisons between the variations and the ex-isting protocols.

Considering the system scenarios of our empiricalstudy, the proposed variation MPCPNP showed the worstresults, while the proposed variation MPCPF showedgood results, especially in scenarios with low rate of re-source sharing. In fact, there is no dominance of a singleprotocol over the others.

Acknowledgment

To CAPES for financial support.

References

[1] A. Block, H. Leontyev, B. B. Brandenburg, and J. H. An-derson. A Flexible Real-Time Locking Protocol for Mul-tiprocessors. In 13th IEEE International Conference onEmbedded and Real-Time Computing Systems and Appli-cations (RTCSA 2007), pages 47–56. IEEE, Aug. 2007.

[2] B. B. Brandenburg. Scheduling and Locking in Multiproces-sor Real-time Operating Systems. PhD thesis, University ofNorth Carolina at Chapel Hill, 2011.

[3] B. B. Brandenburg and J. H. Anderson. An Implemen-tation of the PCP, SRP, D-PCP, M-PCP, and FMLP Real-Time Synchronization Protocols in LITMUSˆRT. 2008 14thIEEE International Conference on Embedded and Real-Time Computing Systems and Applications, pages 185–194,Aug. 2008.

[4] R. I. Davis and A. Burns. Priority Assignment for GlobalFixed Priority Pre-Emptive Scheduling in MultiprocessorReal-Time Systems. In 2009 30th IEEE Real-Time SystemsSymposium, pages 398–409. IEEE, Dec. 2009.

[5] K. Lakshmanan, D. D. Niz, and R. Rajkumar. CoordinatedTask Scheduling, Allocation and Synchronization on Multi-processors. 2009 30th IEEE Real-Time Systems Symposium,pages 469–478, Dec. 2009.

[6] Y. Oh, S. H. Son, and T. Hall. Fixed-Priority Schedulingof Periodic Tasks on Multiprocessor Systems. Technicalreport, Department of Computer Science, University of Vir-ginia, 1995.

[7] R. Rajkumar. Real-time synchronization protocols forshared memory multiprocessors. In Proceedings.,10th In-ternational Conference on Distributed Computing Systems,pages 116–123. IEEE Comput. Soc. Press, 1990.

[8] R. Rajkumar, L. Sha, and J. Lehoczky. Real-time syn-chronization protocols for multiprocessors. In Proceedings.Real-Time Systems Symposium, pages 259–269. IEEE Com-put. Soc. Press, 1988.

[9] L. Sha, R. Rajkumar, and J. Lehoczky. Priority inheritanceprotocols: an approach to real-time synchronization. IEEETransactions on Computers, 39(9):1175–1185, 1990.