Id.rmran fWireal-time system: the spinlock. Spinlocks are low-level Low-level multiprocessor synchronization primitives, synchronization mechanisms for multiprocessor systems such as spinlocks. are usually designed with little or that are used to provide mutual exclusion. They are no consideration about timing constraints, which makes usually implemented with the help of atomic instruct',em inappropriate foe r.,al-time systems. In this paper, tions like test-.andset that most multiprocessors prowe propose a new synchronization mechanism, the pri-vide. HIowever, spinlock implementations are usually oriLy spinlock, that takes into account the priorities of proposed with little or no consideration of timing conthe processes that want to-acquire it, and favors high straints. So, current implementations service requests for priority processes. We define what a priority spinlock is, the lock randomly or at best FIFO. Random service of and propose two algorithms to implement-priority spin-requests, are inappropriate for real-time systems; FIFO locks with local spinning. -Priority spinlocks can-be Used service is appropriate in real-time applications, because to provide prioritized mutually exclusive-access to shared it bounds the worst case time where a processor has to resources in real-time multiprocessor systems. They can wait to acquire the spinlock. lowever, FIFO implemenalso be used as building blocks for higher level priority tations may force a high priority process that wants to synchronization primitives, such as priority semal hores, acquire a spinlock to wait for all the low priority processes that happen to have requested the spinlock before it. This potentially long wait leads to very conservative 1 Introduction scheduling, because although the worst case priority inversion is bounded. the bound is very large. Re-.l-time systems have timing constraints that mustIn this paper we propose a new version of spinlocks -be met, otherwise catastrophic effects may happen [13]. called priority spinlocks. Priority spinlocks take into acTiming constraints usually take the form of deadlines, count the priority of the process that wants to acquire earliest starting times, or value functions. Schedulers the lock, and assign the locks to the highest priority protranslate these timing constraints along with recourse re-cess that has requested the lock at the time the decision quirements and criticalities into priorities (2, 3, 5. 7. 12], is being made. and assign the resources of the system to higher -priority processes. These priorities must be preserved -through--out the system, otherwise the correctness of a real-tine 1.1 Priority spinlocks system can not be demonstrated. If there is-a server Priority spinlocks ate defined as follows: where priorities are not preserved, then a high priority process may be delayed (possibly indefinitely) by a 1. No more than one processor may possess a lock at j low priority process. This event is called priority inone time.version, and must be avoided, bounded, or minimized, otherwise ...