On Spin Locks in AUTOSAR: Blocking Analysis of FIFO, Unordered, and Priority-Ordered Spin Locks

Motivated by the widespread use of spin locks in embedded multiprocessor real-time systems, the worst-case blocking in spin locks is analyzed using mixed-integer linear programming. Four queue orders and two preemption models are studied: (i) FIFO-ordered spin locks, (ii) unordered spin locks, (iii) priority-ordered spin locks with unordered tie-breaking, and (iv) priority-ordered spin locks with FIFO-ordered tie-breaking, each analyzed assuming both preempt able and non-preempt able spinning. Of the eight lock types, seven have not been analyzed in prior work. Concerning the sole exception (non-preempt able FIFO spin locks), the new analysis is asymptotically less pessimistic and typically much more accurate since no critical section is accounted for more than once. The eight lock types are empirically compared in schedulability experiments. While the presented analysis is generic in nature and applicable to real-time systems in general, it is specifically motivated by the recent inclusion of spin locks into the AUTOSAR standard, and four concrete suggestions for an improved AUTOSAR spin lock API are derived from the results.

[1]  Ken Sakamura,et al.  A novel approach to multiprogrammed multiprocessor synchronization for real-time kernels , 1997, Proceedings Real-Time Systems Symposium.

[2]  Hennadiy Leontyev,et al.  Efficient synchronization under global EDF scheduling on multiprocessors , 2006, 18th Euromicro Conference on Real-Time Systems (ECRTS'06).

[3]  Travis S. Craig Queuing spin lock algorithms to support timing predictability , 1993, 1993 Proceedings Real-Time Systems Symposium.

[4]  Michael L. Scott,et al.  Scheduler-conscious synchronization , 1997, TOCS.

[5]  Michel Raynal,et al.  Algorithms for mutual exclusion , 1986 .

[6]  Giuseppe Lipari,et al.  Minimizing memory utilization of real-time task sets in single and multi-processor systems-on-a-chip , 2001, Proceedings 22nd IEEE Real-Time Systems Symposium (RTSS 2001) (Cat. No.01PR1420).

[7]  Tommaso Cucinotta,et al.  The Multiprocessor Bandwidth Inheritance Protocol , 2010, 2010 22nd Euromicro Conference on Real-Time Systems.

[8]  James H. Anderson,et al.  Optimality Results for Multiprocessor Real-Time Locking , 2010, 2010 31st IEEE Real-Time Systems Symposium.

[9]  Lory D. Molesky,et al.  Predictable synchronization mechanisms for multiprocessor real-time systems , 1990, Real-Time Systems.

[10]  James H. Anderson,et al.  Shared-memory mutual exclusion: major research trends since 1986 , 2003, Distributed Computing.

[11]  Björn B. Brandenburg Improved analysis and evaluation of real-time semaphore protocols for P-FP scheduling , 2013, 2013 IEEE 19th Real-Time and Embedded Technology and Applications Symposium (RTAS).

[12]  Alan Burns,et al.  Applying new scheduling theory to static priority pre-emptive scheduling , 1993, Softw. Eng. J..

[13]  Ragunathan Rajkumar,et al.  Coordinated Task Scheduling, Allocation and Synchronization on Multiprocessors , 2009, 2009 30th IEEE Real-Time Systems Symposium.

[14]  Rolf Ernst,et al.  Response Time Analysis on Multicore ECUs With Shared Resources , 2009, IEEE Transactions on Industrial Informatics.

[15]  James H. Anderson,et al.  Supporting Nested Locking in Multiprocessor Real-Time Systems , 2012, 2012 24th Euromicro Conference on Real-Time Systems.

[16]  James H. Anderson,et al.  Efficient object sharing in quantum-based real-time systems , 1998, Proceedings 19th IEEE Real-Time Systems Symposium (Cat. No.98CB36279).

[17]  Theodore Johnson,et al.  A Prioritized Multiprocessor Spin Lock , 1997, IEEE Trans. Parallel Distributed Syst..

[18]  Theodore P. Baker,et al.  Stack-based scheduling of realtime processes , 1991, Real-Time Systems.

[19]  Evangelos P. Markatos Multiprocessor Synchronization Primitives with Priorities , 1991 .

[20]  K. Harathi,et al.  Interruptible Critical Sections , 1994 .

[21]  Lui Sha,et al.  Priority Inheritance Protocols: An Approach to Real-Time Synchronization , 1990, IEEE Trans. Computers.

[22]  Michael L. Scott,et al.  Algorithms for scalable synchronization on shared-memory multiprocessors , 1991, TOCS.

[23]  Hennadiy Leontyev,et al.  A Flexible Real-Time Locking Protocol for Multiprocessors , 2007, 13th IEEE International Conference on Embedded and Real-Time Computing Systems and Applications (RTCSA 2007).

[24]  James H. Anderson,et al.  Scheduling and locking in multiprocessor real-time operating systems , 2011 .

[25]  Hiroaki Takada,et al.  Predictable spin lock algorithms with preemption , 1994, Proceedings of 11th IEEE Workshop on Real-Time Operating Systems and Software.