{'fraction_non_alphanumeric': 0.03723146729192591, 'fraction_numerical': 0.012351804355741569, 'mean_word_length': 5.0639087710784905, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Multiprocessor Real-Time Locking Protocols: A Systematic Review

We systematically survey the literature on analytically sound multiprocessor real-time locking protocols from 1988 until 2018, covering the following topics: progress mechanisms that prevent the lock-holder preemption problem, spin-lock protocols, binary semaphore protocols, independence-preserving (or fully preemptive) locking protocols, reader-writer and k-exclusion synchronization, support for nested critical sections, and implementation and system-integration aspects. A special focus is placed on the suspension-oblivious and suspension-aware analysis approaches for semaphore protocols, their respective notions of priority inversion, optimality criteria, lower bounds on maximum priority-inversion blocking, and matching asymptotically optimal locking protocols.


Introduction
In contrast to the thoroughly explored and well understood uniprocessor real-time synchronization problem, the multiprocessor case considered herein is still the subject of much ongoing work. In particular, uniprocessor real-time locking protocols that are both optimal and practical are readily available since the late 1980s and early 1990s [23,163,179], can flexibly support mutual exclusion, reader-writer synchronization, multi-unit resources, and have been widely adopted and deployed in industry (in POSIX, OSEK/AUTOSAR, etc.). Not so in the multiprocessor case: there is no widely agreedupon standard protocol or approach, most proposals have focused exclusively on mutual exclusion to date (with works on reader-writer, k-exclusion, and multi-unit synchronization starting to appear only in the past decade), and questions of optimality, practicality, and industrial adoption are still the subject of ongoing exploration and debate. Another major difference to the uniprocessor case is the extent to which nested critical sections are supported: a large fraction of the work on multiprocessor real-time locking protocols to date has simply disregarded (or defined away) fine-grained nesting (i.e., cases where a task holding a resource may dynamically acquire a second resource), though notable exceptions exist (discussed in Section 9). No such limitations exist in the state of the art w.r.t. uniprocessor real-time synchronization.
We can thus expect the field to continue to evolve rapidly: it is simply not yet possible to provide a "final" and comprehensive survey on multiprocessor real-time locking, as many open problems remain to be explored. Nonetheless, a considerable number of results has accumulated since the multiprocessor real-time locking problem was first studied more than three decades ago. The purpose of this survey is to provide a systematic review of the current snapshot of this body of work, covering most papers in this area published until the end of 2018.
We restrict the scope of this survey to real-time locking protocols for shared-memory multiprocessors (although some of the techniques discussed in Section 6 could also find applications in distributed systems), and do not consider alternative synchronization strategies such as lock-and wait-free algorithms, transactional memory techniques, or middleware (or database) approaches that provide a higher-level transactional interface or multi-versioned datastore abstraction (as any of these techniques warrants a full survey on its own). We further restrict the focus to runtime mechanisms as commonly provided by real-time operating systems (RTOSs) or programming language runtimes for use in dynamically scheduled systems and exclude fully static planning approaches (e.g., as studied by Xu [212]) that resolve (or avoid) all potential resource conflicts statically during the construction of the system's scheduling table so that no runtime resource arbitration mechanisms are needed.
Our goal is to structure the existing body of knowledge on multiprocessor real-time locking protocols to aid the interested reader in understanding key problems, established solutions, and recurring themes and techniques. We therefore focus primarily on ideas, algorithms, and provable guarantees, and place less emphasis on empirical performance comparisons or the chronological order of developments. and cause additional analytical complications.
For the purpose of schedulability analysis, but not for the operation of a locking protocol at runtime, it is required to know a worst-case execution time (WCET) bound for each task, usually including the cost of all critical sections (but not including any blocking delays), and also individually for each critical section (i.e., a maximum critical section length must be known for each critical section). Furthermore, to enable a meaningful blocking analysis, the maximum number of critical sections in each job (i.e., the maximum number of lock() calls per activation of each task) must be known on a per-resource basis.
While it is generally impossible to make strong a priori response-time guarantees without this information being available at analysis time (for at least some of the tasks), to be practical, it is generally desirable for a locking protocol to work as intended even if this information is unknown at runtime. For example, RTOSs are typically used for many purposes, and not all workloads will be subject to static analysis-the implemented locking protocol should function correctly and predictably nonetheless. Similarly, during early prototyping phases, sound bounds are usually not yet available, but the RTOS is expected to behave just as it will in the final version of the system.
With regard to scheduling, most of the covered papers assume either partitioned or global multiprocessor scheduling. Under partitioned scheduling, each task is statically assigned to exactly one of the m processors (i.e., its partition), and each processor is scheduled using a uniprocessor policy such as fixed-priority (FP) scheduling or earliest-deadline first (EDF) scheduling. The two most prominent partitioned policies are partitioned FP (P-FP) and partitioned EDF (P-EDF) scheduling.
Under global scheduling, all tasks are dynamically dispatched at runtime, may execute on any of the m processors, and migrate freely among all processors as needed. Widely studied examples include global FP (G-FP) and global EDF (G-EDF) scheduling, as well as optimal policies such as Pfair scheduling [25,184].
A third, more general notion is clustered scheduling, which generalizes both global and partitioned scheduling. Under clustered scheduling, the set of m cores is split into a number of disjoint clusters (i.e., disjoint subsets of cores), tasks are statically assigned to clusters, and each cluster is scheduled locally and independently using a "global" scheduling policy (w.r.t. the cores that form the cluster). We let c denote the number of cores in a cluster. Global scheduling is a special case of clustered scheduling with a single "cluster" and m = c, and partitioned scheduling is the other extreme with m clusters and c = 1.
While clustered scheduling is a more general assumption (i.e., any locking protocol designed for clustered scheduling also works for global and partitioned scheduling), it also comes with the combined challenges of both global and partitioned scheduling, and is hence generally much more difficult to deal with.
Historically, most authors have thus focused on either global or partitioned scheduling.
Under partitioned and clustered scheduling, it is useful to distinguish between global and local resources.
Under partitioned (respectively, clustered) scheduling, a shared resource is considered local if it is accessed only by tasks that are all assigned to the same core (respectively, cluster). In contrast, a resource is global if it is accessed by at least two tasks assigned to different partitions (respectively, clusters). The advantage of this distinction is that local resources can be managed with existing, simpler, and often more efficient protocols: • under partitioned scheduling, local resources can be managed using one of the known, optimal uniprocessor protocols (e.g., the PCP [179] or the SRP [23]); and • under clustered scheduling, local resources can be managed using a (usually simpler) protocol for global scheduling (instantiated within each cluster).
In this survey, we therefore consider only global resources, which are the more challenging kind of shared resources to manage.

Key Design Choices
Given the common setting outlined so far, there are a number of key design questions that any multiprocessor real-time locking protocol must address. We next provide a high-level overview of these issues.

Request Order
The first key design parameter is the serialization order for conflicting requests. Whenever two or more requests for a resource are simultaneously blocked, the protocol must specify a policy for sequencing the waiting requests.
The two most common choices are FIFO queuing, which ensures basic fairness (i.e., non-starvation), is easy to implement, and analysis friendly, and priority queuing, which allows control over the amount of blocking incurred by different tasks. As a third choice, there also exist some situations (discussed in Sections 5.1 and 7) in which the use of hybrid queues consisting of both FIFO-and priority-ordered segments can be advantageous.
When using priority queues, each request must be associated with a priority to determine its position in the wait queue. The common choice is to use a job's scheduling priority, but it is also possible to use a separate request priority, which can be selected on a per-resource or even on a per-critical-section basis. The latter obviously provides a considerable degree of flexibility, but is not commonly considered since it introduces a nontrivial configuration problem. FIFO and priority queuing can be generalized in a straightforward way by requiring that equal-priority requests are satisfied in FIFO order.
Finally, implementation concerns may sometimes necessitate the use of unordered locks (e.g., primitive test-and-set spin locks), which do not provide any guarantees regarding the order in which conflicting critical sections will execute. Unordered locks are decidedly not analysis-friendly, but sometimes unavoidable.

Spinning vs. Suspending
The second main question is how tasks should wait in case of contention. The two principal choices are busy-waiting (i.e., spinning) and suspending. In the case of busy-waiting, a blocked task continues to occupy its processor and simply executes a tight delay (or spin) loop, continuously checking whether it has been granted the lock, until it gains access to the shared resource. Alternatively, if tasks wait by suspending, a blocked task yields the processor and is taken out of the scheduler's ready queue until it is granted the requested resource.
Determining how blocked tasks should wait is not an easy choice, as there are many advantages and disadvantages associated with either approach. On the one hand, suspension-based waiting is conceptually more efficient: busy-waiting obviously wastes processor cycles, whereas suspension-based waiting allows the wait times of one task to be overlaid with useful computation of another task. On the other hand, busy-waiting is easier to implement, easier to analyze, requires less OS support, and the cost of suspending and resuming a task can easily dwarf typical critical section lengths. Spin locks also provide predictability advantages that can aid in the static analysis of the system (e.g., a busy-waiting task "protects" its processor and cache state, whereas it is virtually impossible to predict the cache contents encountered by a resuming task).
Whether spinning or suspending is more efficient ultimately depends on workload and system characteristics, such as the cost of suspending and resuming tasks relative to critical section lengths, and it is impossible to categorically declare one or the other to be the "best" choice. Generally speaking, "short" critical sections favor busy-waiting, whereas "long" critical sections necessitate suspensions, but the threshold between "short" and "long" is highly system-and application-specific. We discuss spin-based locking protocols in Sections 4, 7, and 8 and suspension-based locking protocols in Sections 5-8.

Progress Mechanism
A third major choice is the question of how to deal with the lock-holder preemption problem, which is tightly coupled to the choice of scheduler, the employed analysis approach, and the constraints of the target workload. If a lock-holding task is preempted by a higher-priority task, then any other task waiting for the resource held by the preempted task is transitively delayed as well. This can give rise to (potentially) unbounded priority inversions (i.e., excessive delays that are difficult to bound), which must be avoided in a real-time system. To this end, it is at times necessary to (selectively) force the execution of lock-holding tasks by means of a progress mechanism. As this is a crucial aspect of multiprocessor real-time locking protocols, we dedicate Section 3 to the lock-holder preemption problem and common solutions.

Support for Fine-Grained Nesting
Fine-grained locking, where a task concurrently acquires multiple locks in a nested, incremental fashion, is a major source of complications in both the analysis and the implementation of multiprocessor real-time locking protocols. In particular, it comes with the risk of deadlock, and even if application programmers are careful to avoid deadlocks, nesting still introduces intricate transitive blocking effects that are extremely challenging to analyze accurately and efficiently. Furthermore, in many cases, support for fine-grained nesting leads to substantially more involved protocol rules and more heavy-weight OS support.
As already mentioned in Section 1, consequently many works on multiprocessor real-time locking protocols simply disallow the nesting of critical sections altogether, or under partitioned scheduling, restrict nesting to local resources only, where it can be resolved easily with classic uniprocessor solutions [23,163,179].
Another common approach is to sidestep the issue by relying on two-phase locking schemes with allor-nothing semantics, where a task either atomically acquires all requested locks, or holds none, or simple group lock approaches that automatically aggregate fine-grained, nested critical sections into coarse-grained, non-nested lock requests. From an analysis point of view, the two-phase and group locking schemes are conveniently similar to protocols that disallow nesting altogether, but from a developer's point of view, they impose limitations that may be difficult to accommodate in practice.
Only in recent years have there been renewed efforts towards full, unrestricted support for fine-grained nesting (e.g., [32,201]), and there remains ample opportunity for future work. We discuss the issues surrounding fine-grained nesting and the state of the art in Section 9, and until then focus exclusively on non-nested critical sections.

In-Place vs. Centralized Critical Sections
The final choice is where to execute a critical section once the lock has been acquired. In shared-memory systems, the typical choice is to execute critical sections in place, meaning that a task executes its critical sections as part of its regular execution, on the processor that it is (currently) assigned to by the scheduler.
However, that is not the only choice. It is also possible to a priori designate a synchronization processor for a particular resource, to the effect that all critical sections (pertaining to that resource) must be executed on the designated synchronization processor. This can yield analytical benefits (i.e., less blocking in the worst case [38]), a reduction in worst-case overheads [61], and throughput benefits due to improved cache affinity [136]. Furthermore, for specialized hardware resources, such as certain I/O devices, it might simply be unavoidable on some platforms (e.g., in a heterogenous multiprocessor platform, one processor might be a designated I/O processor). We discuss protocols that rely on designated synchronization processors in Section 6 and for now focus exclusively on in-place execution.

Analysis and Optimization Problems
In addition to the just-discussed design choices, which determine the runtime behavior of the protocol, there are also a number of challenging design-time problems related to a priori timing and schedulability analysis of the system, fundamental optimality questions, and system optimization and design-space exploration problems.
Most prominently, as a prerequisite to schedulability analysis, the blocking analysis problem asks to bound the worst-case delay due to resource conflicts. That is, given a workload, a multiprocessor platform, and a specific multiprocessor real-time locking protocol, the objective is to compute a safe (and as accurate as possible) upper bound on the maximum additional delay due to resource contention encountered by a given task in any possible execution of the system. Once such a bound is known for each task, hard timing guarantees can be made with a blocking-aware schedulability or response-time analysis. In some instances, it can be more accurate to carry out both the blocking analysis and the blocking-aware schedulability analysis jointly in a single step (e.g., [215]).
A large number of ad-hoc, protocol-specific blocking analyses have been developed over the years.
Additionally, a more general holistic blocking analysis framework [35] and a blocking analysis approach based on linear programming (LP) and mixed-integer linear programming (MILP) have been introduced to systematically reduce analysis pessimism [30,32,38,209,215]. These more recent analysis frameworks represent a general approach that can be (and has been) applied to many different locking protocols; we will note their use and discuss advantages in the context of specific locking protocols in Sections 4.1, 5.2.2, 5.2.3, and 9.
Clearly, it is generally desirable for blocking bounds to be as low as possible. However, if locks are used to resolve contention at runtime, it is also obvious that, in the worst case, some delays are inevitable. This observation naturally leads to the question of asymptotic blocking optimality: generally speaking, what is the least bound on maximum blocking that any protocol can achieve? This question has been studied primarily in the context of suspension-based locking protocols (since the spin-based case is relatively straightforward), and a number of protocols with provably optimal asymptotic blocking bounds have been found. We will discuss this notion of optimality and the corresponding protocols in Section 5.
Another notion of optimality that has been used to characterize multiprocessor real-time locking protocols is resource augmentation and processor speedup bounds, which relate a protocol's timing guarantees to that of a hypothetical optimal one in terms of the additional resources (or processor speed increases) needed to overcome the protocol's non-optimality. While this is a stronger notion of optimality than asymptotic blocking optimality-speedup and resource-augmentation results consider both blocking and scheduling, whereas asymptotic blocking optimality is concerned solely with the magnitude of blocking bounds-existing speedup and resource-augmentation results have been obtained under very restrictive assumptions (e.g., only one critical section per task) and yield quite large augmentation and speedup factors. We briefly mention some relevant works in Section 11.1.
Last but not least, a large number of challenging system optimization and design-space exploration problems can be formalized under consideration of synchronization constraints. Prominent examples include: • task mapping problems-given a processor platform, a scheduling policy, and a locking protocol, find an assignment of tasks to processors (or clusters) that renders the system schedulable, potentially while optimizing some other criteria (e.g., average response times, memory needs, energy or thermal budgets, etc.); • resource mapping problems-select for each shared resource a designated synchronization processor such that the system becomes schedulable; • platform minimization problems-given a workload, scheduling policy, and locking protocol, minimize the number of required cores; • policy selection problems-given a workload and a platform, identify (potentially on a per-resource basis) a locking protocol (or an alternative synchronization approach) that renders the system schedulable, again potentially while simultaneously optimizing for other criteria; and • many variations and combinations of these and similar problems.
Not surprisingly, virtually all interesting problems of these kinds are NP-hard since they typically involve solving one or more bin-packing-like problems. While a detailed consideration of optimization techniques is beyond the scope of this survey, we briefly mention some representative results that exemplify these types of system integration and optimization problems in Section 11.1.

Historical Perspective
Historically, the field traces its roots to the 1980s. While a discussion of the challenges surrounding multiprocessor synchronization in real-time systems, including a discussion of the respective merits of spin-and suspensions-based primitives, can be already found in an early critique of ADA [174] published in 1981, the first multiprocessor real-time locking protocol backed by a sound schedulability analysis taking worst-case blocking delays into account is Rajkumar et al.'s Distributed Priority Ceiling Protocol (DPCP) [165], which appeared in 1988. This result was followed in 1990 by the Multiprocessor Priority Ceiling Protocol (MPCP) [162], the second foundational protocol that had (and continues to have) a large impact on the field, and which in many ways still represents the prototypical suspension-based protocol for partitioned scheduling (which however should not obscure the fact that many other well-performing alternatives have been proposed since).
Throughout the 1990s, a number of protocols and lock implementations appeared; however, as multiprocessor real-time systems were still somewhat of a rarity at the time, multiprocessor synchronization was not yet a major concern in the real-time community. This fundamentally changed with the advent of multicore processors and multiprocessor system-on-a-chip (MPSoC) platforms in the early to mid 2000s.
Motivated by these trends, and the desire to minimize the use of stack memory in such systems, Gai et al. published a highly influential paper in 2001 proposing the Multiprocessor Stack Resource Policy (MSRP) [90]. While Gai et al.'s schedulability and blocking analysis has since been superseded by later, more accurate analyses [30,32,35,209], the MSRP remains the prototypical spin-based multiprocessor real-time locking protocol for partitioned scheduling. Another influential paper motivated by the widespread emergence of multicore processors as the standard computing platform was published in 2007 by Block et al., who introduced the Flexible Multiprocessor Locking Protocol (FMLP) [33], which combined many of the advantages of the MPCP and the MSRP, and which was the first to provide full support for both global and partitioned scheduling.
The FMLP paper marked the beginning of the recent surge in interest in multiprocessor real-time locking: since 2007, every year has seen more than a dozen publications in this area-about 140 in total in the past decade, which is almost three times as many as published in the 20 years prior. We dedicate the rest of this survey to a systematic review (rather than a chronological one) of this vibrant field.

Progress Mechanisms
At the heart of every effective multiprocessor real-time locking protocol is a progress mechanism to expedite the completion of critical sections that otherwise might cause excessive blocking to higherpriority or remote tasks. More specifically, a progress mechanism forces the scheduling of lock-holding tasks (either selectively or unconditionally), thereby temporarily overriding the normal scheduling policy. In this section, we review the major progress mechanisms developed to date and provide example schedules that illustrate key ideas.
As a convention, unless noted otherwise, we use fixed-priority (FP) scheduling in our examples and assume that tasks are indexed in order of strictly decreasing priority (i.e., τ 1 is always the highest-priority task). All examples in this section further assume the use of basic suspension-or spin-based locks (i.e., raw locks without additional protocol rules); by design the specifics are irrelevant.

Priority Inversion on Uniprocessors
To understand the importance of progress mechanisms, and why multiprocessor-specific mechanisms are needed, it is helpful to first briefly review the threat of "unbounded priority inversions" on uniprocessors and how it is mitigated in classic uniprocessor real-time locking protocols. 15 Figure 1: Example FP schedule of three tasks demonstrating an "unbounded" priority inversion on a uniprocessor. Irrelevant deadlines are omitted from this and all following figures to reduce clutter. Figure 1 shows the classic "unbounded priority inversion" example of three tasks under FP scheduling.
At time 1, the lowest-priority task τ 3 locks a resource that it shares with the highest-priority task τ 1 .
When τ 1 is activated at time 2, it also tries to lock the resource (at time 3), and thus becomes blocked by τ 3 's critical section, which intuitively constitutes a priority inversion since τ 1 is pending (i.e., it has unfinished work to complete before its deadline) and has higher priority than τ 3 , but τ 3 is scheduled instead of τ 1 . When the "middle-priority" task τ 2 is activated at time 4, it preempts the lock-holding, lower-priority task τ 3 , which delays the completion of τ 3 's critical section, which in turn continues to block τ 1 , until τ 2 completes and yields the processor at time 19 (at which point τ 1 has already missed its deadline).
Since τ 2 has lower priority than the pending (but not scheduled) τ 1 , this delay also constitutes a priority inversion. And since the length of this priority inversion is determined by τ 2 's WCET, which in general could be arbitrarily large, this is traditionally considered to be an "unbounded" priority inversion (even though technically it is bounded by the maximum scheduling interference incurred by τ 3 ). That is, a priority inversion is traditionally considered "bounded" only if its maximum-possible duration can be bounded in terms of only the maximum critical section length and the number of concurrent critical sections, and which is independent of all tasks' WCETs, since WCETs are expected to usually be (much) larger than typical critical section lengths.
To summarize, on uniprocessors, "unbounded" priority inversion arises as a consequence of the lockholder preemption problem, and it is problematic because it renders the response times of high-priority tasks (e.g., τ 1 's in Figure 1) dependent on the WCETs of lower-priority tasks (e.g., τ 2 's in Figure 1).
This contradicts the purpose of priority-driven scheduling, where higher-priority tasks (or jobs) should remain largely independent of the processor demands of lower-priority tasks (or jobs). On uniprocessors, classic progress mechanisms such as priority inheritance [179] or priority-ceiling protocols [23,179] completion  deadline  lock attempt  locked  unlocked   scheduled (on processor 1) scheduled (on processor 2) critical section (on processor 2) critical section (on processor 1) blocked (shared resource locked) Figure 2: Example G-FP schedule of four tasks on two processors demonstrating an "unbounded" priority inversion on a globally scheduled multiprocessor.
avoid unbounded priority inversion, either by raising the priority of lock-holding tasks or by delaying the release of higher-priority tasks.

Priority Inversion on Multiprocessors
The lock-holder preemption problem of course also exists on multiprocessors. For example, Figure 2, shows a situation comparable to Figure 1 involving four tasks on m = 2 processors under G-FP scheduling.
Analogously to the uniprocessor example, the lock-holding task τ 4 is preempted due to the arrival of two higher-priority tasks at times 2 and 3, respectively, which in turn induces an "unbounded" priority inversion (i.e., an unwanted dependency on the WCETs of lower-priority tasks) in the highest-priority (and blocked) task τ 1 .
However, in addition to creating an unwanted dependency of high-on low-priority tasks (or jobs), an untimely preemption of a lock holder can also result in undesirable delays of remote tasks or jobs. For instance, consider the example in Figure 3, which shows a partitioned fixed-priority (P-FP) schedule illustrating an "unbounded" priority inversion due to a remote task. Compared to the uniprocessor example in Figure 1, the roles of τ 2 and τ 1 have been switched, and τ 2 has been assigned (by itself) to processor 2. Again, the lock-holding task τ 3 is preempted at time 3 by a higher-priority task (τ 1 in this case). As a result, task τ 2 transitively incurs a delay proportional to τ 1 's WCET, even though τ 1 is, from the point of view of τ 2 , an unrelated remote task that τ 2 's response time intuitively should not depend on.
Specifically, even though τ 1 may have a numerically higher priority, when analyzing each processor as a uniprocessor system (the standard approach under partitioned scheduling), the delay transitively  completion  deadline  lock attempt  locked  unlocked   scheduled (on processor 1) scheduled (on processor 2) critical section (on processor 2) critical section (on processor 1) blocked (shared resource locked) Figure 3: Example P-FP schedule of three tasks on two processors demonstrating an "unbounded" priority inversion due to a remote task under partitioned scheduling.
incurred by τ 2 due to τ 1 must be considered an extraordinary source of interference akin to a priority inversion since there is no local higher-priority task that executes on processor 2 while τ 2 is pending.
As a result, multiprocessor systems require a more general notion of "priority inversion." To capture delays due to remote critical sections, the definition of priority inversion under partitioned scheduling must include not only the classic case where a (local) lower-priority task is scheduled instead of a pending, but blocked (local) higher-priority task, but also the case where a processor idles despite the presence of a pending (but remotely blocked) higher-priority task. Analogously, under global scheduling on an m-processor platform, any situation in which fewer than m higher-or-equal-priority tasks are scheduled while some task is waiting constitutes a priority inversion. Both cases (partitioned and global scheduling) can be captured precisely with the following definition. Recall that clustered scheduling generalizes both global and partitioned scheduling.
Def. 1. A job J of task τ i , assigned to a cluster C consisting of c cores, suffers priority-inversion blocking (pi-blocking) at time t if and only if 1. J is pending (i.e., released and incomplete) at time t, 2. J is not scheduled at time t, and 3. fewer than c equal-or higher-priority jobs of tasks assigned to cluster C are scheduled on processors belonging to τ i 's assigned cluster C.
Under partitioned scheduling c = 1, and under global scheduling c = m. We prefer the specific term "pi-blocking" rather than the more common, but also somewhat vague term "blocking" since the latter is often used in an OS context to denote suspensions of any kind, whereas we are explicitly interested  completion  deadline  lock attempt  locked  unlocked   scheduled (on processor 1) scheduled (on processor 2) critical section (on processor 2) critical section (on processor 1) blocked (shared resource locked) Figure 4: Example P-FP schedule of three tasks on two processors assuming non-preemptive critical sections.
only in delays that constitute a priority inversion.
Note that Definition 1 is defined in terms of jobs (and not tasks) to cover the full range of job-level fixed-priority (JLFP) policies, and in particular EDF scheduling (which belongs to the class of JLFP policies). We will further refine Definition 1 in Section 5 to take into account certain subtleties related to the analysis of self-suspensions.
Applying Definition 1 to the example in Figure 1, we observe that τ 1 indeed incurs pi-blocking from time 3 until time 20, since τ 1 is pending, but not scheduled, and fewer than c = 1 higher-priority jobs are scheduled, matching the intuitive notion of "priority inversion." In Figure 2, τ 1 suffers pi-blocking from time 2 until time 19 since fewer than c = m = 2 higher-priority jobs are scheduled while τ 1 waits to acquire the resource shared with τ 4 (under global scheduling, any locking-induced suspension constitutes a priority inversion for the top m highest-priority jobs). Similarly, in Figure 3, τ 2 suffers pi-blocking from time 2 until time 19 since in its cluster (i.e., its assigned core) it is pending, not scheduled, and fewer than c = 1 higher-priority jobs are scheduled (in fact, none are scheduled at all).

Non-Preemptive Sections
Several mechanisms (i.e., scheduling rules) have been proposed to ensure a bounded maximum (cumulative) duration of pi-blocking. The most simple solution is to let tasks spin and make every lock request a non-preemptive section: if tasks execute critical sections non-preemptively, then it is simply impossible for a lock holder to be preempted within a critical section. Figure 4 illustrates how turning critical sections into non-preemptive sections prevents "unbounded" pi-blocking in the example scenario previously shown in Figure 3. In Figure 4, because τ 3 cannot be  completion  deadline  lock attempt  locked  unlocked   scheduled (on processor 1) scheduled (on processor 2) critical section (on processor 2) critical section (on processor 1) blocked (shared resource locked) Figure 5: Example G-FP schedule of four tasks on two processors assuming non-preemptive critical sections with eager preemptions.
preempted from time 1 until time 4, the preemption due to the arrival of τ 1 is deferred, which ensures that the lock is released in a timely manner, and so τ 2 can meet its deadline at time 16.
However, the delay now incurred by τ 1 during the interval [3, 4) also constitutes pi-blocking. This highlights an important point: progress mechanisms do not come "for free." Rather, they must strike a balance between the delay incurred by tasks waiting to acquire a resource (e.g., τ 2 in Figure 4) and the delay incurred by higher-priority tasks (e.g., τ 1 in Figure 4) when the completion of critical sections is forced (i.e., when the normal scheduling order is overridden).
Executing lock requests as non-preemptive sections is also effective under clustered scheduling (and hence also under global scheduling). However, there exists a subtlety w.r.t. how delayed preemptions are realized that does not arise on uniprocessors or under partitioned scheduling. Consider the example schedules in Figures 5 and 6, which show two possible variants of the scenario previously depicted in Figure 2. In particular, since τ 4 executes its critical section non-preemptively from time 1 to time 4, τ 2 cannot preempt τ 4 -the lowest-priority scheduled task-at time 3. However, there does exist another lower-priority task that can be preempted at the time, namely τ 3 . Should τ 2 immediately preempt τ 3 or should it wait until time 4, when τ 4 , which intuitively should have been the preemption victim, finishes its non-preemptive section? Both interpretations of global scheduling are possible [33,35]. The former approach is called eager preemptions; the latter conversely lazy preemptions [35] or link-based global scheduling [33].
Whereas eager preemptions are easier to implement from an OS point of view, this approach suffers from the disadvantage that a job can suffer pi-blocking repeatedly due to non-preemptive sections in any unrelated lower-priority task and at any point during its execution: in the worst case, a job can be  completion  deadline  lock attempt  locked  unlocked   scheduled (on processor 1) scheduled (on processor 2) critical section (on processor 2) critical section (on processor 1) blocked (shared resource locked) Figure 6: Example G-FP schedule of four tasks on two processors assuming non-preemptive critical sections with lazy preemptions (i.e., assuming link-based global scheduling) preempted and suffer pi-blocking whenever a higher-priority job is released (such as τ 3 at time 3 in Figure 5), which is difficult to predict and bound accurately.
In contrast, on a uniprocessor (and under partitioned scheduling), in the absence of self-suspensions, a job suffers pi-blocking due to a lower-priority job's non-preemptive section at most once (i.e., immediately upon its release, or not at all), a property that greatly aids worst-case analysis.
The lazy preemption approach, aiming to restore this convenient property, reduces the number of situations in which a job is repeatedly preempted due to a non-preemptive section in a lower-priority job [33,35]. While the lazy preemption approach cannot completely eliminate the occurrence of repeated preemptions in all situations [49], under a common analysis approach-namely, if task execution times are inflated to account for delays due to spinning and priority inversions (discussed in Sections 4 and 5.1)-it does ensure that pi-blocking due to a non-preemptive section in a lower-priority job has to be accounted for only once per job (in the absence of self-suspensions) [33,35,49], analogously to the reasoning in the case of uniprocessors or partitioned scheduling. In other words, lazy preemption semantics ensure analysis conditions that are favorable for inflation-based analysis.
Link-based global scheduling [33,35], which realizes lazy preemptions, derives its name from the fact that it establishes a "link" between a newly released job and the non-preemptively executing job that it should have preempted (if any); the deferred preemption is then enacted as soon as the linked job exits its non-preemptive section, which can be implemented efficiently [35]. Link-based global scheduling has been implemented and evaluated in LITMUS RT [35,52], a real-time extension of the Linux kernel. 3 completion  deadline  lock attempt  locked  unlocked   scheduled (on processor 1) scheduled (on processor 2) critical section (on processor 2) critical section (on processor 1) blocked (shared resource locked) Figure 7: Example P-FP schedule of four tasks, one of which is particularly latency-sensitive, on two processors assuming non-preemptive critical sections.
Non-preemptive execution can be achieved in several ways, depending on the OS and the environment.
In a micro-controller setting and within OS kernels, preemptions are typically avoided by disabling interrupts. In UNIX-class RTOSs with a user-mode / kernel-mode divide, where code running in usermode cannot disable interrupts, non-preemptive execution can be easily emulated by reserving a priority greater than that of any "regular" job priority for tasks within critical sections.
Regardless of how non-preemptive sections are realized, the major drawback of this progress mechanism is that it can result in unacceptable latency spikes, either if critical sections are unsuitably long or if (some of the) higher-priority tasks are particularly latency-sensitive. For example, consider the scenario illustrated in Figure 7, which is similar to the one depicted in Figure 4, with the exception that another high-priority task with a tight relative deadline of only two time units has been introduced as τ 1 on processor 1. Since this task has very little tolerance for any kind of delay, it is clearly infeasible to just turn τ 4 's request into non-preemptive section since it is "too long" relative to τ 1 's latency tolerance, as shown in Figure 7. However, not doing anything is also not a viable option since then τ 2 would transitively cause τ 3 to miss its deadline at time 16, similarly to the scenario shown in Figure 3.

Priority Inheritance
Since it is hardly a new observation that "long" non-preemptive sections are problematic in the presence of tight latency constraints, better solutions have long been known in the uniprocessor case, namely the classic priority inheritance and priority-ceiling protocols [179]. Unfortunately, these approaches do not transfer well to the multiprocessor case, in the sense that they are not always effective w.r.t. bounding the maximum duration of pi-blocking.  completion  deadline  lock attempt  locked  unlocked   scheduled (on processor 1) scheduled (on processor 2) critical section (on processor 2) critical section (on processor 1) blocked (shared resource locked) Figure 8: Example G-FP schedule of four tasks on two processors assuming priority inheritance.
Priority inheritance is a good match for global scheduling, and is indeed used in multiprocessor real-time locking protocols for global scheduling (as discussed in Sections 5.1.2 and 5.2.2). Recall that, with priority inheritance, a lock-holding task τ i 's effective priority is the maximum of its own base priority and the effective priorities of all tasks that are waiting to acquire a lock that τ i currently holds [179]. Figure 8, which shows the same scenario as Figure 2, illustrates how this rule is effective under global scheduling: with the priority inheritance rule in place, τ 4 remains scheduled at time 4 when the higher-priority task τ 2 is released since τ 4 inherits the priority of τ 1 , the maximum priority in the system, during the interval [2,4). As a result, the unrelated task τ 3 is preempted instead, similar to the eager preemption policy in the case of non-preemptive sections as illustrated in Figure 5. (To date, no preemption rule analogous to the lazy preemption policy discussed in Section 3.3 has been explored in the context of priority inheritance.) Again, this highlights that the progress mechanisms used to mitigate unbounded priority inversions are themselves a source of bounded priority inversions, which must be carefully taken into account during blocking analysis.
Unfortunately, priority inheritance [179] works only under global scheduling: it is ineffective (from the point of view of worst-case blocking analysis) when applied across cores (respectively, clusters) under partitioned (respectively, clustered) scheduling. The reason can be easily seen in Figure 3: even though the priority inheritance rule is applied across cores, τ 3 's effective priority is merely raised to that of τ 2 , which does not prevent the preemption by τ 1 at time 3 (recall that tasks are indexed in order of strictly decreasing priority). For the same reason, classic ceiling-based protocols like the PCP [179] and the SRP [23] are also ineffective: given that τ 1 does not access the shared resource, the ceiling priority of the shared resource is lower than τ 1 's priority. Fundamentally, the root cause is that numeric priority values are, analytically speaking, incomparable across processor (respectively, cluster) boundaries since partitions (respectively, clusters) are scheduled independently.

Allocation Inheritance
The solution to this problem is an idea that has appeared several times in different contexts and under various names: spinning processor executes for preempted processors (SPEPP) [194], local helping [103,104], allocation inheritance [107,109,110], multiprocessor bandwidth inheritance [84,85], and migratory priority inheritance [37,50]. The essential common insight is that a preempted task's critical section should be completed using the processing capacity of cores on which the blocked tasks would be allowed to run (if they were not blocked).
That is, a blocking task should not only inherit a blocked task's priority, but also the "right to execute" on a particular core, which serves to restore analytical meaning to the inherited priority: to obtain a progress guarantee, a preempted lock holder must migrate to the core where the pi-blocking is incurred.
Intuitively, Definition 1 implies that, if a task τ i incurs pi-blocking, then its priority is sufficiently high to ensure that a lock holder inheriting τ i 's priority can be scheduled on τ i 's processor (or in τ i 's cluster), since the fact that τ i incurs pi-blocking indicates the absence of runnable higher-priority jobs of tasks assigned to τ i 's processor or cluster (recall Clause 3 in Definition 1).
An example of this approach is shown in Figure 9, which shows the same scenario involving a latencysensitive task previously shown in Figure 7. In contrast to the example in Figure 7, at time 1.5, when the latency-sensitive task τ 1 is activated, the lock-holding task is preempted (just as it would be in the case of priority inheritance). However, when τ 3 blocks on the resource held by τ 4 at time 3, τ 4 inherits the right to use the priority of τ 3 on τ 3 's assigned processor (which is processor 2, whereas τ 4 is assigned to processor 1). Consequently, τ 4 migrates from processor 1 to processor 2 to continue its critical section.
When τ 4 finishes its critical section at time 4.5, it ceases to inherit the priority and right to execute on processor 2 from τ 3 and thus cannot continue to execute on processor 2. Task τ 4 hence migrates back to processor 1 to continue its execution at time 18 when τ 2 completes. Overall, τ 1 suffers no latency penalty when it is released at time 1.5, but task τ 3 also suffers no undue delays while waiting for τ 4 to release the shared resource.
As already mentioned, several different names have been used in the past to describe progress mechanisms based on this principle. We adopt the term "allocation inheritance" [107,109,110] since it clearly describes the idea that processor time originally allocated to a blocked task is used towards the completion of a blocking task's critical section. The name also highlights the fact that this approach is a B. Brandenburg completion deadline lock attempt locked unlocked scheduled (on processor 1) scheduled (on processor 2) critical section (on processor 2) critical section (on processor 1) blocked (shared resource locked) Figure 9: Example P-FP schedule of four tasks, one of which is particularly latency-sensitive, on two processors assuming migratory priority inheritance.
generalization of the classic priority inheritance idea. In fact, under event-driven global scheduling and on uniprocessors (the two cases where priority inheritance is effective), allocation inheritance in fact reduces to priority inheritance since all tasks are eligible to execute on all cores anyway.
From a purely analytical point of view, allocation inheritance is elegant and highly attractive: as evident in Figure 9, it has no negative latency impact on unrelated higher-priority tasks, while ensuring guaranteed progress, thus restoring the strong analytical foundation offered by priority inheritance on uniprocessors. Put differently, allocation inheritance is the natural multiprocessor extension of classic priority inheritance that allows the idea to work under any multiprocessor scheduling approach.
However, from a practical point of view, it can be difficult to support allocation inheritance efficiently: either it introduces task migrations (and the associated kernel complexities and cache overheads) into partitioned systems that otherwise would need none, or there must be some other, resource-specific way for remote processors to continue (or safely duplicate) the operation that the preempted task was trying to accomplish [56,194], which can be difficult (or even impossible) to achieve for certain kinds of resources (e.g., hardware resources such as I/O ports). In particular, if the latter approach is feasible (i.e., helping operations to complete without requiring a complete task migration), it is usually also possible to implement completely lock-or even wait-free solutions (e.g., [17,166]), which can be an overall preferable solution in such cases [52]. We discuss allocation inheritance, protocols built on top of it, and practical implementations in Sections 7 and 10.3.

Priority Boosting
The most commonly used progress mechanism is priority boosting, which is conceptually quite similar to non-preemptive sections and also a much older idea than allocation inheritance. Simply put, priority boosting requires that each critical section (pertaining to a global resource) is executed at a boosted priority that exceeds the maximum regular (i.e., non-boosted) scheduling priority of any task. As a result, newly released jobs, which do not yet hold any resources, cannot preempt critical sections, just as with non-preemptive sections. In fact, applying priority boosting to the examples shown in Figures 2 and 3 would yield exactly the same schedules as shown in Figures 5 and 4, respectively. However, in contrast to non-preemptive sections, tasks remain preemptive in principle, and since other critical sections may be executed with even higher boosted priorities, it is possible that a task executing a critical section may be preempted by another task also executing a critical section (pertaining to a different resource).
In essence, priority boosting establishes a second priority band on top of regular task priorities that is reserved for lock-holding tasks.
Priority boosting is easy to support in an RTOS, and easy to emulate in user-mode frameworks and applications if not explicitly supported by the RTOS. It can also be considered the "original" progress mechanism, as its use (in uniprocessor contexts) was already suggested by multiple authors in 1980 [126,127], and because the two first multiprocessor real-time locking protocols backed by analysis, the DPCP [165] and the MPCP [162], rely on it. However, while it is conveniently simple, priority boosting also comes with major latency penalties similar to non-preemptive sections, which limits its applicability in systems with tight latency constraints.

Restricted Priority Boosting
Priority boosting as described so far, and as used in the DPCP [165], MPCP [162], and many other protocols, is unrestricted, in the sense that it applies to all tasks and critical sections alike, regardless of whether or not a lock-holding task is actually causing some other task to incur pi-blocking. In contrast, both priority and allocation inheritance kick in only reactively [183], when contention leading to pi-blocking is actually encountered at runtime.
completion deadline lock attempt locked unlocked scheduled (on processor 1) scheduled (on processor 2) critical section (on processor 2) critical section (on processor 1) blocked (shared resource locked) Figure 10: Example P-FP schedule of four tasks, one of which is particularly latency-sensitive, on two processors assuming the critical section priority is raised to an intermediate level in between the priorities of tasks τ 1 and τ 2 protocols that ensure asymptotically optimal pi-blocking bounds, such as priority donation [35,47,48], restricted segment boosting [41], and replica-request priority donation [204]. We will discuss these more sophisticated progress mechanisms in the context of the protocols in which they were first used in Sections 5.1, 5.2, and 8.2.

Priority Raising
As a final consideration, one can pragmatically devise a rule to the effect that critical sections are executed unconditionally at an elevated priority that, in contrast to priority boosting, is not necessarily higher than the maximum regular scheduling priority, but still higher than most regular scheduling priorities. The intended effect is that tasks with "large" WCETs cannot preempt critical sections, whereas lightweight latency-sensitive tasks (e.g., critical interrupt handlers) with minuscule WCETs are still permitted to preempt critical sections without suffering any latency impact.
For example, consider the schedule shown in Figure 10, which shows the same scenario previously depicted in Figures 7 and 9. Suppose the critical section priority for the resource shared by τ 3 and τ 4 is chosen to be higher than the priority τ 2 , but below the priority of τ 1 . As a result, when τ 1 is activated at time 1.5, it simply preempts the in-progress critical section of τ 4 , which transitively causes some pi-blocking for τ 3 . However, this extra delay is small relative to the critical section length of τ 4 and the execution requirement of τ 3 . Importantly, when τ 2 is released at time 5, it is not able to preempt the in-progress critical section of τ 4 , which ensures that τ 3 does not suffer an excessive amount of pi-blocking. Again, this causes some pi-blocking to τ 2 , which however is minor relative to its own WCET.
To re-iterate, this pragmatic scheme avoids both the need to migrate tasks (i.e., allocation inheritance) and the latency degradation due to non-preemptive sections and priority boosting by raising the priority of short critical sections so that it exceeds the priorities of all tasks with "substantial" WCETs, while also keeping it below that of latency-sensitive tasks. Since latency-sensitive tasks must have relatively high priorities anyway, and since latency-sensitive tasks usually do not have large WCETs in practice, this scheme has the potential to work for a wide range of workloads. However, it violates a strict interpretation of the common notion of "bounded priority inversions" since now the pi-blocking bounds of certain remote tasks depend on the WCETs of high-priority latency-sensitive tasks (e.g., in Figure 10, the pi-blocking bound of τ 3 on Processor 2 depends on the WCET of τ 1 on Processor 1). The "priority raising" approach is thus not frequently considered in the academic literature.
This concludes our discussion of progress mechanisms. We next start our review of multiprocessor locking protocols and begin with spin-lock protocols, as they are conceptually simpler and easier to analyze than semaphore protocols.

Spin-Lock Protocols
The distinguishing characteristic of a spin lock is that a waiting task does not voluntarily yield its processor to other tasks. That is, in contrast to suspension-based locks, spin locks do not cause additional context switches. 4 However, the use of spin locks does not necessarily imply the absence of preemptions altogether; preemptable spin locks permit regular preemptions (and thus context switches) as required by the scheduler during certain phases of the protocol. Such preemptions, however, do not constitute voluntary context switches, and a task that is preempted while spinning does not suspend; rather, it remains ready in the scheduler's run-queue.
All protocols considered in this section force the uninterrupted execution of critical sections, by means of either non-preemptive execution or priority boosting, which simplifies both the analysis and the implementation. There also exist spin-based protocols under which tasks remain preemptable at all times (i.e., that allow tasks to be preempted even within critical sections); such protocols usually require allocation inheritance and are discussed in Section 7.
In the analysis of spin locks, it is important to clearly distinguish between two different cases of "blocking," as illustrated in Figure 11. First, since jobs execute the protocol in part or in whole non-preemptively, critical section (on processor 1) spinning (shared resource locked) Figure 11: Example P-FP schedule of three tasks on two processors illustrating the difference between s-blocking (i.e., delays due to spinning) and pi-blocking (i.e., delays due to priority inversion).
higher-priority jobs that are released while a lower-priority job is executing a spin-lock protocol can be delayed. As already discussed in Section 3.3, this is a classic priority inversion due to non-preemptive execution as covered by Definition 1; recall that this kind of delay is called pi-blocking.
Definition 1, however, does not cover the delay that jobs incur while spinning because it applies only to jobs that are not scheduled, whereas spinning jobs are being delayed despite being scheduled. To clearly distinguish this kind of delay from pi-blocking, we refer to it as spin blocking (s-blocking) [35]. Note that, if jobs spin non-preemptably, then the s-blocking incurred by a lower-priority job can transitively manifest as pi-blocking experienced by a local higher-priority job. A sound blocking analysis must account for both types of blocking.

Spin-Lock Protocols for Partitioned Scheduling
The first spin-lock protocol backed by a sound blocking and schedulability analysis is due to Gai et al. The MSRP is a protocol for partitioned scheduling and can be used with both FP and EDF scheduling (on each core). Like earlier suspension-based protocols for partitioned scheduling [162,163,165], the MSRP distinguishes between local and global resources (recall Section 2.1). Local resources are dealt with by means of the classic SRP [23] and are of no concern here. Global resources are protected with non-preemptive FIFO spin locks. When a task seeks to acquire a shared resource, it first becomes non-preemptable (which resolves any local contention) and then executes a spin-lock algorithm that ensures that conflicting requests by tasks on different processors are served in FIFO order. The exact choice of FIFO spin-lock algorithm is irrelevant from a predictability point of view; many suitable choices with varying implementation tradeoffs exist (see Section 10.1). Figure 12 depicts an example MSRP schedule, where τ 2 's request is satisfied after τ 4 's request because τ 4 issued its request slightly earlier. The highest-priority task τ 1 incurs considerable pi-blocking upon its release at time 2 since the local lower-priority task τ 2 is spinning non-preemptively. Here, τ 1 is transitively blocked by τ 3 and τ 4 's critical sections while τ 2 incurs s-blocking.
The fact that tasks remain continuously non-preemptable both while busy-waiting and when executing their critical sections has several major implications. In conjunction with the FIFO wait queue order, it ensures that any task gains access to a shared resource after being blocked by at most m−1 critical sections, where m in this context denotes the number of processors on which tasks sharing a given resource reside. This property immediately ensures starvation freedom and provides a strong progress guarantee that allows for a simple blocking analysis [90]. However, as apparent in Figure 12, it also causes O(m) latency spikes, which can be highly undesirable in hard real-time systems [37,72,190,191,193,194] and which implies that the MSRP is suitable only if it can be guaranteed that critical sections are short relative to latency expectations, especially on platforms with large core counts.
From an implementation point of view, simply making the entire locking protocol non-preemptive is attractive because it completely decouples the scheduler implementation from locking protocol details, which reduces implementation complexity, helps with maintainability, and lessens overhead concerns.
In fact, of all protocols discussed in this survey, the MSRP imposes the least implementation burden and is the easiest to integrate into an OS. s-blocking is then simply bounded by the sum of the per-request s-blocking bounds. Finally, a task's inflated WCET is the sum of its cumulative s-blocking bound and its original (i.e., non-inflated) WCET.
Existing schedulability analysis can then be applied to the inflated WCET bounds.
While Gai et al.'s original analysis [90] is simple and convenient, it comes with substantial structural pessimism. In particular, a major source of pessimism is that the maximum critical section lengths (on remote cores) are over-represented in the final bound. Effectively, every blocking remote critical section is considered to exhibit the length of the longest critical section, which is clearly pessimistic for shared resources that support multiple operations of various cost. For example, consider a producer-consumer scenario where multiple tasks share a sorted list of work items ordered by urgency that may include up to 100 elements, and suppose the list is accessed by two types of critical sections: (i) removal of the first element and (ii) an order-preserving insertion. When performing a blocking analysis, it is clearly undesirable to account for each O(1) dequeue operation as an O(n) enqueue operation.
To lessen the impact of this source of pessimism, a holistic blocking analysis of the MSRP was developed [35]. A holistic analysis considers all critical sections of a task together and directly derives an overall per-task s-blocking bound, rather than attributing s-blocking to individual critical sections and then summing up the individual bounds. Holistic blocking analysis effective in avoiding the overcounting of long critical sections in the analysis of a single task. However, because it still proceeds on a task-by-task basis and relies on inflated execution times to account for transitive s-blocking, the holistic approach [35] still over-estimates the impact of long critical sections if multiple local tasks access the same global resource, because in such a case the longest critical section is reflected in multiple inflated WCETs. In fact, Wieder and Brandenburg showed that any blocking analysis that relies on execution-time inflation is asymptotically sub-optimal due to this fundamental structural pessimism [209].
To avoid such structural pessimism altogether, Wieder and Brandenburg developed a novel MILP-based blocking analysis for spin-lock protocols under P-FP scheduling that by design prevents any critical sections from being accounted for more than once in the final aggregate pi-and s-blocking bound [209].
Crucially, Wieder and Brandenburg's analysis does not rely on execution time inflation to implicitly account for transitive s-blocking delays (i.e., lower-priority tasks being implicitly delayed when local higher-priority tasks spin). Rather, it explicitly models both transitive and direct s-blocking, as well as pi-blocking, and directly derives a joint bound on all three kinds of delay by solving a MILP optimization problem [209]. Biondi and Brandenburg [30] recently provided an equivalent analysis for P-EDF scheduling.
Overall, if critical sections are relatively short and contention does not represent a significant schedulability bottleneck, then Gai et al.'s original analysis [90] or the holistic approach [35] are sufficient.
However, in systems with many critical sections, high-frequency tasks, or highly heterogenous critical section lengths, Wieder and Brandenburg and Biondi and Brandenburg's LP-based approaches are substantially more accurate [30,209]. In his thesis, Wieder discusses further optimizations, including a significant reduction in the number of variables and how to convert the MILP-based analysis into an LP-based approach without loss of accuracy [207].

Non-FIFO Spin Locks
While FIFO-ordered wait queues offer many advantages-chiefly among them starvation freedom, ease of analysis, and ease of implementation-there exist situations in which FIFO ordering is not appropriate or not available.
For instance, if space overheads are a pressing concern (e.g., if there are thousands of locks), or in systems with restrictive legacy code constraints, it may be necessary to resort to unordered spin locks such as basic test-and-set (TAS) locks, which can be realized with a single bit per lock. In other contexts, for example given workloads with highly heterogenous timing requirements, it can be desirable to use priority-ordered spin locks, to let urgent tasks acquire contended locks more quickly.
Implementation-wise, the MSRP design-SRP for local resources, non-preemptive spin locks for global resources-is trivially compatible with either unordered or priority-ordered locks (instead of FIFOordered spin locks). The resulting analysis problem, however, is far from trivial and does not admit a simple per-resource approach as followed in Gai et al.'s original analysis of the MSRP [90]. This is because individual critical sections are, in the worst case, subject to starvation effects, which can result in prolonged s-blocking. Specifically, in priority-ordered locks, a continuous stream of higher-priority critical sections can delay a lower-priority critical section indefinitely, and in unordered locks, any request may starve indefinitely as long as there is contention.
The lack of a strong per-request progress guarantee fundamentally necessitates a "big picture" view as taken in the holistic approach [35] to bound cumulative s-blocking across all of a job's critical sections.
Suitable analyses for priority-ordered spin locks were proposed by Negrean and Ernst [147] and Wieder and Brandenburg [209].
Additionally, Wieder and Brandenburg also proposed the first analysis applicable to unordered spin locks [209]. While unordered locks are traditionally considered to be "unanalyzable" and thus unsuitable for real-time systems, Wieder and Brandenburg made the observation that unordered spin locks are analytically equivalent to priority-ordered spin locks if each task is analyzed assuming that all local tasks issue requests with the lowest-possible priority whereas all remote tasks issue high-priority requests, which maximizes the starvation potential.

Preemptable Spinning
The most severe drawback of non-preemptive FIFO spin locks (and hence the MSRP) is their O(m) latency impact [37,72,190,191,193,194]. One approach to lessen this latency penalty without giving up too much desirable simplicity is to allow tasks to remain preemptable while busy-waiting, as illustrated in Figure 13, while still requiring critical sections to be executed non-preemptively (to avoid the lock-holder preemption problem). This has the benefit that preemptions are delayed by at most one critical section-the latency impact is reduced to O(1)-which greatly improves worst-case scalability [72,190,191,193,194].
Preemptable spinning poses two major challenges. The first challenge is the implementation: while preemptable spinning can be easily integrated into unordered TAS locks, it requires substantially more sophisticated algorithms to realize FIFO-or priority-ordered spin locks that support preemptable spinning [18,72,109,191,194]. The reason is that a job that is preempted while busy-waiting must be removed from the spin queue, or marked as preempted and skipped, to avoid granting the lock to a currently preempted job (and hence re-introducing the lock-holder preemption problem).
As a result, preemptable spinning poses analytical problems, which is the second major challenge.
When a job continues execution after having been preempted, it may find itself dequeued from the spin queue-that is, after a preemption, a job may find that its lock request was canceled while it was preempted-to the effect that it must re-issue its canceled lock request, which carries the risk of encountering additional contention. Furthermore, in the worst case, the job may be preempted again while waiting for its re-issued lock request to be satisfied, which will necessitate the request to be re-issued once more, and so on.
The additional delays that arise from the cancellation of preempted requests hence cannot be analyzed on a per-request basis and inherently require a holistic analysis approach that avoids execution-time inflation. Appropriate blocking analysis for preemptable FIFO-and priority-ordered spin locks, as well as preemptable unordered spin locks, was first proposed by Wieder and Brandenburg for P-FP scheduling [209], and recently extended to P-EDF scheduling by Biondi and Brandenburg [30]. Alfranseder et al. [15] also proposed a protocol based on FIFO spin locks and preemptable spinning.
In systems with quantum-driven schedulers, where the scheduler preempts jobs only at well-known times, and not in reaction to arbitrarily timed events, the cancellation penalty is reduced because no request must be re-issued more than once if critical sections are reasonably short [18]. As a result, it is possible [18] to apply execution-time inflation approaches similar to the original MSRP analysis [90]. Nonetheless, since every job release causes at most one cancellation (in the absence of self-suspensions) [209], and since critical sections typically outnumber higher-priority job releases, it is conceptually still preferable to apply more modern, inflation-free analyses [30,209] even in quantum-driven systems.

Spin-Lock Protocols based on Priority Boosting
Exploring a different direction, Alfranseder [14] introduced a variation of the preemptable spinning approach in which jobs initially remain preemptable even when executing critical sections, but become priority-boosted as soon as contention is encountered. Alfranseder's protocol is based on the following observation: if non-preemptive execution is applied unconditionally (as in the MSRP [90]), then lockholding jobs cannot be preempted and thus cause a latency impact even if there is actually no contention for the lock (i.e., even if there is no lock-holder preemption problem to mitigate). Since in most systems lock contention is rare, the latency impact of non-preemptive execution, though unavoidable from a worst-case perspective, may be undesirable from an average-case perspective.
As an alternative, Alfranseder thus proposed the Forced Execution Protocol (FEP), which uses on-demand priority boosting (instead of unconditional non-preemptive execution) to reactively expedite the completion of critical sections only when remote jobs actually request a locked resource and start to spin. This design choice has the benefit of reducing the average priority inversion duration (i.e., the average latency impact), but it comes at a high price, namely increased worst-case pi-blocking, because high-priority jobs may be delayed by multiple preempted critical sections. This effect is illustrated in Figure 14, which depicts a scenario in which a single job of a higher-priority task (e.g., τ 1 in Figure 14) may suffer pi-blocking due to multiple lower-priority critical sections since the FEP [14] allows incomplete critical sections to be preempted. Thus, if a remote task forces the completion of multiple preempted critical sections (e.g., τ 5 in Figure 14), then a higher-priority task may be repeatedly delayed due to priority boosting. In contrast, the use of non-preemptive execution in the MSRP [90] ensures that, on each processor and at any point in time, at most one critical section is in progress. In summary, allowing critical sections to be preempted, only to be forced later, makes the worst case worse. We discuss protocols that avoid this effect by using allocation inheritance rather than priority boosting in Section 7.
So far we have discussed two cases at opposite ends of the preemption spectrum: either jobs spin nonpreemptively as in the MSRP, or they remain preemptable w.r.t. all higher-priority jobs while spinning.
However, it is also possible to let waiting jobs spin at some other predetermined intermediate priority.
Afshar et al. [5] observed that this flexibility allows for a generalized view on both spin locks and suspension-based protocols. In particular, Afshar et al. noted that jobs that spin at maximum priority are effectively non-preemptive, whereas jobs that spin at minimum priority are-from an analytical point of view-essentially suspended, in the sense that they neither prevent other jobs from executing nor issue further lock requests.  jobs that are preempted while spinning are not canceled, which allows for multiple critical sections to be simultaneously outstanding on the same core. As just discussed in the context of Alfranseder's FEP [14], increasing the number of incomplete requests that remain to be boosted at a later time increases the amount of cumulative pi-blocking that higher-priority jobs may be exposed to.
For example, Figure 15 depicts a schedule illustrating Afshar et al.'s protocol in which tasks τ 2 , τ 3 , and τ 4 spin at their regular priority. Jobs of all three tasks block on a resource held by a job of task τ 5 , and thus when τ 5 releases the lock, the highest-priority task τ 1 suffers pi-blocking due to the back-to-back execution of three priority-boosted critical sections. This highlights that indiscriminately lowering the priority at which tasks spin is not always beneficial; rather, a good tradeoff must be found [11]. For instance, in the scenario shown in Figure 15, the back-to-back pi-blocking of τ 1 could be avoided by letting τ 2 , τ 3 , and τ 4 all spin at the priority of τ 2 .
Afshar et al. [12] study the spin priority assignment problem under the FSLM approach in depth and introduce a method for choosing elevated spin priorities that dominates unrestricted priority boosting (i.e., it is not always best to spin at the maximum priority) [12]. Furthermore, Afshar completion deadline lock attempt locked unlocked scheduled (on processor 1) scheduled (on processor 2) critical section (on processor 2) critical section (on processor 1) spinning (shared resource locked) Figure 15: Example P-FP schedule of five tasks on two processors illustrating preemptable spinning without request cancelation and priority boosting [5].

Non-Preemptive Critical Sections with Allocation Inheritance
It is in fact possible to achieve universally low blocking bounds without requiring workload-specific parameters. Exploring an unconventional alternative to classic spin locks, Takada and Sakamura [194] proposed an elegant protocol that achieves preemptable spinning with O(1) maximum pi-blocking, FIFO-ordering of critical sections, and s-blocking bounds just as good as those provided by the MSRP.

Takada and Sakamura's solution, called the Spinning Processor Executes for Preempted Processors (SPEPP)
protocol [194], is based on the idea that the processors of blocked jobs should work towards the completion of blocking critical sections, rather than just "wasting" cycles in a spin loop.
More specifically, in a regular FIFO-ordered spin lock, a job enqueues itself in a spin queue, busy-waits, and then executes its own critical section when it finally holds the lock. Takada and Sakamura's SPEPP protocol changes this as follows. A job first enqueues the operation that it intends to carry out on the shared object (as well as any associated data, i.e., in programming language terms, a closure) in a wait-free FIFO queue, and then proceeds to acquire the actual lock. As it acquires the lock, the job becomes non-preemptable and proceeds to dequeue and execute operations from the FIFO-ordered operations queue until its own operation has been completed. Crucially, whenever the job finishes an operation, it checks for deferred preemptions and interrupts, and releases the lock and becomes preemptable if any are pending. As a result, maximum pi-blocking is limited to the length of one operation (i.e., one critical section length) [194], and the time that jobs spend being s-blocked is used to complete the operations of preempted jobs, which is an instance of the allocation inheritance principle (as discussed in Section 3.5).
An interesting corner case occurs when both a preempted and the preempting job seek to access the same resource. In this case, simply following the above protocol (i.e., if the preempting job just appends its operation) could lead to the buildup of long queues, which would result in excessively pessimistic s-blocking bounds (i.e., in the worst case, s-blocking linear in the number of tasks n). Takada and Sakamura devised a better solution: by letting the preempting job steal the preempted job's slot in the queue, at most m operations are enqueued at any time [194]. As this effectively cancels the preempted job's request, it must re-issue its request when it resumes. However, in contrast to the preemptable spin locks discussed in Section 4.1.2, this does not cause additional s-blocking-as Takada and Sakamura argue, any additional s-blocking incurred by the preempted job upon re-issuing its request is entirely offset by a reduction in the s-blocking incurred by the preempting job (which benefits from stealing a slot that has already progressed through the FIFO queue). As a result, there is no additional net delay: Takada and Sakamura's SPEPP protocol ensures O(1) maximum pi-blocking with O(m) maximum s-blocking [194].

Spin-Lock Protocols for Global Scheduling
Holman and Anderson [107,108,110] were the first to consider spin-based real-time locking protocols under global scheduling. In particular, Holman and Anderson studied synchronization in systems scheduled by an optimal Pfair scheduler [25,184], and introduced the important distinction between short and long shared resources.
A shared resource is considered "short" if all critical sections that access it are (relatively speaking) short, and "long" if some related critical sections are (relatively) long, where the exact threshold separating "short" and "long" is necessarily application-and system-specific. To synchronize access to short resources, Holman and Anderson proposed two protocols based on FIFO spin locks, which we discuss next. (For long resources, Holman and Anderson proposed allocation inheritance and semaphore protocols, as discussed in Section 7.) Without getting into too much Pfair-specific detail [25,184], it is important to appreciate some specific challenges posed by this optimal scheduling approach. Pfair scheduling is quantum-based, which means that it reschedules tasks regularly at all multiples of a system quantum Q. The magnitude of this system quantum typically ranges from a few hundred microseconds to a few milliseconds. As a consequence, all but the shortest jobs span multiple quanta, and thus are likely to be preempted and rescheduled multiple times during their execution.
To avoid problematic lock-holder preemptions, which are prone to occur if critical sections cross quantum boundaries, Holman and Anderson introduced the notion of a frozen zone, or blocking zone, at the end of each scheduling quantum: if a job attempts to commence the execution of a critical section in this zone (i.e., if the next quantum boundary is less than a given threshold away in time), then its lock request is automatically blocked until the beginning of its next quantum of execution, regardless of the availability of the shared resource. If critical sections are shorter than the system quantum length Q-which is arguably the case for any reasonable threshold for "short" critical sections-then such a zone-based protocol ensures that no job is ever preempted while holding a spin lock [107,108,110].
The remaining question is then how to deal with jobs that attempted to lock an unavailable resource before the start of the automatic blocking zone, and which are still spinning at the end of the current quantum, or which are granted the requested resource inside the automatic blocking zone. Holman and Anderson considered two solutions to this problem.
First, under Holman and Anderson's skip protocol, such a job remains in the spin queue and retains its position, but is marked as inactive and can be skipped over by later-enqueued active jobs. When a preempted, inactive job receives the next quantum of processor service, it is reactivated and becomes again eligible to acquire the resource. Furthermore, if a job is at the head of the FIFO spin queue, then it immediately acquires the lock since all spin locks are available at the beginning of each quantum in zone-based protocols [107,108,110]. The primary advantage of Holman and Anderson's skip protocol is that it is starvation-free since preempted jobs retain their position in the FIFO queue. However, this also has the consequence that a job is blocked by potentially n − 1 other jobs in the spin queue (i.e., every other task)-that is, unlike in the case of the MSRP [90], the number of blocking critical sections cannot be bounded by the number of processors m. Since typically n > m, this leads to more pessimistic s-blocking bounds.
Holman and Anderson's second solution, called the rollback protocol [107,108,110], restores m − 1 as a bound on the maximum number of blocking critical sections, but is applicable only under certain restrictions. Whereas the skip protocol requires only that the maximum critical section length, denoted L ma x , does not exceed the quantum length Q (i.e., L max ≤ Q), the rollback protocol further requires m × L ma x ≤ Q. This constraint yields the property that, if tasks on all processors attempt to execute a critical section at the beginning of a quantum, then each task will have finished its critical section by the end of the quantum. As a result, there is no need to maintain a preempted job's queue position to guarantee progress, and instead a spinning job's request is simply canceled when it is preempted at the end of a quantum (i.e., the job is removed from the spin queue). Consequently, no spin queue contains more than m jobs at any time. Furthermore, any lock attempt is guaranteed to succeed at the latest in a job's subsequent quantum, because a preempted job immediately re-issues its request when it continues execution, and every request issued at the beginning of a quantum is guaranteed to complete before the end of the quantum since m × L ma x ≤ Q [107,108,110].
Holman and Anderson [107,108,110] presented blocking analyses for both the rollback and the skip protocol. While Pfair is not widely used in practice today, Holman and Anderson's concept of an automatic blocking zone at the end of a job's guaranteed processor allocation has been reused in many locking protocols for reservation-based (i.e., hierarchically scheduled) systems, in both uniprocessor and multiprocessor contexts (as mentioned in Section 11.1).
In later work on non-Pfair systems, Devi et al. Protocol [33], which is actually a consolidated family of related protocols for different schedulers and critical section lengths. In particular, the FMLP supports both global and partitioned scheduling (with both fixed and EDF priorities), and also adopts Holman and Anderson's distinction between short and long resources [108]. For each of the resulting four combinations, the FMLP includes a protocol variant.
For short resources, the FMLP relies on non-preemptive FIFO spin locks. Specifically, for short resources under partitioned scheduling, the FMLP essentially integrates the MSRP [90], and for short resources under global scheduling, the FMLP integrate's Devi et al.'s proposal and analysis [73], albeit with link-based scheduling (i.e., lazy preemptions, see Section 3.3), whereas Devi et al. [73] did not specify a preemption policy. For long resources, the FMLP relies on semaphores, which we will discuss next.
The distinguishing characteristic of suspension-based locks, also commonly referred to as semaphores or mutexes, is that tasks that encounter contention self-suspend to yield the processor to other, lower-priority tasks, which allows wait times incurred by one task to be overlaid with useful computation by other tasks. Strictly speaking, the suspension-based locks considered in this section correspond to binary semaphores, whereas the suspension-based k-exclusion protocols discussed in Section 8.2 correspond to counting semaphores. We simply say "semaphore" when the type of protocol is clear from context.
As mentioned in Section 2.2.5, in the case of semaphores, there exist two principal ways in which critical sections can be executed: either in place (i.e., on a processor on which a task is also executing its non-critical sections), or on a dedicated synchronization processor. We focus for now on the more common in-place execution, and consider protocols for dedicated synchronization processors later in Section 6.
In principle, semaphores are more efficient than spin locks: since wait times of higher-priority jobs can be "masked" with useful computation by lower-priority jobs, no processor cycles are wasted and the processor's (nearly) full capacity is available to the application workload. However, there are major challenges that limit the efficiency of semaphores in practice.
First, in practical systems, suspending and resuming tasks usually comes with non-negligible costs due to both OS overheads (e.g., ready queue management, invocations of the OS scheduler, etc.) and micro-architectural overheads (e.g., loss of cache affinity, disturbance of branch predictor state, etc.).
Thus, if the expected wait time is shorter than the cumulative overheads of suspending, then spinning can be more efficient in practice. Whether or not runtime overheads make spinning more attractive depends on a number of factors, including the length of critical sections (relative to overhead magnitudes), the degree of contention (likelihood of spinning), and the magnitude of OS and architectural overheads. As our focus is on analytical concerns, we do not consider this aspect any further.
The second major challenge is that semaphores are subject to more intense worst-case contention because they allow other tasks to execute and issue additional lock requests while a task is waiting.
That is, compared to non-preemptive spin locks, wait queues can become much longer as the number of concurrent requests for any resource is no longer implicitly upper-bounded by the number of processors (as for instance in the case of the MSRP [90], recall Section 4.1). Hence accurate blocking analysis is even more important for semaphores than for spin locks, as otherwise any practical efficiency gains are at risk of being overshadowed by analysis pessimism. suspended, waiting to acquire the single shared resource (i.e., the maximum pi-blocking duration is . This places semaphore protocols at an analytical disadvantage.
And while we have chosen FIFO queueing in this example for simplicity, this effect is not specific to any particular queue order; in particular, similar examples can be constructed for protocols that employ priority queues, too [45].
Another complication that suspension-based locking protocols must address is that tasks are inherently not guaranteed to be scheduled when they become the lock owner. That is, if a task encounters contention and self-suspends, then it will certainly not be scheduled when it receives ownership of the lock, and worse, it may remain unscheduled for a prolonged time if higher-priority task(s) started executing in the meantime. The resulting delay poses a risk of substantial transitive pi-blocking if other blocked tasks are still waiting for the same lock. Real-time semaphore protocols hence generally require a progress mechanism that ensures that lock-holding tasks can (selectively) preempt higher-priority tasks when waking up from a self-suspension. In contrast, simple non-preemptive spin locks do not have to take resuming lock holders into account.
Finally, and most importantly, while semaphores allow wait times to be potentially overlaid with useful computation, showing that this actually happens in the worst case (i.e., showing that the processor does not just idle while tasks suspend) is not always possible. And even when it is theoretically possible, it is an analytically difficult problem that requires identifying (or safely approximating) the worst-case self-suspension pattern, which has proven to be a formidable challenge [68].
More precisely, on multiprocessors, an accurate analysis of semaphores generally requires the use of a suspension-aware (s-aware) schedulability test, that is, an analysis that applies to a task model that incorporates an explicit bound on a task's maximum self-suspension time. In contrast, most schedulability analyses published to date are suspension-oblivious (s-oblivious), in the sense that they make the modeling assumption that tasks never self-suspend (i.e., jobs are either ready to execute or complete).
S-oblivious schedulability analyses can still be employed if tasks (briefly) self-suspend [68], but any selfsuspensions must be pessimistically modeled as computation time during analysis (i.e., execution-time inflation must be applied). For example, if a task τ i with WCET C i self-suspends for at most S i time units, then it would be modeled and analyzed as having a WCET of C i + S i when applying s-oblivious schedulability analysis-the task's processor demand is safely, but pessimistically, over-approximated.
Given that the primary feature of suspension-based locking protocols is that tasks do not occupy the processor while waiting to acquire a lock, one may deem it intuitively undesirable to model and analyze suspension times as processor demand. However, s-aware schedulability analyses are unfortunately difficult to obtain and can be very pessimistic. Case in point, prior work on s-aware schedulability analysis for uniprocessor fixed-priority scheduling was found to be flawed in several instances [68], and the best correct analyses available today are known to be only sufficient, but not exact (in contrast to response-time analysis for non-self-suspending tasks, which is exact on uniprocessors).
Another example that highlights the challenge of finding efficient s-aware schedulability analysis is G-EDF scheduling: an s-oblivious analysis of G-EDF was available [28] for several years before the first s-aware test for G-EDF [131] was proposed. Furthermore, the s-aware test was actually found to be more pessimistic than a simple s-oblivious approach when applied in the context of a suspension-based locking protocol [41].
Generally speaking, as a result of the challenges surrounding s-aware analysis and the pessimism present in today's analyses, s-oblivious approaches can be competitive with s-aware analyses, and at times even yield superior performance in empirical comparisons [35,48]. It is hence worthwhile to study both approaches, and to compare and contrast their properties.
Most importantly, the s-oblivious and s-aware approaches fundamentally differ w.r.t. the best-possible bound on cumulative pi-blocking [35,45,48]. More precisely, Definition 1 can be refined for the s-oblivious case, and with the refined definition in place (Definition 2 below), the inherently pessimistic treatment of suspensions in s-oblivious schedulability analyses allows some of this pessimism to be "recycled," in the sense that less pessimistic assumptions have to be made when analyzing priority inversions in the s-oblivious case, which in turn allows for lower bounds on pi-blocking.
More formally, consider maximum pi-blocking, which for a given task set τ is the amount of pi-blocking incurred by the task that suffers the most from priority inversion: max{B i | τ i ∈ τ}, where B i is the pi-blocking bound for task τ i [45]. Interestingly, the s-aware and s-oblivious analysis assumptions yield asymptotically different bounds on maximum pi-blocking [35,45,48]. Specifically, there exist semaphore protocols that ensure that any task will incur at most O(m) pi-blocking in the s-oblivious sense [45,48], whereas no semaphore protocol can generally guarantee pi-blocking bounds better than Ω(n) in the s-aware case [41,45] (recall that m denotes the number of processors and n the number of tasks, and that typically n > m). In the following, we review these bounds and the protocols that achieve them. We first discuss locking protocols intended for s-oblivious analysis because they are simpler and easier to analyze, and then consider locking protocols intended for s-aware analysis thereafter.

Suspension-Oblivious Analysis of Semaphore Protocols
Under s-oblivious schedulability analysis, self-suspensions are modeled as execution time during analysis.
However, at runtime, tasks of course self-suspend; the distinction between the s-oblivious and s-aware approaches is purely analytical. In fact, it is possible to analyze any protocol using either approach, and strictly speaking the protocols themselves are neither "suspension-oblivious" nor "suspensions-aware." However, certain protocols are easier to analyze, or can be more accurately analyzed, under one of the two analysis approaches, which gives rise to the commonly used terminology of s-oblivious and s-aware semaphore protocols.
In this subsection, we review s-oblivious locking protocols, i.e., semaphore protocols that are primarily analyzed using s-oblivious analysis, and that in many cases were designed specifically with s-oblivious analysis in mind.

Suspension-Oblivious Analysis and Blocking Optimality
The key insight underlying the analysis of s-oblivious locking protocols is that, since s-oblivious schedulability analysis pessimistically over-approximates any self-suspension times as processor demand, it is possible to reclaim some of this pessimism by refining the definition of pi-blocking (Definition 1) to account for this modeling assumption. More precisely, "suspension-oblivious pi-blocking" is defined such that any times during which both 1. a job is self-suspended while waiting to acquire a semaphore and 2. this delay can be attributed to higher-priority tasks (under the "suspended tasks create processor demand" analysis assumption) are not counted as pi-blocking, which allows tighter pi-blocking bounds to be established (without endangering soundness of the analysis).
Intuitively, this works as follows. Consider clustered scheduling and a task τ i assigned to a cluster consisting of c processor cores. First, suppose a job J is waiting to acquire some semaphore and there are (at least) c higher-priority ready jobs, that is, J is self-suspended and there are c higher-priority jobs occupying the processors in J's cluster. In this situation, J does not incur pi-blocking according to Definition 1 (although it is waiting to acquire a semaphore) since it would not be scheduled even if it were ready, due to the presence of c higher-priority ready jobs. In other words, the self-suspension does not have to be accounted for as additional delay in this case because J would be delayed anyway.
Now consider the following alternative scenario: J is self-suspended and there are c higher-priority jobs in J's cluster, but all higher-priority jobs are also self-suspended, each waiting to acquire some semaphore (possibly, but not necessarily, the same that J is waiting for). That is, the higher-priority jobs in J's cluster are pending, but not ready. In this case, if J were ready, it would be scheduled immediately since in the real system the suspended higher-priority jobs do not occupy any processors, and hence intuitively this situation represents a priority inversion for J (and also according to Definition 1). However, under s-oblivious analysis, the self-suspension times of higher-priority jobs are modeled as execution time.
Hence, in the analyzed model of the system, the pending higher-priority jobs are analyzed as if they were occupying all processors, and hence J incurs no additional delay in the modeled situation under the s-oblivious analysis assumption. The following definition exploits this observation. 2. not scheduled at time t (i.e., it is self-suspended or preempted), 3. fewer than c equal-or higher-priority jobs of tasks assigned to cluster C are pending on processors belonging to τ i 's assigned cluster C.

Def. 2. A job
Note that Definitions 1 and 2 differ in clause (3) w.r.t. whether the higher-priority jobs are required to be pending (Definition 2) or scheduled (Definition 1).
Based Definition 2, the suspension-oblivious schedulability analysis approach can be summarized as follows. 5 • Suppose we are given a self-suspending task set τ = {τ 1 , . . . , τ n }, where each task in τ is characterized by its WCET C i , a relative deadline D i , a period T i , and a bound S i on the maximum cumulative self-suspension duration of any of its jobs.
• Further suppose that B i denotes a bound on the maximum cumulative duration of suspensionoblivious pi-blocking incurred by any of τ i 's jobs (where B i ≤ S i ).
• Let τ = {τ 1 , . . . , τ n } denote the corresponding inflated, suspension-free task set, where each if it can be shown that τ does not miss any deadlines, then τ also does not miss any deadlines.
progress mechanisms to simplify the explanation. Any additional priority inversions (e.g., due to non-preemptive execution) are handled analogously by inflation. Clearly, this bound cannot be zero, as some blocking is unavoidable under any mutual exclusion scheme.
It is in fact trivial to construct task sets in which a job exhibits Ω(m) s-oblivious pi-blocking under any locking protocol: if a lock is requested simultaneously by tasks on all m processors, then m (unit-length) critical sections must be serialized in some order, and hence whichever task acquires the lock last is blocked by (at least) m − 1 critical sections (i.e., any general pi-blocking bound is necessarily linear in the number of processors to cover this scenario). If there are exactly c tasks assigned to each cluster (i.e., if there are only m tasks in total), then according to Definition 2 any self-suspension results in s-oblivious pi-blocking, and the lower bound trivially follows [35,45,48].
While this lower bound on maximum s-oblivious pi-blocking is straightforward, finding a matching upper bound is less obvious. Given that up to n jobs can simultaneously contend for the same lock, one might wonder whether this is even possible. However, as we review next, it is in fact possible to construct locking protocols that ensure O(m) s-oblivious pi-blocking for any sporadic task set [35,45,48], which establishes that, under s-oblivious schedulability analysis, Θ(m) pi-blocking is fundamental [35,45,48].

Global Scheduling
The earliest semaphore protocols for global scheduling are due to Holman and Anderson [108,109,110], who introduced support for lock-based synchronization in Pfair-scheduled systems. However, due to the quantum-based nature of Pfair, their analysis is not s-oblivious in the sense of Definition 2; we hence defer a discussion of their work until Section 7.
The first multiprocessor real-time semaphore protocol explicitly studied using the s-oblivious analysis approach is Block et al.'s FMLP [33]. As already discussed in Section 4, the FMLP is actually a family of related protocols for different scheduling approaches and incorporates both spin-and suspension-based variants. Aiming for simplicity in both implementation and analysis, the FMLP for long resources (i.e., the semaphore variant) for global scheduling combines priority inheritance (recall Section 3.4) with simple FIFO wait queues.
Priority inheritance ensures that a lock-holding job is scheduled whenever another job that it blocks is incurring s-oblivious pi-blocking. This is easy to see: under global scheduling (i.e., if there is only one cluster of size m), a job incurs s-oblivious pi-blocking only if it is among the m highest-priority pending jobs (Definition 2), and thus the lock-holding job is guaranteed to inherit a priority that allows it to be immediately scheduled [33].
Combined with the strong progress guarantee of FIFO wait queues, the long FMLP for global scheduling ensures that a job incurs s-oblivious pi-blocking for the duration of at most n − 1 = O(n) critical section lengths while waiting to acquire a lock. This bound shows that, while more accurate analyses taking actual request patterns into account are possible [35], in the general case the FMLP does not ensure asymptotically optimal maximum s-oblivious pi-blocking. In fact, no protocol relying exclusively on FIFO or priority queues can be optimal in this regard [45].
The first asymptotically optimal protocol is the O(m) Locking Protocol (OMLP) [35,45,47,48], which, as the name suggests, ensures O(m) maximum s-oblivious pi-blocking for any task set. Like the FMLP, the OMLP is also a family of protocols for global, partitioned, and clustered scheduling, which we review in turn.
The OMLP variant for global scheduling (i.e., the global OMLP) [45] relies on priority inheritance, like the earlier global FMLP [33]. To achieve optimality, it replaces the FMLP's simple FIFO queue with a hybrid wait queue, which consists of a bounded FIFO segment of length m and a priority-ordered tail queue that feeds into the FIFO segment.
Jobs that request the lock enqueue directly in the FIFO segment if there is space (i.e., if fewer than m jobs are contending for the resource), and otherwise in the tail queue, which is ordered by job priority.
The job at the head of the FIFO queue holds the lock; when it releases the lock, it is dequeued from the in the priority-ordered tail queue, which follows from the following observation [45]. Suppose a job J that is waiting in the tail queue is skipped over m times (i.e., at least m times another job is moved to the end of the FIFO queue while J is waiting). Since the tail queue is priority-ordered, each job that skipped ahead has a higher priority than J. Furthermore, since the FIFO queue has a capacity of exactly m jobs, it follows that there are m higher-priority pending jobs, which implies that J incurs no s-oblivious pi-blocking after it has been skipped over at least m times (recall clause (3) of Definition 2). Thus, in total, a job incurs s-oblivious pi-blocking for a cumulative duration of at most 2m − 1 = O(m) critical sections while moving through both queues, which is within a factor of 2m−1 of the lower bound and thus asymptotically optimal [35,45,48]. Fine-grained (i.e., non-asymptotic) analyses of the global OMLP taking into account actual request patterns are available as well [35,48].
Ward [200] studied two variants of mutual exclusion called preemptive mutual exclusion and half-protected resources, which are intended for synchronizing (in software) access to shared hardware resources such as memory buses and caches (which have the special property that they can be revoked without risking an inconsistent state of the shared resource, e.g., revocation of a granted cache partition carries a performance penalty but no consistency hazard). To analyze the resulting synchronization problem, Ward introduced idleness analysis [200], new blocking analysis technique that bounds the maximum amount of idleness induced on other cores by a critical section, rather than bounding the number of waiting jobs. Idleness analysis can also be applied to the analysis of regular mutual exclusion protocols such as the OMLP or the FMLP.

Partitioned Scheduling
In the case of partitioned scheduling, priority inheritance is ineffective (Section 3.4), with priority boosting being the traditional alternative (Section 3.6). This choice was also adopted in the design of the long FMLP for partitioned scheduling [33], which was the first semaphore protocol for partitioned scheduling to be analyzed under the s-oblivious approach.
Like all other FMLP variants, the long FMLP for partitioned scheduling relies on FIFO queues. One additional twist that arises in conjunction with priority boosting is that a tie-breaking policy is required to determine which job to schedule if there are multiple lock-holding jobs on the same processor. In the interest of simplicity, the FMLP favors whichever job first acquired its respective lock (i.e., "earliestresumed job first") [33]. This later turned out to be a non-ideal choice in the context of suspension-aware analysis (discussed in Section 5.2.3), and was changed to an earliest-issued request first policy in the later FMLP + [35].
However, under s-oblivious analysis, either tie-breaking rule is problematic, as unrestricted priorityboosting generally prevents optimal s-oblivious pi-blocking (regardless of the order in which blocked jobs wait), which can be inferred from the following simple example. Consider a job J that is the highest-priority job on its processor, and suppose for the sake of illustration that n − 1 tasks reside on job J's processor, with the remaining task located on a second processor. Now suppose that, just before J is released, the remote task first acquires a shared lock and then all other tasks on J's processor suspend while waiting for the same lock. If lock-holding jobs are unconditionally priority-boosted, then J will be preempted for the duration of one critical section of each of the n − 2 other tasks on J's processor, which results in Ω(n) s-oblivious pi-blocking even if J itself does not acquire any locks itself. As a result of this effect, and because FIFO queues allow for pi-blocking due to up to n − 1 critical sections per critical section, jobs incur s-oblivious pi-blocking of up to (n − 2) + (n − 1) = 2n − 3 critical section lengths under the long FMLP for partitioned scheduling, which is not asymptotically optimal.
The partitioned OMLP [45] solves the "too many boosted jobs" problem with a token mechanism to limit the number of tasks that can simultaneously request global resources, which implicitly restricts the maximum delay due to priority boosting while also ensuring that global wait queues remain short.
Under the partitioned OMLP, there is a single contention token associated with each processor. A processor's contention token is a local (virtual) resource that is managed using an optimal uniprocessor protocol (such as the PCP [179] or the SRP [23]). Furthermore, each global resource is associated with a FIFO wait queue, and jobs holding (global) resources are priority-boosted, just as in the earlier FMLP.
However, the key OMLP rule is that a task must hold its local contention token before it may issue a request for a global resource. As a result, only at most m tasks compete for global resources at any time, which in conjunction with FIFO queues and priority boosting immediately yields a pi-blocking bound of m − 1 critical section lengths once a job holds its local contention token. Additionally, a job may incur pi-blocking while it is waiting to acquire a contention token, which however is also limited to m critical section lengths (including any priority boosting effects) [45].
As a result, the partitioned OMLP guarantees a bound on s-oblivious pi-blocking for the duration of m − 1 critical sections per request, plus s-oblivious pi-blocking for the duration of up to m critical sections due to competition for the local contention token and priority boosting, for a total of 2m − 1 critical section lengths (assuming a task that issues only one request per job), which is within 2m−1 m−1 ≈ 2 of the lower bound and thus asymptotically optimal [35,48]. A fine-grained (i.e., non-asymptotical) analysis of the partitioned OMLP is available [47,48].

Clustered Scheduling
The case of "true" clustered scheduling, where there are multiple clusters (unlike the special case of global scheduling) and each cluster contains more than one processor (unlike the special case of partitioned scheduling), is particularly challenging because it combines the challenges of both global and partitioned scheduling. In particular, priority inheritance across clusters is ineffective (Section 3.4), but priority boosting, even if restricted by a token mechanism as in the partitioned OMLP, makes it difficult to obtain asymptotically optimal s-oblivious pi-blocking bounds.
For this reason, a new progress mechanism called priority donation was developed for the clustered OMLP [35,47,48]. As already mentioned in Section 3.7, priority donation can be understood as a form of restricted priority boosting. However, the key difference to the token mechanism used in the partitioned OMLP is that there exists an explicit relationship between the lock-holding job that is forced to be scheduled (i.e., the priority recipient) and the job that is not scheduled as a result (i.e., the priority donor). In contrast, priority boosting just prescribes that a job is scheduled, but leaves unspecified which other job is not scheduled as a result, which causes analytical complications if there is more than one processor in a cluster (i.e., if there is a choice w.r.t. which job to preempt).
Priority donation maintains the invariant that, in each cluster and for each lock-holding job J, J is either among the c highest-priority jobs in its cluster, or there exists a job among the c highest-priority jobs that is the unique and exclusive priority donor for J. As a result of this invariant, contention for global locks is limited to at most m concurrent lock requests, and lock-holding jobs are guaranteed to make progress towards releasing the lock (i.e., lock holders are never preempted).
A job can become priority donor only once, immediately upon its release (i.e., before it starts executing).
While it serves as priority donor, it is suspended to make available a processor for the priority recipient, and thus incurs s-oblivious pi-blocking. Priority donation ceases when the critical section of the priority recipient ends. The maximum request duration-from the time that a lock is requested until the time that the lock is released-thus also determines the amount of s-oblivious pi-blocking transitively incurred by the priority donor.
Under the clustered OMLP, each resource is associated with a simple FIFO wait queue [35,47,48].
Since priority donation guarantees that lock-holding jobs are scheduled, and since there are at most m concurrent requests for global resources in progress at any time, a job is delayed by at most m − 1 earlier critical sections per lock request. This in turn implies that priority donors incur s-oblivious pi-blocking for the cumulative duration of at most m critical sections [47]. The blocking bound for the clustered OMLP is thus equivalent to that of the partitioned OMLP, and it is hence also asymptotically optimal within a factor of roughly two of the lower bound [47,48].
Additional protocols designed specifically for s-oblivious analysis are discussed in Sections 7 and 8.2.
However, none of these protocols, nor any OMLP variant, ensures an upper bound on maximum soblivious pi-blocking better than within roughly a factor of two of the known lower bound. It is presently unknown whether it is possible to close this gap in the general case.

Suspension-Aware Analysis of Semaphore Protocols
Under s-aware analysis, any self-suspensions due to lock contention and priority inversions due to progress mechanisms are explicitly modeled and must be accounted for by the schedulability test. Hence there is no opportunity to "recycle" any pessimism, there is no "analysis trick" as in the s-oblivious case-when targeting s-aware analysis, the goal of the locking protocol designer is simply to bound maximum delays as tightly as possible.
The potential upshot is that an underlying s-aware schedulability analysis can potentially be much more accurate when characterizing the effects of contention, and substantially less pessimistic in terms of system utilization since execution times are not being inflated. This is an important consideration especially if self-suspensions are relatively long. For instance, s-aware analysis becomes essential when synchronizing access to graphics processing units (GPUs), where critical section lengths can easily reach dozens or even hundreds of milliseconds [81]. In comparison, when considering shared data structures, where critical sections are typically just a few microseconds long [18,52], the s-oblivious utilization impact is minor.
However, while historically the first multiprocessor real-time locking protocols [162,163,165,175] have all been intended for s-aware analysis, the understanding of self-suspensions from a schedulability point of view has only recently begun to mature, and a number of misunderstandings and misconceptions have been identified in earlier analyses of task sets with self-suspensions [68]. Multiprocessor locking protocols for s-aware analysis, and the required s-aware analyses themselves, are thus presently still active areas of research.
In the following, we provide an overview of the current state of the art, starting with a brief review of the definition of s-aware pi-blocking, known asymptotic bounds, and (non-)optimality results, and then summarize major binary semaphore protocols for global, partitioned, and clustered scheduling.

Suspension-Aware Schedulability Analysis and Blocking Optimality
In the case of s-aware schedulability analysis, any delay that does not result from the execution of higher-priority jobs constitutes a priority inversion that must be explicitly accounted for. This is captured by the following definition. 2. J is not scheduled at time t (i.e., it is self-suspended or preempted), and 3. fewer than c equal-or higher-priority jobs of tasks assigned to cluster C are scheduled on processors belonging to τ i 's assigned cluster C.

Def. 3. A job
Notably, Definition 3 is equivalent to the classic uniprocessor notion of pi-blocking (Definition 1). The key difference to the s-oblivious case (Definition 2) is that under Definition 3 only the presence of c scheduled higher-priority jobs prevents a delay from being considered a priority inversion, whereas under Definition 2 a priority inversion is ruled out if there are c pending higher-priority jobs. Since any scheduled job is also pending, Definition 3 is weaker than Definition 2, and consequently any bound on s-aware pi-blocking is also a bound on s-oblivious pi-blocking (but the converse does not hold) [35,45].
The fundamental lower bound on s-aware pi-blocking is Ω(n) [35,45], which can be easily shown with a task set in which all n tasks simultaneously compete for a single shared resource [45], so that whichever task acquires the resource last is delayed by n − 1 earlier critical sections.
While the lower bound is rather intuitive, the true challenge is again to construct locking protocols that asymptotically match this lower bound, that is, to find protocols that ensure O(n) maximum s-aware pi-blocking for any task set. In fact, from a blocking optimality point of view, the s-aware case is much more challenging than the well-understood s-oblivious case, and required several attempts until it was solved [35,41,45]. To date, while there exists a protocol for clustered scheduling that achieves O(n) maximum s-aware pi-blocking-namely the generalized FMLP + [41]-which suffices to establish asymptotic tightness of the lower bound under global and partitioned scheduling, no protocol with asymptotically optimal s-aware pi-blocking bounds is known specifically for global scheduling [35,41,215].
The search for practical protocols that are also asymptotically optimal with regard to maximum s-aware pi-blocking is complicated by several non-optimality results. For one, any protocol relying exclusively on priority queues is generally subject to an Ω(m × n) lower bound on maximum s-aware pi-blocking due to starvation effects [45]. Furthermore, under global scheduling, any protocol relying on priority inheritance or (unrestricted) priority boosting is subject to an Ω(φ) lower bound on maximum s-aware pi-blocking [35,41], where φ corresponds to the ratio of the longest to the shortest period of the task set (and which in general cannot be bounded in terms of m or n). The generalized FMLP + [41], which we discuss in Section 5.2.5 below, thus requires more sophisticated machinery to achieve its O(n) bound under clustered scheduling.

Global Scheduling
Almost all semaphore protocols designed specifically for global scheduling rely on priority inheritance.
As already mentioned in the discussion of the s-oblivious case (Section 5.1.2), Block et al.'s global FMLP for long resources [33], based on FIFO wait queues, was the first protocol in this category, and even though the initial analysis was s-oblivious [33] (no s-aware analysis for global scheduling was known yet at the time of publication), the protocol itself works well under s-aware analysis, too, and an effective s-aware analysis has been presented by Yang et al. [215] for G-FP scheduling.
The classic Priority Inheritance Protocol (PIP) [179], which combines priority inheritance (the progress mechanism, Section 3.4) with priority-ordered wait queues, was initially analyzed under G-FP scheduling by Easwaran and Andersson [77]. In more recent work, Easwaran [150], which retains the use of priorityordered wait queues, but replaces priority inheritance with priority boosting. They further derived bounds on the maximum resource-hold times under both the original PIP and the I-PIP, as well as heuristics for reducing resource-hold times without violating schedulability [150].
Motivated by their analysis of the PIP, Easwaran and Andersson also proposed a new semaphore protocol [77,78] that they called the Parallel Priority-Ceiling Protocol (P-PCP) [77], which is also based on priority inheritance and priority-ordered wait queues. Additionally, inspired by the classic uniprocessor PCP [179], the P-PCP introduces rules that prevent jobs from acquiring available resources to limit, at each priority level, the maximum number of lower-priority jobs that may simultaneously hold locks. Intuitively, such a rule can help to limit the amount of pi-blocking caused by the progress mechanism, but it introduces considerable complexity and has to be carefully balanced with the extra delay introduced by withholding available resources. Easwaran and Andersson [77] did not provide an empirical comparison of the PIP and the P-PCP; a later evaluation by Yang et al. [215] based on their more accurate re-analysis of both protocols found that the P-PCP offers no substantial benefits over the (much simpler) PIP and FMLP protocols.
Yang et al. [215] also compared the long FMLP and the PIP, and found the two protocols to be incomparable: fundamentally, some real-time workloads require the non-starvation guarantees of the FMLP's FIFO queues, whereas other workloads require that urgent jobs are prioritized over less-urgent jobs.
In practice, it is thus preferable for a system to offer both FIFO and priority-ordered wait queues, and it would not be difficult to combine Yang et al.'s analyses of the FMLP and the PIP to analyze such a hybrid protocol.

Partitioned Scheduling
Across all combinations of multiprocessor scheduling and synchronization approaches, the category considered next-multiprocessor real-time semaphore protocols for partitioned scheduling with in-place execution of critical sections-has received the most attention in prior work. The classic, prototypical protocol in this domain is Rajkumar's Multiprocessor Priority Ceiling Protocol (MPCP) for P-FP scheduling [162,163]. The MPCP is a natural extension of uniprocessor synchronization principles, is appealingly simple, and has served as a template for many subsequent protocols. To ensure lock-holder progress, the MPCP relies on priority boosting (Section 3.6). Specifically, for each resource, the protocol determines a ceiling priority that exceeds the priority of any regular task, and the effective priority of a resource-holding task is unconditionally boosted to the ceiling priority of the resource that it holds.
To resolve contention, each shared resource is associated with a priority-ordered wait queue, in which blocked tasks wait in order of their regular scheduling priority. From a blocking optimality point of view, this choice prevents asymptotic optimality [35,45]. However, empirically, the MPCP is known to perform well for many (but not all) workload types [38].
Priority-boosted tasks remain preemptable under the MPCP. Resource-holding jobs can thus be preempted by other resource-holding jobs. The choice of ceiling priorities therefore has a significant impact on blocking bounds. Rajkumar's original proposal [162,163] did not provide a specific rule for determining ceiling priorities; rather, it specified certain conditions for acceptable ceiling priorities, which left some degree of choice to the implementor. Later works [123,145] have simply assumed that the priority ceiling of a global resource is the maximum priority of any task accessing the resource, offset by a system-wide constant to ensure priority-boosting semantics (as discussed in Section 3.6).
Since the MPCP is the original shared-memory multiprocessor real-time locking protocol, it unsurprisingly has received considerable attention in subsequent works. Lortz and Shin [135] studied the choice of queue order in the MPCP and observed that assigning tasks explicit synchronization priorities (unrelated to their scheduling priorities) that reflect each task's blocking tolerance can significantly improve schedulability [135]. Furthermore, Lortz and Shin observed that simply using FIFO queues instead of priority-ordered wait queues can yield substantial schedulability improvements [135], which is consistent with observations made later in the context of the FIFO-based FMLP and FMLP + [35,38,41,42]. A variant of the MPCP with FIFO queues was later also studied by Carminati and de Oliveira [58], as well as a variant in which priority boosting is replaced with non-preemptive execution of critical sections [58].
Yang et al. [214] proposed to exploit knowledge of each task's best-case execution time (BCET) to refine the blocking bounds for the MPCP under P-FP scheduling by obtaining a more realistic bound on the worst-possible contention possible at runtime.
In work primarily aimed at the task mapping problem (discussed in Section 11.1), Lakshmanan et al.  [123] as well as in later comparisons [35,47,48], it was observed that the "virtual spinning" variant of the MPCP performs poorly compared to both the regular MPCP (under s-aware analysis) and the partitioned and clustered OMLP variants, which are optimized for s-oblivious analysis [35,47,48].
A number of blocking analyses and integrated schedulability analyses of the MPCP have been proposed over the years [38,123,162,163], including analyses for arbitrary activation models based on arrival curves [148,176]. It should also be noted that over the years a number of misconceptions had to be corrected related to the critical instant [217], use of the period enforcer technique [164] to shape locking-induced self-suspensions [65], and the proper accounting of self-suspensions in response-time analyses [68]. These corrections should be consulted before reusing or extending existing analyses.
The most accurate and most extensible blocking analysis of the MPCP available today [38] models the blocking analysis problem as a linear program, which allows for the systematic avoidance of structural pessimism such as the repeated over-counting of long critical sections in blocking bounds [38] (as already discussed in Section 4.1). In particular, the LP-based approach allows for a much more accurate analysis of critical sections that contain self-suspensions (e.g., due to accesses to devices such as GPUs) by cleanly separating the time that a job holds a resource from the time that a job executes while being priority boosted [38]. Recently, Patel et al. [161] expressed very similar ideas using more conventional notation, but unfortunately did not compare their proposal with the earlier LP-based analysis of the MPCP [38].
A substantially different, early proposal for a predictable multiprocessor real-time locking protocolalmost as old as the MPCP, but known not nearly as well-is due to Zhou This allows the system to dynamically determine whether the specified maximum acceptable wait time can be exceeded, and to reject the request before any delay is actually incurred (in contrast to a regular timeout, which kicks in only after the maximal wait time has been exceeded). Such a mechanism of course comes with non-negligible runtime overheads and has some impact on system complexity. It has been absent from later proposals.

In work targeting P-EDF, Chen et al. developed the Multiprocessor Dynamic Priority Ceiling Protocol
(MDPCP) [64], which despite its name is quite different from the earlier MPCP. The MDPCP ensures progress by letting jobs holding global resources execute non-preemptively, and orders jobs in perresource wait queues by decreasing priority (i.e., increasing deadlines). Additionally, the MDPCP defines for each resource a current priority ceiling, which is defined "as the maximum priority of all jobs that are currently locking or will lock" the semaphore [64]. As a result, the MDPCP is fundamentally tied to the periodic task model, where the arrival times of future jobs are known a priori. In contrast, in a sporadic setting under P-EDF scheduling, it is impossible to precisely determine the set of jobs and their priorities that will lock a resource in the future.
The MDPCP includes a non-work-conserving rule akin to the uniprocessor PCP [179] that prevents jobs with insufficiently high priorities (i.e., insufficiently urgent deadlines) from acquiring resources that might still be needed by higher-priority jobs (i.e., jobs with earlier deadlines). More precisely, a job on processor P is allowed to lock a global resource only if its own priority exceeds (i.e., its deadline is earlier than) the maximum priority ceiling of any resource currently in use on any of the processors that P might conflict with, where two processors "might conflict with" each other if there exists some resource that is accessed by tasks on both processors [64]. This rule is required to avoid deadlock in the presence of nested requests, as will be discussed in Section 9. In an accompanying tech report [63], Chen and Tripathi further defined a second variant of the MDPCP based on priority boosting (rather than non-preemptive execution); this MDPCP version is also tied to the periodic task model. [33] (previously discussed in Section 5.1.3) was also applied to P-FP scheduling and analyzed in an s-aware manner [43]. Recall that the FMLP variant for long resources under partitioned scheduling relies on per-resource FIFO queues to resolve contention and on priority boosting to ensure lock-holder progress. While priority boosting is conceptually simple, a key detail is how to order simultaneously priority-boosted jobs (i.e., what to do if multiple tasks assigned to the same processor hold a resource at the same time). The original FMLP [33] pragmatically gives priority to whichever job acquired its resource first (which greedily minimizes the number of preemptions).

Block et al.'s partitioned FMLP
This choice, however, turned out to be problematic from a blocking-optimality point of view [35,45], and a refined version of the partitioned FMLP for long resources, called the partitioned FMLP + , was introduced [35].
Like its predecessor, the partitioned FMLP + uses per-resource FIFO queues to resolve contention and priority boosting to ensure lock-holder progress. However, it uses a subtly different tie-breaking rule: among priority-boosted jobs, the job with the first-issued (rather than the first-granted) lock request is given priority (i.e., priority-boosted jobs are scheduled in order of increasing lock-request times) [35]. To avoid preemptions in the middle of a critical section, the FMLP + optionally also supports non-preemptive critical sections [35].
In contrast to all prior semaphore protocols for partitioned multiprocessor scheduling, the partitioned FMLP + (with either preemptive and non-preemptive critical sections) ensures asymptotically optimal maximum s-aware pi-blocking [35]. Specifically, due to the use of FIFO queues and the FIFO-based priority-boosting order, the FMLP + ensures that a job is delayed by at most n − 1 = O(n) earlier-issued requests for any resource each time it executes a critical section (assuming preemptive critical sections).
Additionally, prior to a job's arrival or while it is suspended, lower-priority jobs may issue resource requests, which may be priority-boosted at a later time and thereby cause additional pi-blocking. Hence, whenever a job arrives or resumes from a self-suspension, there may be up to n − 1 = O(n) earlier-issued, incomplete requests that can cause additional pi-blocking. Assuming non-preemptive critical sections adds only a constant amount of additional blocking [35]. The FMLP + hence ensures maximum s-aware pi-blocking within a factor of roughly two of the known lower bound [35].
In addition to the optimality result, several fine-grained (i.e., non-asymptotic) s-aware blocking analyses of the FMLP + have been presented [35,38,41], with an LP-based analysis [38] again Overall, the FMLP + is simple, requires no configuration or a priori knowledge (such as priority ceilings), has been implemented in LITMUS RT [35], and shown to be practical [38]. In an empirical comparison with the MPCP, the two protocols were shown to be incomparable: the FMLP + outperforms the MPCP for many (but not all) workloads, and vice versa [38]. Patel et al. [161] observed similar trends in their comparison of the two protocols.
As in the global case (Section 5.2.2), it would be desirable to develop a hybrid protocol that integrates the advantages of the FIFO-based FMLP + [35] with optional prioritization as in the MPCP [162,163] for the most blocking-sensitive tasks [135]. Such a protocol could be easily analyzed by combining the existing LP-based analyses [38] of the MPCP and the FMLP + .
Targeting P-FP scheduling in the context of a somewhat different system model, Nemati et al. [156] considered the consolidation of legacy uniprocessor systems onto shared multicore platforms, where each core is used to host a mostly independent (uniprocessor) application consisting of multiple tasks.
Whereas intra-application synchronization needs can be resolved with existing uniprocessor protocols (as previously employed in the individual legacy systems), the move to a shared multicore platform can create new inter-application synchronization needs (e.g., due to shared platform resources in the underlying RTOS). To support such inter-application resource sharing, Nemati et al. [156] developed the Multiprocessors Synchronization Protocol for Real-Time Open Systems (MSOS) protocol [156], with the primary goal of ensuring that the temporal correctness of each application can be assessed without requiring insight into any other application (i.e., applications are assumed to be opaque and may be developed by independent teams or organizations). To this end, the MSOS protocol uses a twolevel, multi-tailed hybrid queue for each resource. Similar to the partitioned OMLP [45] (discussed in Section 5.1.3), contention for global (i.e., inter-application) resources is first resolved on each core, such that at most one job per core and resource can contend for global resources. Since the MSOS protocol resolves inter-application contention with FIFO queues, this design allows for the derivation of blocking bounds without knowledge of any application internals, provided the maximum per-application resource-hold time is known (for which Nemati et al. provide a bound [156]). The intra-application queues can be either FIFO or priority-ordered queues [156], and lock-holder progress is ensured via priority boosting as in the MPCP [162]. Subsequently, Chen et al. [68] corrected an oversight in the analysis of the MSOS protocol [156] related to the worst-case impact of self-suspensions.

Semi-Partitioned Scheduling
Semi-partitioned multiprocessor scheduling [20] is a hybrid variant of partitioned scheduling, where most tasks are assigned to a single processor each (as under partitioned scheduling) and a few migratory tasks receive allocations on two or more processors (i.e., their processor allocations are effectively split across processors). Semi-partitioned scheduling has been shown to be an effective and highly practical technique to circumvent bin-packing limitations without incurring the complexities and overheads of global or clustered scheduling [26,51]. From a synchronization point of view, however, semi-partitioned scheduling has not yet received much attention.
A notable exception is Afshar et al.'s work [3] on semaphore protocols for semi-partitioned fixed-priority (SP-FP) scheduling. Since known techniques for partitioned scheduling are readily applicable to nonmigratory tasks, the novel challenge that must be addressed when targeting semi-partitioned systems is migratory tasks. To this end, Afshar et al. [3] proposed two protocol variants, both using priority-ordered wait queues and priority boosting.

In the first protocol variant, the Migration-based Locking Protocol under Semi-Partitioned Scheduling
(MLPS) [3], each task is assigned a marked processor on which it must execute all its critical sections.
This approach simplifies the problem, as it ensures that all of a task's critical sections are executed on a statically known processor, which reduces the analysis problem to the partitioned case. However, it also introduces additional task migrations, as a migratory task that currently resides on the "wrong" (i.e., non-marked) processor must first migrate to its marked processor before it can enter a critical section, and then back again to its non-marked processor when it releases the lock.

As an alternative, Afshar et al.'s Non-Migration-Based Locking Protocol under Semi-Partitioned Scheduling
(NMLPS) [3] lets migratory tasks execute their critical sections on their current processor (i.e., on whichever processor they happen to be executing at the time of lock acquisition). This avoids any superfluous migrations, but causes greater analysis uncertainty as it is now unclear on which processor a critical section will be executed.
Additional complications arise when a resource-holding migratory task should, according to the semipartitioning policy, be migrated in the middle of a critical section. At this point, there are two choices: either let the task finish its critical section before enacting the migration, which may cause it to overrun its local budget, or instead preempt the execution of the critical section, which causes extra delays and makes the analysis considerably more pessimistic. Afshar et al. [3] chose the former approach in the NMLPS, which means that budget overruns up to the length of one critical section must be accounted for in all but the last segments of migratory tasks.

Clustered Scheduling
Like the semi-partitioned case, the topic of s-aware semaphore protocols for clustered scheduling has not received much attention to date. The primary works are an extension of Nemati et al.'s MSOS protocol [156], called the clustered MSOS (C-MSOS) protocol [151], and the generalized FMLP + [41], which establishes asymptotic tightness of the known lower bound on s-aware pi-blocking (recall Section 5.2.1).
Under the C-MSOS, legacy applications are allowed to span multiple cores (i.e., there is one application per cluster). Local (i.e., intra-application) resources are managed using the PIP [77,179] (as discussed in Section 5.2.2). Global (i.e., inter-application) resources are managed using a two-stage queue as in the MSOS protocol [156]. However, in the C-MSOS protocol, each resource's global queue can be either a FIFO queue (as in the MSOS protocol [156]) or a round-robin queue. As before, the per-application queues can be either FIFO or priority queues, and lock-holder progress is ensured via priority boosting (which prevents asymptotic optimality w.r.t. maximum s-aware pi-blocking under global and clustered scheduling [35,41]).
The generalized FMLP + [41] was designed specifically to close the "s-aware optimality gap" [35], i.e., to provide a matching upper bound of O(n) s-aware pi-blocking under clustered (and hence also global) scheduling, thereby establishing the known Ω(n) lower bound [35,46] to be asymptotically tight [41]. The name derives from the fact that the generalized FMLP + produces the same schedule as the partitioned FMLP + when applied to partitioned scheduling [41]. However, despite this lineage, in terms of protocol rules, the generalized FMLP + [41] differs substantially from the (much simpler) partitioned FMLP + [35].
The generalized FMLP + [41] resolves contention with simple per-resource FIFO queues, as in the prior FMLP [33] and the partitioned FMLP + [35]. The key challenge is to ensure lock-holder progress, since neither priority inheritance nor (unrestricted) priority boosting can yield asymptotically optimal s-aware pi-blocking bounds under global and clustered scheduling [35,41]. Intuitively, the main problem is that raising the priority of a lock holder (via either inheritance or boosting) can cause other, unrelated higher-priority jobs to be preempted. Furthermore, in pathological cases, it can cause the same job to be repeatedly preempted, which gives rise to asymptotically non-optimal s-aware pi-blocking [35,41]. The generalized FMLP + overcomes this effect by employing a progress mechanism tailored to the problem, called restricted segment boosting (RSB) [41]. Under the RSB rules, in each cluster, only the (single) job with the earliest-issued request benefits from priority boosting (with any ties in request-issue time broken arbitrarily). In addition to this single boosted lock holder, certain non-lock-holding jobs are co-boosted, specifically to prevent repeated preemptions in the pathological scenarios that cause the non-optimality of priority inheritance and priority boosting [35,41].
Based on RSB, the generalized FMLP + ensures asymptotically optimal s-aware pi-blocking under clustered scheduling [41], and hence also under global scheduling, which closes the s-aware optimality gap [35].
However, in an empirical comparison under global scheduling [215], the generalized FMLP + performed generally worse than protocols specifically designed for global scheduling, which indicates that the generalized FMLP + [41] is primarily of interest from a blocking optimality point of view. In contrast, the simpler partitioned FMLP + [35], which is designed specifically for partitioned scheduling and hence avoids the complexities resulting from clustered and global scheduling, is known to perform empirically very well and to be practical [38].

Centralized Execution of Critical Sections
In the preceding two sections, we have considered protocols for in-place execution of critical sections, where jobs directly access shared resources. Under in-place protocols, the critical sections pertaining to each (global) resource are spread across multiple processors (i.e., wherever the tasks that share the resource happen to be executing). For spin locks (Section 4), this is the natural choice. In the case of semaphores, however, this is not the only possibility, nor is it necessarily the best. Instead, as discussed in Section 2.2.5, it is also possible to centralize the execution of all critical sections onto a designated processor, the synchronization processor of the resource. In fact, the very first multiprocessor real-time semaphore protocol, namely the DPCP [165], followed exactly this approach.
Protocols that call for the centralized execution of critical sections are also called distributed multiprocessor real-time locking protocols, because the centralized approach does not necessarily require shared memory (as opposed to the in-place execution of critical sections, which typically relies on cache-consistent shared memory). From a systems point of view, there are three ways to interpret such protocols. In the following discussion, let a job's application processor be the processor on which it carries out its regular execution (i.e., where it executes its non-critical sections).
In the first interpretation, which is consistent with a distributed-systems perspective, each critical section of a task is seen as a synchronous remote procedure call (RPC) to a resource server executing on the synchronization processor. The resource server, which may be multi-threaded, is in charge of serializing concurrent RPC calls. A job that issues an RPC to the synchronization processor self-suspends after sending the RPC request and resumes again when the resource server's response is received by the application processor. The job's self-suspension duration thus includes both the time required to service its own request plus any delays due to contention for the resource (i.e., blocking due to earlier-serviced requests). Additionally, in a real system, any communication overheads contribute to a job's self-suspension time (e.g., transmission delays if the RPC request is communicated over a shared interconnect, argument marshalling and unmarshalling costs, etc.).
In the second interpretation, which is typically adopted in a shared-memory context, jobs are considered to migrate from the application processor to the synchronization processor when they attempt to lock a shared resource, and to migrate back to their application processor when unlocking the resource. All resource contention is hence reduced to a uniprocessor locking problem. However, from a schedulability analysis point of view, the time that the job resides on the synchronization processor still constitutes a self-suspension w.r.t. to the analysis of the application processor.
Finally, the third interpretation, which is appropriate for both shared-memory and distributed systems, is to see each job as a sequence (i.e., as a linear DAG) of subjobs with precedence constraints and an end-to-end deadline [189], where different subjobs are spread out across multiple processors. In this view, the synchronization problem is again reduced to a uniprocessor problem. The end-to-end analysis, however, must deal with the fact that each DAG visits the application processor multiple times, which can give rise to pessimism in the analysis.
From an analytical point of view-i.e., for the purpose of schedulability and blocking analysis-the first two interpretations are equivalent, that is, identical analysis problems must be solved and, ignoring overheads, identical bounds are obtained, regardless of how the protocol is actually implemented. The third approach provides some additional flexibility [189,195] and has recently been exploited to enable modern analyses and heuristics [70,76,114,115,198].

Advantages and Disadvantages
Multiprocessor real-time locking protocols that centralize the execution of critical sections offer a number of unique advantages. For one, they can be easily applied to heterogenous multiprocessor platforms, where certain critical sections may be inherently restricted to specific cores (e.g., compute kernels can run only on GPUs, high-performance signal processing may need to take place on a DSP, low-power cores may lack floating-point support, etc.). Similarly, if certain shared devices are accessible only from specific processors (e.g., if there is a dedicated I/O processor), then those processors naturally become synchronization processors for critical sections pertaining to such devices. Furthermore, centralizing all critical sections is also attractive in non-cache-coherent systems, since it avoids the need to keep a shared resource's state consistent across multiple local memories. In fact, even in cache-coherent shared-memory systems it can be beneficial to centralize the execution of critical sections to avoid cache-line bouncing [136]. And last but not least, from a real-time perspective, the centralized approach allows for the reuse of well-established uniprocessor protocols, which for some workloads can translate into significant schedulability improvements over in-place approaches [38].
Centralized protocols, however, also come with a major downside. Whereas schedulability and blocking analysis is typically concerned with worst-case scenarios, many systems also require excellent averagecase performance, and this is where in-place execution of critical sections has a major advantage.
In well-designed systems, resource contention is usually rare, which means that uncontested lock acquisitions are the common case that determines average-case performance. In a semaphore protocol based on in-place execution, uncontested lock acquisitions do not cause self-suspensions and can be optimized to incur very low acquisition and release overheads (see "futexes," discussed in Section 10.2).
In contrast, in protocols based on the centralized approach, every remote critical section necessarily involves a self-suspension regardless of whether the shared resource is actually under contention, which is likely to have a significant negative impact on average-case performance.

Centralized Protocols
The original protocol for the centralized execution of critical sections, and in fact the first multiprocessor real-time locking protocol altogether, is the Distributed Priority Ceiling Protocol (DPCP) [163,165].
Unfortunately, there is some confusion regarding the proper name of the DPCP. The protocol was originally introduced as the "Multiprocessor Priority Ceiling Protocol" and abbreviated as "MPCP" [165], but then renamed to "Distributed Priority Ceiling Protocol," properly abbreviated as "DPCP," shortly thereafter [163]. To make matters worse, the shared-memory protocol now known as the MPCP (discussed in Section 5.2.3) was introduced in the meantime [162]. However, for some time, the authors of several subsequent works remained unaware of the name change, and hence a number of later publications, including a popular textbook on real-time systems [132], refer to the DPCP [165] by the name "MPCP." We follow the modern terminology [163] and denote by "DPCP" the original protocol [165], which is based on the centralized execution of critical sections, and reserve the abbreviation "MPCP" to refer to the later shared-memory protocol [162], which is based on the in-place execution of critical sections (as discussed in Section 5.2.3).
The DPCP has been designed for P-FP scheduling. As the name suggests, the DPCP relies on the classic PCP [179] to arbitrate conflicting requests on each synchronization processor. To ensure resource-holder progress, that is, to prevent lock-holding jobs from being preempted by non-lock-holding jobs if the sets of synchronization and application processors are not disjoint, the DPCP relies on priority boosting. As a result of reusing the uniprocessor PCP, the DPCP effectively uses a priority-ordered wait queue (i.e., conflicting requests from two remote jobs are served in order of their regular scheduling priorities).
This simple design has proven to be highly effective and practical even in modern systems [38].
A number of s-aware blocking analyses of the DPCP have been presented in the literature [38,115,163,165], with an LP-based approach [38] yielding the most accurate bounds. Recent works [65,217] documented some misconceptions in the original analyses [163,165]. conflicting lock requests are served in FIFO order, lock-holding jobs are (unconditionally) priority-boosted, and jobs that are priority-boosted simultaneously on the same synchronization processor are scheduled in order of their lock requests (i.e., the tie-breaking rule favors earlier-issued requests).

Ras and Cheng
Blocking under the DFLP has been analyzed using an s-aware, LP-based approach [38]. In an empirical comparison under P-FP scheduling based on an implementation in LITMUS RT [38], the DFLP and DPCP were observed to be incomparable: the DFLP performs better than the DPCP for many (but not all) workloads, and vice versa. Similarly, both protocols were also observed to each be incomparable with their in-place counterparts (i.e., the partitioned FMLP + [35] and the MPCP [162], respectively).
In contrast to the DPCP, which is defined only for P-FP scheduling, the DFLP can also be combined with P-EDF or clustered scheduling [40].

Blocking Optimality
Centralized locking protocols have also been studied from the point of view of blocking optimality [35,45], and asymptotically tight bounds on maximum pi-blocking have been obtained for both the saware and s-oblivious cases [40]. Interestingly, the way in which resources and tasks are assigned to synchronization and application processors, respectively, plays a major role. If some tasks and resources are co-hosted, that is, if the sets of synchronization and application processors are not disjoint, then maximum pi-blocking is asymptotically worse than in the shared-memory case: a lower bound of Ω(Φ × n) maximum pi-blocking has been established [40], where Φ denotes the ratio of the maximum response time and the minimum period of any task. Notably, this bound holds under both s-aware and s-oblivious analysis due to the existence of pathological corner cases in which jobs are repeatedly preempted [40]. Both the DPCP [163,165] and the DFLP [38,40] ensure O(Φ × n) maximum s-aware pi-blocking, and are hence asymptotically optimal in the case with co-hosted tasks and resources [40].
In contrast, if the sets of synchronization and application processors are disjoint (i.e., if no processor serves both regular tasks and critical sections), then the same lower bounds as in the case of in-place critical sections apply [40]: Ω(n) under s-aware analysis, and Ω(m) under s-oblivious analysis.
The DFLP [38,40] ensures O(n) maximum s-aware pi-blocking in the disjoint case under clustered (and hence also partitioned) scheduling, and is thus asymptotically optimal under s-aware analysis [40].

Asymptotic tightness of the Ω(m) bound on maximum s-oblivious pi-blocking was established with the
Distributed OMLP (D-OMLP) [40], which was obtained by transfering techniques introduced with the OMLP family for in-place critical sections to the centralized setting.

Independence Preservation: Avoiding the Blocking of Higher-Priority Tasks
All locking protocols discussed so far use either priority inheritance, non-preemptive sections, unconditional priority boosting, or a restricted variant of the latter (such as priority donation or RSB). Of these, priority inheritance has a unique and particularly attractive property: independent higher-priority jobs are not affected by the synchronization behavior of lower-priority jobs.
For example, consider three tasks τ 1 , τ 2 , and τ 3 under uniprocessor fixed-priority scheduling, and suppose that τ 2 and τ 3 share a resource 1 that the higher-priority task τ 1 does not require. If the tasks follow a protocol based on priority inheritance, then the response time of τ 1 is completely independent of the lengths of the critical sections of τ 2 and τ 3 , which is obviously desirable. In contrast, if τ 2 and τ 3 synchronize by means of non-preemptive critical sections, then τ 1 's response time, and ultimately its temporal correctness, depends on the critical section lengths of lower-priority tasks. In other words, the use of non-preemptive sections induces a temporal dependency among logically independent tasks.
Unfortunately, priority boosting, priority donation, and RSB similarly induce temporal dependencies when they force the execution of lock-holding lower-priority jobs. Since on multiprocessors priority inheritance is effective only under global scheduling (recall Section 3.4), this poses a significant problem for multiprocessor real-time systems that do not use global scheduling (of which there are many in practice). In response, a number of multiprocessor real-time locking protocols have been proposed that avoid introducing temporal dependencies in logically unrelated jobs. We use the term independence preservation [36,37,39] to generally refer to the desired isolation property and this class of protocols.

Use Cases
Independence preservation is an important property in practice, but to date it has received relatively little attention compared to the classic spin and semaphore protocols discussed in Sections 4-6. To highlight the concept's significance, we briefly sketch four contexts in which independence preservation is essential.
First, consider multi-rate systems with a wide range of activation frequencies [37]. For instance, in automotive systems, it is not uncommon to find tasks periods ranging from as low as 1 ms to as high as 1,000 ms or more [122]. Now, if a 1,000 ms task has a utilization of only 10%, and if each job spends only 1% of its execution time in a critical section, then a single such critical section is already long enough (1 ms) to render any 1 ms task on the same core infeasible. This shows the importance of independence preservation in the face of highly heterogeneous timing requirements.
As a second example, consider an infrequently triggered sporadic event handler that must react within, say, 100 µs (e.g., a critical interrupt handler with a tight latency constraint). Now assume the system is deployed on an eight-core platform and consider a shared-memory object accessed by all cores (e.g., an OS data structure) that is protected with a non-preemptive FIFO spin lock (e.g., as used in the MSRP [90], recall Section 4.1). Even if each critical section is only at most 20 µs long, when accounting for the transitive impact of spin delay, the worst-case latency on every core is at least 160 µs, which renders the latency-sensitive interrupt handler infeasible. Generally speaking, if job release latency is a concern, then non-independence-preserving synchronization methods must be avoided. Case in point: the PREEMPT_RT real-time patch for the Linux kernel converts most non-preemptive spin locks in the kernel to suspension-based mutexes for precisely this reason. In other words, none of the protocols discussed in Sections 4-6 based on priority boosting or non-preemptive execution is appropriate for general use in the Linux kernel. Takada and Sakamura highlighted the negative impact of delays due to real-time synchronization on interrupt latency as a major problem in multiprocessor RTOS kernels already more than 20 years ago [190,191,192,193,194].
Third, consider open systems, where at design time it is not (fully) known which applications will be deployed and composed at runtime. Non-preemptive sections and priority boosting are inappropriate for such systems, because the pi-blocking that they induce is a global property, in the sense that it affects all applications, and because the maximum critical section length in newly added applications is not always known. Independence preservation ensures temporal isolation among independent applications, which greatly simplifies the online admission and composition problem. Faggioli et al. argue this point in detail [84,85].
As a fourth and final example, independence preservation is also important in the context of mixedcriticality systems [54], where it is highly desirable to avoid any dependencies from critical on non-critical components. Specifically, if the temporal correctness of a highly critical task depends on the maximum critical section length in a lower-criticality task, then there exists an implicit trust relationship: the temporal correctness of higher-criticality tasks is guaranteed only as long as the lower-criticality task does not violate the worst-case timing behavior assumed in the analysis of higher-criticality tasks.
Independence preservation can help to avoid such dependencies, which violate the freedom-frominterference principle at the heart of mixed-criticality systems [54]. A detailed argument along these lines has been presented in prior work [39].

Fully Preemptive Locking Protocols for Partitioned and Clustered Scheduling
Since priority inheritance ensures independence preservation under global scheduling, we focus on partitioned and clustered scheduling (and in-place critical sections).
Recall from Section 3 that the fundamental challenge under partitioned scheduling can be described as follows: a lock-holding task τ l on processor P 1 is preempted by a higher-priority task τ h while τ l blocks a remote task τ b located on processor P 2 . There are fundamentally only three choices: 1. priority-boost τ l to expedite the completion of its critical section, in which case τ h is delayed; 2. do nothing and accept that τ b 's blocking bound depends on τ h 's execution cost; or 3. use processor time originally allocated to τ b on processor P 2 to finish τ l 's critical section: allocation inheritance, as discussed in Section 3.5.
Option (1) violates independence preservation, option (2) results in potentially "unbounded" pi-blocking, and hence all protocols considered in this section rely on option (3).
Allocation inheritance can be combined with both spin-and suspension-based waiting. In both cases, the key property is that lock-holding tasks remain fully preemptable at all times, and that they continue to execute with their regular (i.e., non-boosted priorities), which ensures the desired independencepreservation property.
Hohmuth and Peter [104] were the first to describe an independence-preserving multiprocessor real-time synchronization protocol, which they realized in the Fiasco L4 microkernel under the name local helping.
Given that microkernels in the L4 family rely exclusively on IPC, the shared resource under contention is in fact a single-threaded resource server that synchronously responds to invocations from client tasks, thereby implicitly sequencing concurrent requests (i.e., the execution of the server's response handler forms the "critical section").
Hohmuth and Peter's solution [104] is based on earlier work by Hohmuth and Härtig [103], who described an elegant way to realize temporally predictable resource servers on uniprocessors that is analytically equivalent to the better-known (uniprocessor) Bandwidth Inheritance (BWI) protocol [124] (which was independently proposed in the same year). Specifically, Hohmuth and Härtig proposed a mechanism that they termed helping:whenever a blocked client (i.e., a client thread that seeks to rendezvous with a server thread that is not waiting to accept a synchronous IPC message) is selected by the scheduler, the server process is dispatched instead [103] (see also time-slice donation [185]). 6 Hohmuth and Peter extended Hohmuth and Härtig's helping approach to multiprocessors (under P-FP scheduling) and systematically considered key design choices and challenges. Specifically, with local helping, 7 a preempted resource server is migrated (i.e., pulled) to the core of the blocked client, at which point the uniprocessor helping mechanism [103] can be applied-an instance of the allocation inheritance principle (Section 3.5). However, two interesting challenges arise: 1. What should blocked clients do when the resource server is already executing on a remote core?
2. How does a blocked client learn that the resource server was preempted on a remote core?
Hohmuth and Peter considered two fundamental approaches. In the first approach, which they termed polling [103], the blocked client simply executes a loop checking whether the resource server has become available for dispatching (i.e., whether it has been preempted), which addresses both questions. This polling approach is equivalent to preemptable spinning (i.e., it is conceptually a busy-wait loop that happens to spin on the process state of the server process), with the typical advantage of avoiding self-suspensions and the typical disadvantage of potentially wasting many processor cycles.
As an alternative, Hohmuth and Peter considered a sleep and callback [104] approach, where the blocked client registers its willingness to help in a data structure and then self-suspends. When the server process is preempted, the register of potential helpers is consulted and one or more blocked clients are woken up by triggering their callback functions, which requires sending inter-processor interrupts (IPIs) to the cores on which they are hosted. The sleep and callback approach is equivalent to self-suspending clients, which comes with the typical advantage that blocked clients yield the processor to lower-priority tasks, but which also introduces the typical analytical challenges and overhead issues. Since Hohmuth and Peter expected critical sections (i.e., server request handlers) in their system to be quite short, and due 6 Hohmuth and Härtig's helping mechanism [103] is named in analogy to the "helping" employed in wait-free algorithms [102], but fundamentally a different mechanism. "Helping" in wait-free algorithms does not rely on any support by the OS [102]; rather, it is realized exclusively with a processor's atomic operations (such as an atomic compare-and-swap instruction). 7 Hohmuth and Peter also describe a variant called remote helping where a blocked client migrates to the core assigned to the server [104], which however is not an attractive solution from an analytical point of view and thus not further considered here.
to implementation challenges associated with the sleep and callback approach, Hohmuth and Peter chose the polling approach in their implementation [104].
Given that synchronous IPC (with single-threaded processes) and mutual exclusion are duals of each other, Hohmuth and Peter's work [104] directly applies to the multiprocessor real-time locking problem, and in fact their combination of local helping and synchronous IPC can be considered a multiprocessor real-time locking protocol that combines priority-ordered wait queues with allocation inheritance under P-FP scheduling.
Not long after Hohmuth and Peter [103], Holman and Anderson [107,109,110] proposed the use of allocation inheritance to realize a predictable suspension-based locking protocol for Pfair scheduling [25,184]. While Pfair is a global scheduler, it is not compatible with priority inheritance due to its sophisticated scheduling rules and more nuanced notion of "priority." Holman and Anderson hence proposed allocation inheritance as a generalization of the priority-inheritance principle that neither assumes priority-driven scheduling nor requires a priority concept. As already mentioned in Section 3.5, Holman and Anderson coined the term "allocation inheritance," which we have adopted in this survey to refer to the general idea of dynamically re-purposing processor-time allocations to ensure lock-holder progress. Holman and Anderson further considered two alternatives to allocation inheritance named rate inheritance and weight inheritance [107,109,110], which are both specific to Pfair scheduling and not further considered herein.
Faggioli et al. observed that, since the allocation inheritance principle is not specific to any particular scheduling algorithm, the MBWI protocol can be employed without any modifications or adaptations under partitioned, global, or clustered scheduling [84,85]. In fact, it can even be used in unchanged form under semi-partitioned scheduling or in the presence of tasks with arbitrary processor affinities (APAs) [95,96].
Like Hohmuth and Peter [104], Faggioli et al. chose to follow the polling approach in their implementation of the MBWI protocol in LITMUS RT [85]. As an interesting practical tweak, in Faggioli et al.'s implementation, polling jobs detect when the lock-holding job self-suspends (e.g., due to I/O) and then self-suspend as well, to prevent wasting large amounts of processor time when synchronizing access to resources that induce self-suspensions within critical sections (e.g., such as GPUs) [84,85]. Nonetheless, the MBWI protocol is fundamentally a spin-based protocol [84,85].
In work targeting Linux with the PREEMPT_RT patch, Brandenburg and Bastoni [50] proposed to replace Linux's implementation of priority inheritance with allocation inheritance (which they referred to as migratory priority inheritance [50]) because priority inheritance is ineffective in the presence of tasks with disjoint APAs, which Linux supports [95,96].
The O(m) Independence-preserving Protocol (OMIP) [36,37] for clustered scheduling is the only protocol based on allocation inheritance that achieves asymptotic blocking optimality under s-oblivious analysis.
Recall that the only other protocol for clustered scheduling that is asymptotically optimal w.r.t. maximum s-oblivious pi-blocking is the clustered OMLP [35,47,48], which relies on priority donation, a restricted variant of priority boosting, and which hence is not independence preserving. The OMIP improves upon the clustered OMLP by replacing priority donation with allocation inheritance, which ensures that lock-holding tasks remain preemptable at all times. As a result of this change in progress mechanism, the OMIP requires a multi-stage hybrid queue [36,37] similar to the one used in the global OMLP [45], in contrast to the simple FIFO queues used in the clustered OMLP [47]. In fact, in the special case of global scheduling, the OMIP reduces to the global OMLP, and hence can be understood as a generalization of the global OMLP [36,37]. This also underscores that allocation inheritance is a generalization of priority inheritance (Section 3.5).
The OMIP, which has been prototyped in LITMUS RT [37], is suspension-based and hence requires the implementation to follow a sleep and callback approach [104]. However, because the available blocking analysis is s-oblivious [37], which already accounts for suspension times as processor demand Exploiting this property, as well as a close correspondence between s-oblivious analysis and certain processor reservation techniques, the OMIP has been used to derive a locking protocol for Virtually Exclusive Resources (VXR) [36] and a synchronous Mixed-Criticality IPC (MC-IPC) protocol [39]. The VXR and MC-IPC protocols exhibit three key features that aid system integration in a mixed-criticality context: 1. the number of tasks sharing a given resource need not be known for analysis purposes and no trust is implied, 2. different maximum critical section lengths may be assumed in the analysis of high-and lowcriticality tasks, and 3. even non-real-time, best-effort background tasks may access shared resources in a mutually exclusive way without endangering the temporal correctness of high-criticality tasks [39].
Concurrently to the OMIP [37], Burns and Wellings [56] proposed the Multiprocessor Resource Sharing Protocol (MrsP) for P-FP scheduling. MrsP combines allocation inheritance with FIFO-ordered spin locks and local per-processor (i.e., uniprocessor) priority ceilings. Specifically, each global resource is protected with a FIFO-ordered spin lock as in the MSRP [90] (recall Section 4.1), but jobs remain fully preemptable while spinning or holding a resource's spin lock, which ensures independence preservation.
To ensure progress locally, each resource is further managed, independently and concurrently on each processor, with a local priority ceiling protocol (either the PCP [179] or SRP [23]). From the point of view of the local ceiling protocol, the entire request for a global resource, including the spin-lock acquisition and any spinning, is considered to constitute a single "critical section," which is similar to the use of contention tokens in the partitioned OMLP [45]. Naturally, when determining a resource's local, per-processor priority ceiling, only local tasks that access the resource are considered.
MrsP employs allocation inheritance to ensure progress across processors. Instead of literally spinning, waiting jobs may thus be replaced transparently with the lock holder, or otherwise contribute towards completing the operation of the lock-holding job (as in the SPEPP protocol [194]), which means that an implementation of the MrsP can follow the simpler polling approach [104]. [56] motivate the design of the MrsP with the observation that blocking bounds for the MrsP can be stated in a way that is syntactically virtually identical with the classic uniprocessor response-time analysis equation for the PCP and SRP. For this reason, Burns and Wellings consider the MrsP to be particularly "schedulability compatible," and note that the MrsP is the first protocol to achieve this notion of compatibility.

Burns and Wellings
While this is true in a narrow, syntactical sense, it should also be noted that every other locking protocol discussed in this survey is also "schedulability compatible" in the sense that the maximum blocking delay can be bounded a priori and incorporated into a response-time analysis. Furthermore, the "schedulability compatible" blocking analysis of the MrsP presented by Burns and Wellings [56] is structurally similar to Gai et al.'s original analysis of the MSRP [90] and relies on execution-time inflation (which is inherently pessimistic [209], recall Section 4.1). More modern blocking analysis approaches avoid execution-time inflation altogether [209] and have a more detailed model of contention (e.g., holistic blocking analyses [35,161] or LP-based analyses [38,209]  is not "schedulability compatible" according to Burns and Wellings's syntactic criterion [56], Zhao et al.'s analysis has been shown [220] to be much less pessimistic than Burns and Wellings's original inflation-based but "schedulability compatible" analysis [56].
In the preceding sections, we have focused exclusively on protocols that ensure mutual exclusion.
However, while mutual exclusion is without a doubt the most important and most widely used constraint in practice, many systems also exhibit resource-sharing problems that call for relaxed exclusion to allow for some degree of concurrency in resource use. The two relaxed exclusion constraints that have received most attention in prior work are reader-writer (RW) exclusion and k-exclusion (KX).
RW synchronization is a classic synchronization problem [71] wherein a shared resource may be used either exclusively by a single writer (which may update the resource's state) or in a shared manner by any number of readers (that do not affect the resource's state). RW synchronization is appropriate for shared resources that are rarely updated and frequently queried. For instance, an in-memory data store holding sensor values, route information, mission objectives, etc. that is used by many subsystems and updated by few is a prime candidate for RW synchronization. Similarly, at a lower level, the list of topic subscribers in a publish/subscribe middleware is another example of rarely changing, frequently queried data that must be properly synchronized.
KX synchronization is a generalization of mutual exclusion to replicated shared resources, where there are multiple identical, inter-changeable copies (or replicas) of a shared resource. Replicated resources can be managed with counting semaphores, but require special handling in multiprocessor real-time systems to ensure analytically sound pi-blocking bounds. Examples where a need for KX synchronization arises in real-time systems include multi-GPU systems (where any task may use any GPU, but each GPU must be used by at most one task at a time) [81], systems with multiple DMA engines (where again any task may program any DMA engine, but each DMA engine can carry out only one transfer at a time), and also virtual resources such as cache partitions [205].
Since both RW and KX synchronization generalize mutual exclusion, any of the locking protocols discussed in the previous sections may be used to solve RW or KX synchronization problems. This, however, would be needlessly inefficient. The goal of locking protocols designed specifically for RW and KX synchronization is thus both (i) to increase parallelism (i.e., avoid unnecessary blocking) and (ii) to reflect this increase in parallelism as improved worst-case blocking bounds. Goal (ii) sets real-time RW and KX synchronization apart from classic (non-real-time) RW and KX solutions, since in a best-effort context it is sufficient to achieve a decrease in blocking on average.
We acknowledge that there is a large body of prior work on relaxed exclusion protocols for non-real-time and uniprocessor systems, a discussion of which is beyond the scope of this survey, and in the following focus exclusively on work targeting multiprocessor real-time systems.

Phase-Fair Reader-Writer Locks
The first multiprocessor real-time RW protocol achieving both goals (i) and (ii) was proposed by Brandenburg and Anderson [44]. Prior work on RW synchronization for uniprocessors or generalpurpose multiprocessor systems had yielded three general classes of RW locks: 1. reader-preference locks, where pending writers gain access to a shared resource only if there are no pending read requests; 2. conversely writer-preference locks; and 3. task-fair locks (or FIFO RW locks), where tasks gain access to the shared resource in strict FIFO order, but consecutive readers may enter their critical sections concurrently.
From a worst-case perspective, reader-preference locks are undesirable because reads are expected to be frequent, which gives rise to prolonged writer starvation, which in turn manifests as extremely pessimistic blocking bounds [46]. Writer-preference locks are better suited to real-time systems, but come with the downside that, if there are potentially multiple concurrent writers, the worst-case blocking bound for each reader will pessimistically account for rare corner-case scenarios in which a reader is blocked by multiple consecutive writers. Finally, task-fair locks degenerate to regular mutex locks in the pathological case when readers and writers are interleaved in the queue; consequently, task-fair locks improve average-case parallelism, but their worst-case bounds do not reflect the desired gain in parallelism.
Brandenburg and Anderson introduced phase-fair locks [44,46], a new category of RW locks better suited to worst-case analysis. In a phase-fair lock, reader and writer phases alternate, where each reader phase consists of any number of concurrent readers, and a writer phase consists of a single writer.
Writers gain access to the shared resource in FIFO order w.r.t. other writers. Importantly, readers may join an ongoing reader phase only if there is no waiting writer; otherwise newly arriving readers must wait until the next reader phase, which starts after the next writer phase.
These rules ensure that writers do not starve (as in a writer-preference or task-fair lock), but also ensure O(1) blocking for readers as any reader must await the completion of at most one reader phase and one writer phase before gaining access to the shared resource [44,46]. As a result, phase-fair locks yield much improved blocking bounds for both readers and writers if reads are significantly more frequent than updates [44,46].

Multiprocessor Real-Time k-Exclusion Protocols
As already mentioned, in best-effort systems, KX synchronization can be readily achieved with counting semaphores. Furthermore, in the case of non-preemptive spin locks, classic ticket locks can be trivially generalized to KX locks. We hence focus in the following on semaphore-based protocols for multiprocessor real-time systems.
Given the strong progress guarantees offered by priority donation (discussed in Section 5.1.4), it is not difficult to generalize the clustered OMLP to KX synchronization [35,47,48], which yields a protocol that is often abbreviated as CK-OMLP in the literature. Since it derives from the clustered OMLP, the CK-OMLP applies to clustered scheduling, and hence also supports global and partitioned scheduling. Furthermore, under s-oblivious analysis, it ensures asymptotically optimal maximum pi-blocking [35,47,48]. As such, it covers a broad range of configurations. However, as it relies on priority donation to ensure progress, it is not independence-preserving (recall Section 7), which can be a significant limitation especially when dealing with resources such as GPUs, where critical sections are often naturally quite long. Subsequent protocols were specifically designed to overcome this limitation of the CK-OMLP.

Elliott and Anderson considered globally scheduled multiprocessors and proposed the Optimal k-Exclusion
Global Locking Protocol (O-KGLP) [80,83]. In contrast to the CK-OMLP, their protocol is based on priority inheritance, which is possible due to the restriction to global scheduling, and which enables the O-KGLP to be independence-preserving.
In the context of KX synchronization, applying priority inheritance is not as straightforward as in the mutual exclusion case because priorities must not be "duplicated". That is, while there may be multiple resource holders (if k > 1), only at most one of them may inherit a blocked job's priority at any time, as otherwise analytical complications similar to those caused by priority boosting arise (including the loss of independence preservation). The challenge is thus to determine, dynamically at runtime and with low overheads, which resource-holding job should inherit which blocked job's priority.
To this end, Elliott and Anderson [80,83] proposed a multi-ended hybrid queue consisting of a shared priority queue that forms the tail (as in the global OMLP [45]) and a set of per-replica FIFO queues (each of length m k ) that serve to serialize access to specific replicas. A job J i holding a replica x q inherits the priorities of the jobs in the FIFO queue corresponding to the x th replica of resource q , and additionally the priority of one of the k highest-priority jobs in the priority tail queue. Importantly, if J i inherits the priority of a job J h in the priority tail queue, then J h is called the claimed job of x q and moved to the FIFO queue leading to x q when J i releases x q . This mechanism ensures that priorities are not "duplicated" while also ensuring progress. In fact, Elliott and Anderson established that the O-KGLP is asymptotically optimal w.r.t. s-oblivious maximum pi-blocking [80,83].
In work on predictable interrupt management in multi-GPU systems [82], Elliott and Anderson further proposed a KX variant of the FMLP (for long resources) [33]. This variant, called k-FMLP, simply consists of one instantiation of the FMLP for each resource replica (i.e., each resource replica is associated with a replica-private FIFO queue that does not interact with other queues). When jobs request access to a replica of a k-replicated resource, they simply enqueue in the FIFO queue of the replica that ensures the minimal worst-case wait time (based on the currently enqueued requests). While the k-FMLP is not asymptotically optimal under s-oblivious analysis (unlike the O-KGLP and the CK-OMLP), it offers the advantage of being relatively simple to realize [82] while also ensuring independence preservation under global scheduling (unlike the CK-OMLP).
Ward et al. [204] realized that blocking under the O-KGLP [80,83] could be further improved with a more nuanced progress mechanism, which they called Replica-Request Priority Donation (RRPD) [204], and proposed the Replica-Request Donation Global Locking Protocol (R 2 DGLP) based on RRPD [204]. As the name suggests, RRPD transfers the ideas underlying priority donation [35,47,48] to the case of priority inheritance under global scheduling. Importantly, whereas priority donation applies to all jobs (regardless of whether they request any shared resource), RRPD applies only to jobs that synchronize (i.e., that actually request resource replicas). This ensures that RRPD is independence-preserving (in contrast to priority donation); however, because RRPD incorporates priority inheritance, it is effective only under global scheduling.
Like the O-KGLP, the R 2 DGLP is asymptotically optimal w.r.t. to maximum s-oblivious pi-blocking.
Another CK-OMLP variant is the PK-OMLP due to Yang et al. [213]. Priority donation as used by the CK-OMLP ensures that there is at most one resource-holding job per processor at any time. For resources such as GPUs, where each critical section is likely to include significant self-suspension times, this is overly restrictive. The PK-OMLP, which is intended for partitioned scheduling, hence improves upon the CK-OMLP by allowing multiple jobs on the same processor to hold replicas at the same time [213].
Furthermore, Yang et al. presented an s-aware blocking analysis of the PK-OMLP under P-FP scheduling, which enables a more accurate treatment of self-suspensions within critical sections (this analysis was later amended by Yang et al. [217]). As a result, the PK-OMLP usually outperforms the CK-OMLP when applied in the context of multi-GPU systems [213]. More recently, Yang et al. presented another KX locking protocol specifically for P-FP scheduling and s-aware analysis that forgoes asymptotic optimality in favor of priority-ordered wait queues and non-preemptive critical sections [216].
Finally, all discussed KX protocols only ensure that no more than k tasks enter critical sections (pertaining to a given resource) at the same time. This, however, is often not enough: to be practical, a KX protocol must also be paired with a replica assignment protocol to match lock holders to replicas. That is, strictly speaking a KX algorithm blocks a task until it may use some replica, but it usually is also necessary to quickly resolve exactly which replica a task is supposed to use. To this end, Nemitz et al. [157] introduced several algorithms for the k-exclusion replica assignment problem, with the proposed algorithms representing different tradeoffs w.r.t. optimality considerations and overheads in practice [157].

Nested Critical Sections
Allowing fined-grained, incremental nesting of critical sections-that is, allowing tasks already holding one or more locks to issue further lock requests-adds another dimension of difficulty to the multiprocessor real-time locking problem.
First of all, if tasks may request locks in any order, then allowing tasks to nest critical sections can easily result in deadlock. However, even if programmers take care to manually avoid deadlocks by carefully ordering all requests, the blocking analysis problem becomes much more challenging. In fact, in the presence of nested critical sections, the blocking analysis problem is NP-hard even in extremely simplified settings [210], while it can be solved in polynomial time on both uniprocessors (even in the presence of nesting) and multiprocessors in the absence of nesting (at least in simplified settings) [207,210].
As a result, today's nesting-aware blocking analyses either are computationally highly expensive or yield only coarse, structurally pessimistic bounds. Furthermore, authors frequently exclude nested critical sections from consideration altogether (or allow only coarse-grained nesting via group locks, The aspect unique to nesting that makes it so difficult to derive accurate blocking bounds is transitive blocking, where jobs are indirectly delayed due to contention for resources that they (superficially) do not even depend on. For example, if a job J 1 requires only resource 1 , but another job J 2 holds 1 while trying to acquire a second resource 2 in a nested fashion, then J 1 is exposed to delays due to contention for 2 even though it does not require 2 itself.
While this is a trivial example, such transitive blocking can arise via long transitive blocking chains involving arbitrarily many resources and jobs on potentially all processors. As a result, characterizing the effects of such chains in a safe way and without accruing excessive pessimism is a very challenging analysis problem. Biondi et al. [32] provide more detailed examples of some of the involved challenges.
Nonetheless, despite all difficulties, fine-grained lock nesting arises naturally in many systems [32] and is usually desirable (or even unavoidable) from an average-case perspective. That is, even though fine-grained locking may not be advantageous from a worst-case blocking perspective, the alternativecoarse-grained locking, where lock scopes are chosen to protect multiple resources such that tasks must never acquire more than one lock at any time-is usually much worse in terms of average-case contention, attainable parallelism, scalability, and ultimately throughput. Robust and flexible support for fine-grained nesting is thus indispensable. While the current state of the art, as discussed in the following, may not yet fully meet all requirements in practice, support for nesting in analytically sound multiprocessor real-time locking protocols is an active area of research and we expect capabilities to continue to improve in the coming years.

Coarse-Grained Nesting with Group Locks
One easy way of allowing at least some degree of "nested" resource usage, without incurring the full complexity of fine-grained locking, is to (automatically) aggregate fine-grained resource requests into coarser resource groups protected by group locks. That is, instead of associating a lock with each resource (which is the usual approach), the set of shared resources is partitioned into disjoint resource groups and each such resource group is associated with a group lock.
Under this approach, prior to using a shared resource, a task must first acquire the corresponding group lock. Conversely, holding a resource group's lock entitles a task to use any resource in the group. To eliminate lock nesting, resource groups are defined such that, if any task ever requires access to two resources a and b simultaneously, then a and b are part of the same resource group. More precisely, resource groups are defined by the transitive closure of the "may be held together" relation [33]. As a result, no task ever holds more than one group lock.
The use of group locks was first proposed by Rajkumar [162] in the context of the MPCP, and repopularized in recent years by the FMLP [33]. Both protocols rely exclusively on group locks, in the sense that to date no analysis with support for fine-grained nesting has been presented for either protocol.
From an analysis point of view, group locks are extremely convenient-the synchronization problem (at runtime) and the blocking analysis problem (at design time) both fully reduce to the non-nested cases.
As a result, any of the protocols and analyses surveyed in the preceding sections can be directly applied to the analysis of group locks.
However, there are also obvious downsides in practice. For one, resource groups must be explicitly determined at design time and group membership must be known at runtime (or compiled into the system), so that tasks may acquire the appropriate group lock when requesting a resource, which from a software development point of view is at least inconvenient, and may actually pose significant engineering challenges in complex systems. Furthermore, since its very purpose is to eliminate incremental lock acquisitions, group locking comes with all the scalability and performance problems associated with coarse-grained synchronization.
Last but not least, for certain resources and systems, it may not be possible to define appropriate resource groups. As a pathological example, assume a UNIX-like kernel and consider the file system's inode objects, which are typically arranged in a tree that reflects the file system's hierarchy. Importantly, certain file system procedures operate on multiple inodes at once (e.g., the inodes for a file and its parent directory), and since files may be moved dynamically at runtime (i.e., inodes may show up at any point in the tree), virtually any two inodes could theoretically be held simultaneously at some point. As a result, the set of all inodes collapses into a single resource group, with obvious performance implications.
Thus, while group locks can help to let programmers express resource use in a fine-grained manner, clearly more flexible solutions are needed. Specifically, for performance and scalability reasons, nonconflicting requests for different resources should generally be allowed to proceed in parallel, even if some task may simultaneously hold both resources at some other time. We next discuss multiprocessor real-time locking protocols that realize this to varying degrees.

Early Protocol Support for Nested Critical Sections
Research on support for fine-grained nesting in real-time multiprocessor locking protocols can be grouped into roughly two eras: a period of initial results that lasted from the late 1980s until the mid 1990s, and a recently renewed focus on the topic, which started to emerge in 2010. We discuss protocols from the initial period next and then discuss the more recent developments in Section 9.3 and asymptotically optimal fine-grained nesting in Section 9.4 below.
The first multiprocessor real-time locking protocol, the DPCP [165], was in fact also the first protocol to include support for fine-grained nesting, albeit with a significant restriction. Recall from Section 6 that the DPCP executes critical sections centrally on designated synchronization processors. Because the DPCP relies on the uniprocessor PCP on each synchronization processor, and since the PCP supports nested critical sections (and prevents deadlock) [179], it is in fact trivial for the DPCP to support nested critical sections as long as nesting occurs only among resources assigned to the same processor. Resources assigned to different synchronization processors, however, are not allowed to be nested under the DPCP [163,165].
Consequently, the DPCP's support for fine-grained nesting is actually not so different from group locksall nesting must be taken into account up front, and resources assigned to the same synchronization processor form essentially a resource group. In fact, just as there is no parallelism among non-conflicting requests for resources protected by the same group lock, under the DPCP, there is no parallelism in case of (otherwise) non-conflicting requests for resources assigned to the same synchronization processor.
(Conversely, group locks can also be thought of as a kind of "virtual synchronization processors.") The approach followed by the DPCP thus is attractively simple, but not substantially more flexible than group locks.
The DPCP's same-processor restriction was later removed by Rhee and Martin [173], who in 1995 proposed a protocol that fully generalizes the DPCP and supports fine-grained nesting for all resources.
As with the DPCP, for each resource, there is a dedicated synchronization processor responsible for sequencing conflicting requests. However, unlike the DPCP, Rhee and Martin's protocol [173] does not require all critical sections pertaining a resource to execute on the synchronization processor; rather, the protocol allows for full flexibility: any critical section may reside on any processor. As a result, nested sections that access multiple resources managed by different synchronization processors become possible.
Rhee and Martin's protocol [173] works as follows. To ensure mutual exclusion among distributed critical sections and to prevent deadlock, Rhee and Martin introduced a pre-claiming mechanism that realizes conservative two-phase locking: when a task seeks to enter a critical section, it first identifies the set of all resources that it might require while executing the critical section, and then for each such resource sends a REQUEST message to the corresponding synchronization processor. Each synchronization processor replies with a GRANT message when the resource is available, and once GRANT messages have been received for all requested resources, the task enters its critical section. As resources are no longer required, the task sends RELEASE messages to the respective synchronization processors; the critical section ends when all resources have been released.
To avoid deadlock, synchronization processors further send PREEMPT messages if a REQUEST message from a higher-priority task is received after the resource has been already granted to a lower-priority task (and no matching RELEASE message has been received yet). There are two possibilities: either the lower-priority task has already commenced execution of its critical section, in which case the PREEMPT message is safely ignored as it will soon release the resource anyway, or it has not yet commenced execution, in which case it releases the resource immediately and awaits another GRANT message for the just-released resource. Deadlock is impossible because of the protocol's all-or-nothing semantics: tasks request all resources up front, commence execution only when they have acquired all resources, and while executing a critical section only release resources (i.e., conservative two-phase locking).
Compared to the DPCP [165], Rhee and Martin's protocol [173] is a significant improvement in terms of flexibility and versatility. However, while their protocol allows tasks to use multiple shared resources at once, it does not allow tasks to lock multiple resources incrementally. From a programmer's point of view, it can be cumbersome (or even impossible) to determine all resources that will be required prior to commencing a critical section. Specifically, if the current state of one of the requested resources impacts which other resources are also needed (e.g., if a shared object contains a pointer to another, a priori unknown resource), then a task must initially lock the superset of all resources that it might need, only to then immediately release whichever resources are not actually needed. Such conservative two-phase locking leads to a lot of unnecessary blocking in the worst case, and is known to suffer from performance penalties even in the average case.
The first work-conserving protocol-in the sense that it always allows non-conflicting requests to proceed in parallel-was developed already in 1992 and is due to Schwan and Zhou [177,221]. As previously discussed in Section 5.2.3, Schwan and Zhou's protocol includes an online admission test, which rejects lock requests that cannot be shown (at runtime, based on current contention conditions) to be satisfied within a specified waiting-time bound [221]. As a result, Schwan and Zhou's protocol prevents deadlock-even if tasks request resources incrementally and in arbitrary order-as any request that would cause deadlock will certainly be denied by the admission test.
It should be noted that, from the programmer's point of view, this notion of deadlock avoidance is significantly different from deadlock avoidance as realized by the classic PCP [179] and SRP [23] uniprocessor protocols: whereas the PCP and SRP defer potentially deadlock-causing resource acquisitions, which is logically transparent to the task, Schwan and Zhou's protocol outright rejects such lock requests [221], so that lock-acquisition failures must be handled in the task's logic.
Concerning blocking bounds, Zhou's analysis [221] requires that the bound on the maximum length of outer critical sections must include all blocking incurred due to inner (i.e., nested) critical sections.
This assumption, common also in later analyses [56,93], leads unfortunately to substantial structural pessimism.
For example, consider a scenario in which a job J 1 repeatedly accesses two resources 1 and 2 in a nested fashion (i.e., J 1 locks 1 first and then locks 2 , and does so multiple times across its execution).
Now suppose there's another job J 2 on a remote core that accesses 2 just once. Since J 1 can incur blocking due to J 2 's infrequent critical section when it tries to acquire 2 while already holding 1 , it follows that J 1 's maximum critical section length w.r.t. 1 must include J 2 's maximum critical section length w.r.t. 2 . Thus, if J 1 accesses 1 and 2 in a nested fashion r times, then J 2 's critical section will be over-represented in J 1 's response-time bound by a factor of r-a safe, but pessimistic bound that grossly overstates the actual blocking penalty due to transitive blocking.
Another early protocol that supports fine-grained nesting is Chen et al.'s MDPCP [64] for periodic tasks. Due to the underlying careful definition of inter-processor priority ceilings (which, as discussed in Section 5.2.3, rests on the restriction to periodic tasks), the MDPCP is able to prevent transitive blocking and deadlocks [63] analogously to the PCP [179]. Furthermore, for the priority ceilings to work correctly, the MDPCP requires that any two resources that might be held together must be shared by exactly the same sets of processors [64].
Finally, in 1995, Takada and Sakamura [192] made an important observation concerning the worst-case s-blocking in the presence of nested non-preemptive FIFO spin locks. Let d denote the maximum nesting depth (i.e., the maximum number of FIFO spin locks that any task holds at a time), where 2 ≤ d. Takada and Sakamura [192] showed that, under maximum contention, tasks may incur s-blocking for the combined duration of Ω(m d ) critical sections [192]. Crucially, all the direct s-blocking incurred by various jobs in steps (2)-(4) also transitively delays J, which thus accumulates all delays and therefore incurs s-blocking exponential in d. The actual construction that Takada and Sakamura [192] used to establish the Ω(m d ) lower bound is more nuanced than what is sketched here because non-preemptive execution can actually reduce blocking (a job that occupies a processor while spinning on a level-x lock prevents the processor from serving jobs that generate contention for level-y locks, where y > x).
Even in the most basic case (i.e., simple immediate nesting), where no task ever holds more than two locks at the same time (d = 2), nested FIFO spin locks result in an s-blocking bound that is quadratic in the number of cores, which is clearly undesirable from a scalability point of view. To address this bottleneck, Takada and Sakamura [192] proposed an ingenious solution that brings worst-case s-blocking back under control (especially in the special case of d = 2) by using priority-ordered spin locks, but with a twist. Instead of using scheduling priorities, Takada and Sakamura let jobs use timestamps as priorities-more precisely, a job's locking priority is given by the time at which it issued its current outermost lock request (i.e., nested requests do not affect a job's current locking priority), with the interpretation that an earlier timestamp implies higher priority (i.e., FIFO w.r.t. outermost request timestamps). The necessary timestamps need not actually reflect "time" and can be easily obtained from an atomic counter, such as those used in ticket locks.
For the outermost lock (i.e., the level-one lock), the timestamp order is actually equivalent to FIFO.
The key difference is the effect on the queue order in nested locks: when using FIFO-ordered spin locks, a job's "locking priority" is effectively given by the time of its nested lock request; with Takada and Sakamura's scheme [192], the job's locking priority is instead given by the time of its outermost, non-nested lock request and remains invariant throughout all nested critical sections (until the outermost lock is released).
Because at most m jobs are running at any time, Takada and Sakamura's definition of locking priorities ensures that there are never more than m − 1 jobs with higher locking priorities (i.e., earlier timestamps).
In the special case of d = 2, this highly practical technique suffices to restore an O(m) upper bound on maximum s-blocking. However, in the general case (d > 2), additional heavy-weight techniques are required to ensure progress [192], and even then Takada and Sakamura's method [192] unfortunately does not achieve an O(m) bound in the general case. Interestingly, Takada and Sakamura report that they were able to realize a multiprocessor RTOS kernel with a maximum nesting depth of d = 2 [192].

Recent Advances in Multiprocessor Real-Time Locking with Unrestricted Nesting
Renewed interest in fine-grained locking emerged again in 2010 with Faggioli et al.'s MBWI protocol [84,85], which explicitly supports fine-grained locking and nested critical sections, albeit without any particular rules to aid or restrict nesting. In particular, the MBWI (i) does not prevent deadlock and (ii) uses FIFO queues even for nested requests.
As a result of (ii), Takada and Sakamura's observation regarding the exponential growth of maximum blocking bounds [192] also transfers to nesting under the MBWI protocol. However, the impact of Takada and Sakamura's observation [192] is lessened somewhat in practice once fine-grained blocking analyses (rather than coarse, asymptotic bounds) are applied to specific workloads, since Takada and Sakamura's lower bound is based on the assumption of extreme, maximal contention, whereas lock contention in real workloads (and hence worst-case blocking) is constrained by task periods and the number of critical sections per job.
Concerning (i), programmers are expected to arrange all critical sections such that the "nested in" relation among locks forms a partial order-which prevents cycles in the wait-for graph and thus prevents deadlock. This is a common approach and widely used in practice. For instance, the Linux kernel relies on this well-ordered nesting principle to prevent deadlock, and (as a debugging option) employs a locking discipline checker called lockdep to validate at runtime that all observed lock acquisitions are compliant with some partial order.
Notably, to prevent deadlock, it is sufficient for such a partial order to exist; it need not be known (and for complex systems such as Linux it generally is not, at least not in its entirety). For worst-case blocking analysis purposes, however, all critical sections and all nesting relationships must of course be fully known, and based on this information it is trivial to infer the nesting partial order. For simplicity, we assume that resources are indexed in accordance with the partial order (i.e., a job may lock x while already holding q only if q < x).
Assuming that all nesting is well-ordered, Faggioli et al. [85] presented a novel blocking-analysis algorithm for nested critical sections that characterizes the effects of transitive blocking much more accurately than the crude, inflation-based bounds used previously (e.g., recall the discussion of Schwan and Zhou's protocol [177,221] and Zhou's analysis [221] in Section 9.2 above). Aiming for this level of accuracy was a major step forward, but unfortunately Faggioli et al.'s algorithm exhibits superexponential runtime complexity [85]. As already mentioned, unrestricted nesting is inherently difficult to analyze accurately [210].
Burns and Wellings's MrsP [56] is another recent spin-based protocol that supports fine-grained, wellordered nesting in an otherwise unrestricted manner. While the initial version of the protocol [56] already offered basic support for nesting, the original analysis (which heavily relies on inflation, similar to Zhou's approach [221]) left some questions pertaining to the correct accounting of transitive blocking unanswered [32]. A revised and clarified version of the MrsP with better support for nested critical sections was recently presented by Garrido et al. [93], including a corrected analysis of worst-case blocking in the presence of nested critical sections [93]. Garrido et al.'s revised analysis is still based on execution-time inflation and thus subject to the same structural pessimism as Zhou's approach [221] (as discussed in Section 9.2). In particular, Garrido et al.'s revised analysis [93] does not yet incorporate Zhao et al.'s recently introduced, less pessimistic, inflation-free analysis setup [220]. Conversely, Zhao et al.'s improved analysis [220] does not yet support fine-grained nesting.
In recent work following an alternative approach, Biondi et al. Biondi et al. [32] provided the first analysis of the MRSP with support for fine-grained nesting. As a result, the MSRP may now be employed under P-FP scheduling without any nesting restrictions (other than the well-ordered nesting principle, which is required to prevent deadlock).
Interestingly, while the MSRP uses non-preemptive FIFO spin locks, which is precisely the type of lock that Takada and Sakamura [192] showed to be vulnerable to exponential transitive blocking, Biondi et al.'s MILP-based analysis [32] is effective in analyzing transitive blocking because the MILP-based approach inherently avoids accounting for any critical section more than once [32]. Thus, while in theory FIFO-ordered spin locks cannot prevent exponential transitive blocking in pathological corner cases with extreme levels of contention, this is less of a concern in practice given a sufficiently accurate analysis (i.e., if the analysis does not over-estimate contention) since well-engineered systems are usually designed to minimize resource conflicts.

Asymptotically Optimal Multiprocessor Real-Time Locking
The most significant recent result in real-time locking is due to Ward and Anderson [201], who in 2012 presented a surprising breakthrough by showing that, with a few careful restrictions, it is possible to control the occurrence of transitive blocking and thereby ensure favorable-in fact, asymptotically optimal-worst-case blocking bounds. Specifically, Ward and Anderson introduced the Real-time Nested Locking Protocol (RNLP) [201], which is actually a meta-protocol that can be configured with several progress mechanisms and lock-acquisition rules to yield either spin-or suspension-based protocols that support fine-grained, incremental, and yet highly predictable nested locking.
Depending on the specific configuration, the RNLP ensures either s-oblivious or s-aware asymptotically optimal maximum pi-blocking, in the presence of well-ordered nested critical sections and for any nesting depth d. Furthermore, the RNLP is widely applicable: it supports clustered JLFP scheduling, and hence also covers the important special cases of G-EDF, G-FP, P-EDF, and P-FP scheduling. Specifically, if applied on top of priority donation [47] (respectively, RSB [41]), the RNLP yields an O(m) (respectively, O(n)) bound on maximum s-oblivious (respectively, s-aware) pi-blocking under clustered JLFP scheduling [201]. The RNLP can also be instantiated on top of priority boosting similarly to the FMLP + [35] under partitioned JLFP scheduling to ensure O(n) maximum s-aware pi-blocking [201], and on top of priority inheritance under global JLFP scheduling to ensure O(m) maximum s-oblivious pi-blocking [201].
Analogously to the s-oblivious case, the RNLP can also be configured to use non-preemptive execution and spin locks to obtain an O(m) bound on maximum s-blocking (again for any nesting depth d) [201].
As this contrasts nicely with Takada and Sakamura's Ω(m d ) lower bound in the case of unrestricted nesting [192], and since the spin-based RNLP is slightly easier to understand than suspension-based configurations of the RNLP optimized for either s-oblivious or s-aware analysis, we will briefly sketch the spin-based RNLP variant in the following.
The RNLP does not automatically prevent deadlock and requires all tasks to issue only well-ordered nested requests (w.r.t. a given partial order). The RNLP's runtime mechanism consists of two main components: a token lock and a request satisfaction mechanism (RSM). Both are global structures, that is, all requests for any resource interact with the same token lock and RSM.
The token lock is a k-exclusion lock that serves two purposes: (i) it limits the number of tasks that can concurrently interact with the RSM, and (ii) it assigns each job a timestamp that indicates when the job acquired its token (similar to the time-stamping of outermost critical sections in Takada and Sakamura's earlier protocol [192] based on priority-ordered spin locks). If the RNLP is instantiated as a spin-based protocol or for s-oblivious analysis, then k = m [201]. (Otherwise, in the case of s-aware analysis, k = n [201].) Before entering an outermost critical section (i.e., when not yet holding any locks), a job must first acquire a token from the token lock. Once it holds a token, it may interact with the RSM. In particular, it may repeatedly request resources from the RSM in an incremental fashion, acquiring and releasing resources as needed, as long as nested requests are well-ordered. Once a job releases its last resource (i.e., when it leaves its outermost critical section), it also relinquishes its token.
In the spin-based configuration of the RNLP, jobs become non-preemptable as soon as they acquire a token, and remain non-preemptable until they release their token. Since non-preemptive execution already ensures that at most m = k tasks can be non-preemptable at the same time, in fact no further KX synchronization protocol is required; Ward and Anderson refer to this solution as a trivial token lock (TTL) [201]. A TTL simply records a timestamp when a job becomes non-preemptable, at which point it may request resources from the RSM.
The specifics of the RSM differ in minor ways based on the exact configuration of the RNLP, but all RSM variants share the following key characteristics of the spin-based RSM. Within the RSM, there is a wait queue for each resource q , and when a job requests a resource, it enters the corresponding wait queue.
As previously seen in Takada and Sakamura's protocol [192], jobs are queued in order of increasing timestamps. In the absence of nesting, this reduces again to FIFO queues, but when issuing nested requests, jobs may benefit from an earlier timestamp and "skip ahead" of jobs that acquired their tokens at a later time.
However, there is a crucial deviation from Takada and Sakamura's protocol [192] that makes all the difference: whereas in Takada and Sakamura's protocol a job at the head of a queue acquires the resource as soon as possible, the RNLP's RSM may choose to not satisfy a request for a resource q even when it is available [201]. That is, the RNLP is non-work-conserving and may elect to withhold currently uncontested resources in anticipation of a potential later request that must not be delayed (which is not entirely unlike the use of priority ceilings in the classic PCP [179]). Specifically, a job J i at the head of a resource q 's queue may not acquire q if there exists another token-holding job J h with an earlier token timestamp that might still request q [201].
As a result of this non-work-conserving behavior and the use of timestamp-ordered wait queues, the RNLP ensures that no job is ever blocked by a request of a job with a later token timestamp, even when issuing nested requests. This property suffices to show O(m) maximum s-blocking per outermost critical section (because there can be at most m − 1 jobs with earlier token timestamps). It bears repeating that the RNLP's bound holds for any nesting depth d, whereas Takada and Sakamura's work-conserving protocol [192] ensures O(m) maximum s-blocking only for d = 2, and even then Takada and Sakamura's protocol exhibits worse constant factors (i.e., is subject to additional s-blocking).
The RNLP's non-work-conserving RSM behavior has two major implications: first, while the RNLP controls worst-case blocking optimally (asymptotically speaking), it does so at the price of a potential increase in average-case blocking when jobs are denied access to rarely nested, but frequently accessed resources. Second, all potential nesting must be known at runtime (i.e., the partial nesting order must not only exist, it must also be available to the RNLP). This is required so that the RSM can appropriately reserve resources that may be incrementally locked at a later time (i.e., to deny jobs with later token timestamps access to resources that might still be needed by jobs with earlier token timestamps). In practical terms, the need to explicitly determine, store, and communicate the partial nesting order imposes some additional software engineering effort (e.g., at system-integration time).
Subsequently, in work aimed at making the RNLP even more versatile and efficient for practical use, Ward and Anderson [202] introduced a number of extensions and refinements. Most significantly, they introduced the notion of dynamic group locks (DGLs) [202] to the RNLP. As the name suggests, a DGL allows tasks to lock multiple resources in one operation with all-or-nothing semantics, similarly to a (static) group lock (recall Section 9.1), but without the need to define groups a priori, and without requiring that groups be disjoint. In a sense, DGLs are similar to the pre-claiming mechanism of Rhee and Martin [173], but there is one important difference: whereas Rhee and Martin enforce conservative two-phase locking semantics-once a task holds some resources, it cannot acquire any additional locksin the RNLP, tasks are free to issue as many DGL requests as needed in an incremental fashion. That is, the RNLP supports truly nested, fine-grained DGLs. Notably, introducing DGLs does not negatively affect the RNLP's blocking bounds, and the original RNLP [201] can thus be understood as a special case of the DGL-capable RNLP [202] where each DGL request pertains to just a single resource (i.e., a singleton "group" lock).
Additionally, Ward and Anderson [202] introduced the possibility to apply the RNLP as a KX synchro-nization protocol (also with asymptotically optimal blocking bounds). In particular, KX synchronization is possible in conjunction with DGLs, so that tasks can request multiple replicas of different resources as one atomic operation.
As another practical extension of the RNLP, Ward and Anderson [202] introduced the ability to combine both spin-and suspension-based locks in a way such that requests for spin locks are not blocked by requests for semaphores (called "short-on-long blocking" [202]), since critical sections pertaining to suspension-based locks are likely to be much longer (possibly by one or more orders of magnitude) than critical sections pertaining to spin locks.
In 2014, in a further major broadening of the RNLP's capabilities [201,202], Ward and Anderson presented the Reader-Writer RNLP (RW-RNLP) [203] for nested RW synchronization. Building on the principles of the RNLP and phase-fair locks [35,44,46], Ward and Anderson derived a RW protocol that achieves asymptotically optimal maximum pi-or s-blocking (like the RNLP) and O(1) per-request reader blocking (phase-fairness), while allowing for a great deal of flexibility: tasks may arbitrarily nest read and write critical sections, upgrade read locks to write locks, and lock resources incrementally. While a detailed discussion is beyond the scope of this survey, we note that integrating RW semantics into the RNLP, in particular without giving up phase-fairness, is nontrivial and required substantial advances in techniques and analysis [203].
In 2015, Jarrett et al. [117] introduced a contention-sensitive variant of the RNLP [201], denoted C-RNLP. In contrast to the original RNLP, and the vast majority of other protocols considered herein, the C-RNLP exploits knowledge of maximum critical section lengths at runtime to react dynamically to actual contention levels. (Schwan and Zhou's protocol [177,221] also uses maximum critical section lengths at runtime.) At a high level, the C-RNLP dynamically overrides the RNLP's regular queue order to lessen the blocking caused by the RNLP's non-work-conserving behavior, but only if it can be shown that doing so will not violate the RNLP's guaranteed worst-case blocking bounds. Since heavy resource contention is usually rare in practice, contention sensitivity as realized in the C-RNLP can achieve substantially lower blocking in many systems. As a tradeoff, the C-RNLP unsurprisingly comes with higher lock acquisition overheads, which however can be addressed with a novel implementation approach [159] (see Section 10.4). Furthermore, it requires accurate information on worst-case critical section lengths to be available at runtime, which can be inconvenient from a software engineering perspective.
Overall, the RNLP and its various extensions represent the state of the art w.r.t. support for fine-grained nesting with acquisition restrictions that prevent excessive transitive blocking. Importantly, Ward and

Implementation Aspects
While our focus in this survey is algorithmic properties and analytical guarantees, there also exists a rich literature pertaining to the implementation of multiprocessor real-time locking protocols and their integration with programming languages. In the following, we provide a brief overview of key topics.

Spin-Lock Algorithms
The spin-lock protocols discussed in Section 4 assume the availability of spin locks with certain "realtime-friendly" properties (e.g., FIFO-ordered or priority-ordered locks). Spin locks algorithms widely used in practice include Mellor-Crummey and Scott's scalable MCS queue locks [143], simple ticket locks [125,143], and basic TAS locks, where the former two are instances of FIFO-ordered spin locks, and the latter is an unordered lock (i.e., it is not "real-time-friendly," but easy to implement and still analyzable [209]). These lock types are well-known, not specific to real-time systems, and covered by excellent prior surveys on shared-memory synchronization [19,171,178]. We focus here on spin-lock algorithms designed specifically for use in real-time systems.
The most prominent example in this category are priority-ordered spin locks, which are only rarely (if ever) used in general-purpose systems. The first such locks are due to Markatos and LeBlanc [139,140,141], who offered a clear specification for "priority-ordered spin locks" and proposed two algorithms that extend two prior FIFO-ordered spin locks, by respectively Burns [57] and Mellor-Crummey and Scott [143], to respect request priorities.
Several authors continued this line of research and proposed refined priority-ordered spin locks in subsequent years. In particular, Craig [72] proposed several scalable FIFO-and priority-ordered queue lock algorithms. Craig also presented several extensions of the basic algorithms that add support for timeouts, preemptable spinning, memory-efficient lock nesting (i.e., without requiring a separate queue element for each lock) [72]. Takada and Sakamura [191] similarly proposed a scheme for spinning jobs to be preempted briefly by interrupt service routines, with the goal of ensuring low interrupt latencies in the kernel of a multiprocessor RTOS.
Wang et al. [199] considered nested priority-ordered spin locks and observed that they can give rise to starvation effects that ultimately lead to unbounded priority inversion. Specifically, they identified the following scenario: when a high-priority job J h is trying to acquire a lock q that is held by a lower-priority job J l , and J l is in turn trying to acquire a (nested) lock p that is continuously used by (at least two) middle-priority jobs (in alternating fashion) located on other processors, then J l (and implicitly J h ) may remain indefinitely blocked on p (respectively, on q ). Finally, and much more recently, Huang and Jayanti [113] proposed a strengthened definition of "priorityordered spin locks" that forbids races among simultaneously issued requests of different priorities and presented an algorithm that satisfies this stricter specification.
Concerning FIFO-ordered spin locks that support preemptable spinning, as assumed in Section 4.1.2, several authors have proposed suitable algorithms [18,72,121,191]. Furthermore, in their proposal of the SPEPP approach (which also relies on preemptable spinning, as discussed in Section 4.1.4), Takada and Sakamura [194] provided two implementation blueprints, one based on MCS locks [143] and one based on TAS locks. Notably, even the implementation based on TAS locks ensures FIFO-ordered execution of critical sections because all posted operations (i.e., closures) are processed in the order in which they were enqueued (though not necessarily by the processor that enqueued them) [194].
With regard to RW locks, Mellor-Crummey and Scott provided the canonical implementation of task-fair (i.e., FIFO) RW locks [144] as an extension of their MCS queue locks [143]. Several practical phase-fair RW lock implementations were proposed and evaluated by Brandenburg and Anderson [35,44,46].
Bhatt and Jayanti subsequently proposed a stricter specification of "phase fairness" and proposed a matching lock algorithm [29].
Finally, while not aimed specifically at real-time systems, it is worth pointing out a recent work of Dice and Harris [74] in which they aim to circumvent the lock-holder preemption problem without resorting to non-preemptive sections or heavy-weight progress mechanisms by leveraging emerging hardware support for transactional memory (HTM). With a sufficiently powerful HTM implementation, it is possible to encapsulate entire critical sections pertaining to shared data structures (but not I/O devices) in a HTM transaction, which allows preempted critical sections to be simply aborted and any changes to the shared resource to be rolled backed automatically. As a result, lock holders can be preempted without the risk of delaying remote tasks. However, HTM support is not yet widespread in the processor platforms typically used in real-time systems, and it still remains to be seen whether it will become a de facto standard in future multicore processors for embedded systems.
In work on predictable multicore processors, Strøm and Schoeberl [187] presented a pure hardware implementation of a predictable and analysis-friendly spin lock with round-robin semantics and nonpreemptable spinning. Interestingly, while a round-robin lock does not ensure FIFO ordering of requests, round-robin access is much simpler and can be realized much more efficiently in hardware, and nonetheless provides identical worst-case guarantees as a FIFO spin lock (at most m − 1 blocking critical sections per request). In Strøm and Schoeberl's implementation, uncontested lock acquisitions take only two clock cycles and lock release operations proceed in a single clock cycle [187]. In another recent proposal of a processor-integrated hardware synchronization facility, Maroun et al. [142] presented an on-chip scratchpad memory with support for time-predictable atomic operations, which can be used to implement spin locks in an efficient and predictable manner amenable to WCET analysis.
Brandenburg [35] discusses how to factor non-preemptive spin-lock overheads into blocking and schedulability analyses. Balasubramanian et al. [24] provide an overhead-aware blocking and schedulability analysis for Afshar et al.'s FSLM [5]. Balasubramanian et al.'s analysis [24] is based on executiontime inflation, similar to the original analysis of the MSRP [90], and hence is subject to structural pessimism [209]. Wieder and Brandenburg's LP-based analysis [209], which is designed to avoid such structural pessimism, can be used in conjunction with the overhead-accounting techniques proposed by Brandenburg [35].

Avoiding System Calls
In an operating system with a clear kernel-mode/user-mode separation and protection boundary, the traditional way of implementing critical sections in user mode is to provide lock and unlock system calls. However, system calls typically impose non-negligible overheads (compared to regular or inlined function calls), and hence represent a significant bottleneck.
System-call overhead poses a problem in particular for spin-lock protocols, as one of the primary benefits of spin locks is their lower overheads compared to semaphores. If each critical section requires a system call to indicate the beginning of non-preemptive execution, and another system call to indicate the re-enabling of preemptions, then the overhead advantage is substantially diminished.
To avoid such overheads, LITMUS RT introduced a mechanism [35] (in version 2010.1) that allows tasks to communicate non-preemptive sections to the kernel in a way that requires a system call only in the infrequent case of a deferred preemption. The approach works by letting each task share a page of memory, called the task's control page, with the kernel, similar to the notion of a userspace thread control block (UTCB) found in L4 microkernels. More specifically, to enter a non-preemptive section, a task simply sets a flag in its control page, which it clears upon exiting the non-preemptive section.
To indicate a deferred preemption, the kernel sets another flag in the control page. At the end of each non-preemptive section, a task checks the deferred preemption flag, and if set, triggers the scheduler (e.g., via the sched_yield() system call).
To prevent runaway tasks or attackers from bringing down the system, the kernel can simply stop honoring a task's non-preemptive section flag if the task fails to call sched_yield() within a predetermined time limit [35], which makes the mechanism safe to use even if user-space tasks are not trusted. The control-page mechanism thus allows spin locks to be implemented efficiently in userspace, requiring no kernel intervention even when inter-core lock contention occurs.
A similar problem exists with semaphores in user mode. However, since blocking is realized by suspending in semaphores, in the worst case (i.e., if contention is encountered), the kernel is always involved.
Nonetheless, the avoidance of system calls in user-mode semaphores is still an important average-case optimization. Specifically, since lock contention is rare in well-designed systems, avoiding system calls in the case of uncontested lock and release operations (i.e., in the common case) is key to maximizing throughput in applications with a high frequency of critical sections.
Semaphore implementations that do not involve the kernel in the absence of contention are commonly called futexes (fast userspace mutexes), a name popularized by the implementation in Linux. From a real-time perspective, the main challenge in realizing futexes is maintaining a protocol's predictability guarantees (i.e., to avoid invalidating known worst-case blocking bounds). With regard to this problem, Split et al. [183] distinguish between reactive and anticipatory progress mechanisms [183], where the former take effect only when contention is encountered, whereas the latter conceptually require actions even before a conflicting lock request is issued. For instance, priority inheritance is a reactive progress mechanism, whereas priority boosting is an anticipatory progress mechanism since a job's priority is raised unconditionally whenever it acquires a shared resource.
It is easy to combine futexes with reactive mechanisms since the kernel is involved anyway in the case of contention (to suspend the blocking task). In contrast, anticipatory protocols are more difficult to support since the protocol's unconditional actions must somehow be realized without invoking the kernel in the uncontended case. Possibly for this reason, Linux supports priority-inheritance futexes, but currently does not offer a futex implementation of ceiling protocols.
Despite such complications, it is fortunately still possible to realize many anticipatory protocols as futexes by deferring task state updates until the kernel is invoked anyway for some other reason (e.g., a preemption due to the release of a higher-priority job), as has been shown by a number of authors [16,183,222,225].
In a uniprocessor context, Züpke et al. [222,223,224,225] considered how to implement predictable real-time futexes in an efficient and certifiable way in the context of a high-assurance, resourcepartitioned separation kernel. Their approach is also relevant in a multiprocessor context because it allows for an efficient, futex-compatible implementation of priority boosting under partitioned scheduling by means of deferred priority changes [225]. Almatary et al. [16] later explored similar protocols for uniprocessor FP and EDF scheduling and verified their correctness with a model checker.
Targeting multiprocessor systems, Split et al. [183] systematically explored the aforementioned classes of reactive and anticipatory real-time locking protocols, and concretely proposed real-time futex implementations of the PCP [179], the MPCP [162], and the partitioned FMLP + [35], which were shown to be highly efficient in practice.

Implementations of Allocation Inheritance
Allocation inheritance is the progress mechanism that is the most difficult to support on multiprocessors, in particular when realized as task migration, since it implies dynamic and rapid changes in the set of processors on which a lock-holding job is eligible to execute. While this results in nontrivial synchronization challenges within the scheduler, allocation inheritance has been implemented and shown to be practical in several systems.
As already mentioned in Sections 4.1.4 and 10.1, Takada and Sakamura [194] provided efficient implementations of the allocation inheritance principle that avoid task migrations by expressing critical sections as closures. However, Takada and Sakamura's algorithms still require critical sections to be executed non-preemptively (i.e., they are not independence-preserving).
Concerning realizations of allocation inheritance that allow tasks to remain fully preemptable at all times, Steinberg et al. [185] describe an elegant way of implementing allocation inheritance on uniprocessors and mention that their implementation extends to multiprocessors (but do not provide any details).
Hohmuth and Peter [104] discuss implementation and design choices in a multiprocessor context, but do not report on implementation details. Both Steinberg et al. and Hohmuth and Peter consider microkernel systems, which are particularly well-suited to allocation inheritance due to their minimalistic kernel environment and emphasis on a clean separation of concerns.
In work on more complex monolithic kernels, Brandenburg and Bastoni [50] discuss a prototype implementation in Linux. Allocation inheritance has also been realized several times in the Linux-based

RTOS and Programming Language Integration
Over the years, a number of authors have explored the question of how to best integrate real-time locking protocols into RTOSs and popular programming languages, to which extent existing theory meets the needs of real systems, and techniques for efficient implementations of real-time locking protocols. In the following, we provide a high-level overview of some of the considered directions and questions.
Criticism of programming language synchronization facilities from the perspective of multiprocessor realtime predictability dates all the way back to 1981, when Roberts et al. [174] reviewed the then-nascent ADA standard. Interestingly, Roberts et al. argued already then in favor of introducing spin-based synchronization (rather than exclusively relying on suspension-based methods) to avoid scheduler invocations [174].
More than 20 years later, Naeser [146] considered undesirable blocking effects on multiprocessors due to ADA 95's protected actions. Specifically, Naeser identified that, if low-priority tasks spread across several processors issue a continuous stream of requests for a certain type of ADA operations (namely, entries protected by barriers) to be carried out on a protected object currently locked by a higher-priority task, then, according to the language standard, these operations could potentially all be serviced by the higher-priority task in its exit path (i.e., when trying to release the protected object's lock) [146], which theoretically can lead to unbounded delays. As an aside, Takada and Sakamura's SPEPP approach [194] offers an elegant solution to this particular problem since it is starvation-free. Similarly, the MrsP [56] could be applied in this context, as suggested by Burns and Wellings [55] in their investigation of protected objects in ADA 2012.
Even today, predictable multiprocessor synchronization in ADA remains a point of discussion. Lin et al. [128,129,130] revisited the support for analytically sound multiprocessor real-time synchronization in ADA 2012 and still found it to be wanting. At the same time, they also found the multiprocessor real-time locking protocols available in the literature unsatisfactory, in the sense that there is no clear "best" protocol that could be included in the standard to the exclusion of all others. To resolve this mismatch in needs and capabilities, Lin et al. argued in favor of letting programmers provide their own locking protocols, so that each application may be equipped with a protocol most suitable for its needs, and presented a flexible framework for this purpose as well as a number of reference implementations of well-known protocols on top of the proposed framework [128,129,130].
Most recently, Garrido et al. [92] investigated the question of predictable multiprocessor real-time locking within the constraints of the ADA Ravenscar profile [53] for safety-critical hard real-time systems. In particular, they compared implementations of the MSRP [90] (based on non-preemptive sections) and the MrsP [56] (based on allocation inheritance), and found that the simpler MSRP is preferable in the restricted Ravenscar context, whereas the MrsP is suitable for use in a general, full-scope ADA system.
In work on other programming environments and languages, Zhang and Cordes [218, 219] investigated a range of multiprocessor real-time locking protocols in the context of a CORBA middleware, and Strøm et al. [186,188] proposed and evaluated hardware implementations of real-time synchronization primitives in a native Java processor for embedded safety-critical systems. Also targeting Java, Wellings et al. [206] studied the multiprocessor real-time locking problem from the point of view of the needs and requirements of the Real-Time Java (RTSJ) and Safety-Critical Java (SCJ) specifications, and found a considerable gap between the (restrictive) assumptions underlying the (at the time) state-of-the-art real-time locking protocols and the broad flexibility afforded by the RTSJ and, to a lesser degree, SCJ specifications. As a step towards closing this gap, Wellings et al. [206] suggested changes to the RTSJ and SCJ specifications that would ease a future integration of analytically sound multiprocessor real-time locking protocols.
The first to discuss in detail the implementation of a multiprocessor real-time locking protocol in an actual RTOS were Schwan and Zhou [177,221], who proposed a real-time threads package, including support for predictable synchronization as discussed in Section 5.2.3, for use on top of the Mach microkernel, which has since been superseded by later generations of microkernels (e.g., the L4 family).
Takada and Sakamura considered the design of a multiprocessor RTOS in light of the scalability of worst-case behavior [190,193]. Among other techniques, they proposed a scheme called local preference locks [193], where resources local to a particular processor are protected with priority-ordered spin locks, but request priorities do not depend on task priorities. Instead, the local processor accesses a local preference lock with higher priority than remote processors, which ensures that processors quickly gain access to local resources (i.e., with O(1) s-blocking) even if they are shared with multiple remote processors.
In work throughout the past decade, many locking protocols have been implemented and evaluated in LITMUS RT [35,79]. Already in 2008, Brandenburg and Anderson [43] provided a detailed discussion of the implementations of several locking protocols in LITMUS RT , including the FMLP and the MPCP.
Several authors have reported on MPCP implementations. In work targeting Linux with the PREEMPT_RT patch, Carminati et al. [59] provided details on in-kernel implementations of the FMLP [33] and a non-preemptive MPCP variant [58]. A particularly low-overhead implementation of the MPCP for micro-controllers that avoids the need for expensive wait-queue manipulations was proposed by Müller et al. [145]. Targeting a very different system architecture, Ishibashi et al. implemented the MPCP on top of a CAN bus to realize mutual exclusion in a distributed shared memory (DSM) [116].
In recent overhead-oriented work, Nemitz et al. [158,160] added a fastpath to the RNLP [201] to optimize for the common case of non-nested lock acquisitions, and Afshar et al. [10] presented an implementation of spin locks with flexible spin priorities [5]. Motivated by the fact that the contentionsensitive C-RNLP [117] exhibits relatively high acquisition and release overheads due to its complex request-sequencing rules, Nemitz et al. [159] went a significant step further and introduced a novel and rather unconventional approach to implementing locking protocols. Specifically, Nemitz et al.
centralized the acquisition and release logic in dedicated lock servers that run the locking protocol in a cache-hot manner. Importantly, in contrast to the centralized semaphore protocols discussed in Section 6, a lock server does not actually centralize the execution of critical sections; rather, it centralizes only the execution of the locking protocol itself, and still lets tasks execute their actual critical sections in-place. In other words, in Nemitz et al.'s design, a lock server decides in which order critical sections are executed, but does not execute any critical sections of tasks. As a result of the cache-hot, highly optimized implementation of the contention-sensitive RNLP, Nemitz et al. were able to demonstrate a reduction in acquisition and release overheads by over 80% [159].
To date, multiprocessor real-time locking protocols have received scant attention from a WCET analysis perspective, with Gerdes's thesis [94] and recent proposals for synchronization support in timepredictable multicore platforms [142,187,188] being notable exceptions.
Last but not least, Gadia et al. [89] recently reported on a verified implementation of priority inheritance with support for nested critical sections in the RTEMS operating system.

Conclusion, Further Directions, and Open Issues
Predictable synchronization is one of the central needs in a multiprocessor real-time system, and it is thus not surprising that multiprocessor real-time locking protocols, despite having received considerable attention already in the past, are still a subject of ongoing research. In fact, the field has seen renewed and growing interest in recent years due to the emergence and proliferation of multicore processors as the de facto standard computing platform. Looking back at its history over the course of the past three decades-starting with Rajkumar et al.'s pioneering results [162,163,165]-it is fair to say that the community has gained a deeper understanding of the multiprocessor real-time locking problem and amassed a substantial body of relevant knowledge. In this survey, we have attempted to systematically document and structure a current snapshot of this knowledge and the relevant literature, in hopes of making it more easily accessible to researchers and practitioners alike.

Further Research Directions
In addition to the topics discussed in the preceding sections, there are many further research directions related to multiprocessor real-time locking protocols that have been explored in the past. While these topics are beyond the scope of this already long survey, we do mention a few representative publications to provide interested readers with starting points for further exploration.
One important resource in multiprocessor real-time systems that we have excluded from consideration herein is energy. Unsurprisingly, energy management policies, in particular schemes that change processor speeds, can have a significant impact on synchronization [69,86,99,196,211]. Another architectural aspect that can interact negatively with multiprocessor real-time locking protocols is simultaneous multithreading (SMT) [133].
Targeting high-integrity systems subject to both real-time and security requirements, Völp et al. [197] studied a number of real-time locking protocols (including the MPCP [162] and the clustered OMLP [47]) from a timing-channel perspective and identified confidentiality-preserving progress mechanisms and locking protocols that prevent shared resources from being repurposed as covert timing channels.
A number of authors have studied multiprocessor real-time synchronization problems from an optimality perspective and have obtained speed-up and resource augmentation results for a number of protocols and heuristics [21,22,67,114,115,167,168,169,198]. These results are largely based on rather limiting assumptions (e.g., only a single critical section per job), and in several instances pertain to protocols purposefully designed to obtain a speed-up or resource augmentation result, which has limited practical relevance [66].
Taking a look at synchronization in real-time systems from a foundational perspective, Lynch and Shavit [137] established lower and upper bounds on the number of atomic registers required to realize mutual exclusion with deadlock avoidance.
Targeting periodic workloads in which each task has at most one critical section, Shi et al. [181] explored an unconventional synchronization approach in which an explicit dependency graph of all jobs and critical sections in a hyperperiod is built a priori and all critical sections are sequenced offline with a list scheduling heuristic.
All of the protocols discussed in this survey assume sequential tasks. Going beyond this standard assumption, Holenderski et al. [106] studied the multiprocessor real-time locking problem in the context of parallel real-time tasks [105,106]. Exploring a similar direction, Dinh et al. [75] proposed an analysis of parallel tasks using spin locks in the context of federated scheduling. Most recently, Jiang et al. [118] presented an analysis of parallel tasks using semaphores under the same scheduling assumptions.
Over the years, many results pertaining to the task and resource mapping problems as well as related optimization problems have appeared [13,34,70,76,87,88,99,100,101,111,112,115,134,149,152,154,168,180,189,195,198,208]. Particularly well-known is Lakshmanan et al.'s task-set partitioning heuristic for use with the MPCP [123]. Alternative heuristics and strategies have been proposed by (among others) Nemati et al. [154], Wieder and Brandenburg [208], and Al-bayati et al. [13]. Most recently, Dong et al. [76] presented a detailed study of several task-and resource-assignment heuristics following a resource-centric schedulability analysis approach [114,115] in the context of a semaphore protocol with centralized critical sections, and Chen et al. [70] presented an ILP-based partitioning solution for the same workload and platform model. Techniques for scheduling task graphs with precedence constraints and end-to-end deadlines in distributed systems [189,195] are particularly relevant in the context of the DPCP and its related task and resource mapping problems.
Another system configuration aspect that has received considerable attention is the policy selection problem, where the goal is to choose an appropriate synchronization method for a given set of tasks, a set of shared resources, and the tasks' resource needs [8,13,27,30,52,97,98]. Brandenburg et al. [52] compared spin-and suspension-based locking protocols (namely, the FMLP variants for short and long resources [33]) in LITMUS RT under consideration of overheads with each other, and also against non-blocking synchronization protocols. The choice between spin-based locking protocols and non-blocking alternatives has also recently been considered by Al-bayati et al. [13] and Biondi and Brandenburg [30]. Shu proposed to reduce the impact of remote blocking by combining locks with a versioning mechanism to reduce critical section lengths [182].
In work on the consolidation and integration of legacy systems on multicore platforms, Afshar et al. [2,4], Nemati and Nolte [151], and Nemati et al. [155] explored the use of abstract interfaces that allow to represent a component's resource needs and locking behavior without revealing detailed information about the component's internals.
Finally, several authors have considered synchronization needs in hierarchical multiprocessor real-time systems (i.e., systems in which there is a hierarchy of schedulers) [6,7,9,31,120,152,153]. In such systems, tasks are typically encapsulated in processor reservations, resource servers, or, in the case of virtualization, virtual machines, and thus prone to preemptions in the middle of critical sections.
As first studied by Holman and Anderson [108] in the context of Pfair-scheduled systems, this poses considerable challenges from a locking point of view [107,108,109,110], and requires special rules to either prevent lock acquisitions shortly before a job or reservation's (current) budget allocation is exhausted [108], or acceptance of (and appropriate accounting for) the fact that jobs or reservations may overrun their allocated budget by the length of one critical section [31].

Open Problems
As already mentioned in Section 1, the "last word" on multiprocessor real-time resource sharing has not yet been spoken, and will likely not be spoken for a long time to come. Without seeking to detract from other interesting directions, we briefly highlight three largely unexplored opportunities for future work.
First, there is a need for more flexible blocking analyses that can handle multiple lock types simultaneously. Practical systems typically use multiple types of locks for different purposes (e.g., both spin locks and semaphores), and while many lock types and real-time locking protocols have been investigated and analyzed in isolation, few results in the literature explicitly account for effects that arise from the combination of different lock types (e.g., blocking bounds for semaphores in the presence of non-preemptive sections due to spin locks [33,202]). Worse, few (if any) of the existing analyses focused on individual lock types and protocols compose soundly without modification. To better support the needs of real-world systems, clearly further advances will be required in this direction.
Second, all major existing blocking analyses pertain to the worst case. While this is clearly required for true hard real-time systems, given that average-case contention in well-designed systems is usually low, the resulting bounds can seem extremely pessimistic relative to observable blocking delays. For firm real-time systems that do not require hard guarantees, or for systems where there are strong economic incentives to not provision based on an absolute worst-case basis (which is arguably the majority of systems in practice), there is unfortunately little support in the existing literature. Thus, practitioners today must choose between pessimistic hard-real-time blocking bounds that tend to result in over-provisioning, or no analysis at all (i.e., rely purely on measurements instead). To extend the range of systems to which analytically sound blocking bounds are applicable, we will need means for reasoning about anticipated blocking delays that are both more rigorous than average-case observations and less taxing than hard-real-time analyses based on worst-case assumptions at every step.
Last but not least, we would like to highlight the need for a rigorous foundation and formal proofs of correctness for blocking analyses. In particular for worst-case blocking analyses, which by their very nature are intended to be used in critical systems, it is essential to have utmost confidence in the soundness of the derived bounds. However, as blocking bounds become more accurate, task models more detailed, and synchronization techniques more advanced, the required blocking analyses also become more tedious to derive, more challenging to validate, and ultimately more error-prone. If the goal is to support safety-critical systems in practice, and to use multiprocessor real-time locking protocols and their analyses as evidence of system safety in certification processes, then this is a very dangerous trend, in particular in the light of prior missteps that have only recently come to light [65,68,93,217]. As a first step towards a higher degree of confidence in the correctness of advanced blocking analyses, recent LP-and MILP-based blocking analyses [30,37,209,215] offer the advantage that each constraint can be checked and proven correct individually (rather than having to reason about the entire analysis as a whole), which simplifies the problem considerably. However, while this is a much needed improvement, it is clearly not yet enough. In the longterm, it will be desirable (if not outright required at some point) for analyses and protocols intended for use in safety-critical systems-such as blocking bounds for multiprocessor real-time locking protocols-to come with a machine-checked proof of soundness, or other equivalent soundness guarantees backed by formal verification methods. Much interesting and challenging work remains to be done before a full formal verification of a multiprocessor real-time locking protocol and its timing properties can become reality.