WINGERT a Thread Migrating OS for Real-Time Applications
Total Page:16
File Type:pdf, Size:1020Kb
WAMOS @ HSRM Wiesbaden 2014-02-13 A. Zuepke WINGERT A Thread Migrating OS for Real-Time Applications Alexander Züpke [email protected] WAMOS @ HSRM Wiesbaden 2014-02-13 About Me A. Zuepke Alexander Züpke 1999 – 2003: Diploma in Computer Engineering University of Applied Sciences Gelsenkirchen 2003 – now: Kernel Hacker on PikeOS SYSGO AG, Klein-Winternheim 2012 – now: PhD Student RheinMain University of Applied Sciences Wiesbaden 2 WAMOS @ HSRM Wiesbaden 2014-02-13 Wingert A. Zuepke Win·gert m., Pl: Win·ger·te German word in Rhine-Hessian dialect for a vineyard derived from the Middle High German word wîngarte (wine garden) 3 WAMOS @ HSRM Wiesbaden 2014-02-13 Wingert OS A. Zuepke WIesbaden Next Generation Experimental Real-Time Operating System … or: WINGERT Is a New Great Experimental Real-Time Operating System 4 WAMOS @ HSRM Wiesbaden 2014-02-13 Outline A. Zuepke ● Motivation ● System Architecture ● Various Use Cases of Thread Migration ● Resource Management ● Futexes and Locking ● Current Status of the Implementation ● Conclusion ● Outlook 5 WAMOS @ HSRM Wiesbaden 2014-02-13 Motivation A. Zuepke Safety Critical Systems … 6 WAMOS @ HSRM Wiesbaden 2014-02-13 A. Zuepke 7 WAMOS @ HSRM Wiesbaden 2014-02-13 A. Zuepke 8 WAMOS @ HSRM Wiesbaden 2014-02-13 Motivation A. Zuepke Safety requirements for shared resources ● IEC 61508 “An E/E/PE* safety-related system will usually implement more than one safety function. If the safety integrity requirements for these safety functions differ, unless there is sufficient independence of implementation between them, the requirements applicable to the highest relevant safety integrity level shall apply to the entire E/E/PE safety-related system.” ● ISO 26262 “Freedom of interference” * E/E/PE: electrical / electronic / programmable electronic 9 WAMOS @ HSRM Wiesbaden 2014-02-13 Motivation A. Zuepke Mixed-criticality system Separation by Partitioning ARINC 653: P1 P2 P3 P4 – Spatial Partitioning most less least – Time Partitioning critical critical critical critical user mode supervisor mode OS Kernel 10 WAMOS @ HSRM Wiesbaden 2014-02-13 Motivation A. Zuepke Own Experience: Micro kernels are nice, but building reliable systems with them is still too painful! Lots of engineering challenges: – bounded WCET when Linux runs on top? – independent analyses of partitions? – more threads + more synchronization = more safety? 11 WAMOS @ HSRM Wiesbaden 2014-02-13 System Architecture A. Zuepke ● Design Choices – Hierarchical system design – Small TCB – Minimalistic kernel P1 P2 P3 P4 ● Address spaces most less least ● Threads critical critical critical critical ● Capabilities shared driver 2 ● Resource partitioning ● Preemptive kernel shared driver 1 ● State of the art scheduling OS Kernel – Thread migration 12 WAMOS @ HSRM Wiesbaden 2014-02-13 A. Zuepke Thread Migration 13 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke ● Definition of “thread migration” in literature – a client lends its thread to the server – the server is a passive entity ● Examples P1 P2 P3 P4 – Mach (Ford) – Sun's Spring – Pebble – Composite – … OS Kernel 14 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke Decompose a thread into Body and Soul: ● Body: user part of a thread Body – register context ● Entry point ● User Stack – user stack ● TLS ● Soul: kernel part of a thread – scheduling attributes – kernel stack Soul Ghost: soul without a body ● Priority ● Deadline initial state ● Kernel Stack idle threads 15 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke Decompose a thread into Body and Soul: ● Body: user part of a thread Body – register context ● Entry point ● User Stack – user stack ● TLS ● Soul: kernel part of a thread – scheduling attributes – kernel stack Soul ● Ghost: soul without a body ● Priority ● Deadline – initial state ● Kernel Stack – idle threads 16 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke Synchronous call and return operations: – a soul migrates back and forth between bodies – forms a call chain active body free body soul 17 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke Synchronous call and return operations: – a soul migrates back and forth between bodies – forms a call chain occupied body active body free body call soul 18 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke Synchronous call and return operations: – a soul migrates back and forth between bodies – forms a call chain occupied body active body call 19 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke Synchronous call and return operations: – a soul migrates back and forth between bodies – forms a call chain occupied body active body free body return 20 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke Synchronous call and return operations: – a soul migrates back and forth between bodies – forms a call chain active body free body return 21 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke The forward operation: – to call another body – without keeping the caller occupied 22 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke The forward operation: – to call another body – without keeping the caller occupied ll ca 23 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke The forward operation: – to call another body – without keeping the caller occupied ard forw 24 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke The forward operation: – to call another body – without keeping the caller occupied 25 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke The forward operation: – to call another body – without keeping the caller occupied r eturn 26 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke Asynchronous fork / join operations: – fork: tell an idle soul to call a body – join: asynchronous call returns fork go for It! 27 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke Asynchronous fork / join operations: – fork: tell an idle soul to call a body – join: asynchronous call returns call 28 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke Asynchronous fork / join operations: – fork: tell an idle soul to call a body – join: asynchronous call returns 29 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke Asynchronous fork / join operations: – fork: tell an idle soul to call a body – join: asynchronous call returns return 30 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke Asynchronous fork / join operations: – fork: tell an idle soul to call a body – join: asynchronous call returns I'm done! join 31 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke Signals and Exception Handling: ● Exceptions – implicitly turn exceptions into calls to exception-handlers – pass faulting register context to called body Exception Handler Signals Faulter signal delivery: force a soul c a l l into a (non-voluntary) call software raised exception 32 WAMOS @ HSRM Wiesbaden 2014-02-13 Thread Migration A. Zuepke Signals and Exception Handling: ● Exceptions – implicitly turn exceptions into calls to exception-handlers – pass faulting register context to called body Exception Handler ● Signals Faulter – signal delivery: force a soul c a l l into a (non-voluntary) call – fo software raised exception rce ex c. Other 33 WAMOS @ HSRM Wiesbaden 2014-02-13 Concurrent Access A. Zuepke ● Two souls want to enter the same body … – First come, first serve! The other soul has to wait. – Entry wait queue Q – FIFO or priority ordering – Priority inheritance call Q 34 WAMOS @ HSRM Wiesbaden 2014-02-13 Concurrent Access A. Zuepke ● Two souls want to enter the same body … – First come, first serve! The other soul has to wait. – Entry wait queue Q – FIFO or priority ordering – Priority inheritance Q 35 WAMOS @ HSRM Wiesbaden 2014-02-13 Concurrent Access A. Zuepke ● Two souls want to enter the same body … – First come, first serve! The other soul has to wait. – Entry wait queue Q – FIFO or priority ordering – Priority inheritance call Q 36 WAMOS @ HSRM Wiesbaden 2014-02-13 Concurrent Access A. Zuepke ● Two souls want to enter the same body … – First come, first serve! The other soul has to wait. – Entry wait queue Q – FIFO or priority ordering – Priority inheritance Q waiting 37 WAMOS @ HSRM Wiesbaden 2014-02-13 Concurrent Access A. Zuepke ● Two souls want to enter the same body … – First come, first serve! The other soul has to wait. – Entry wait queue Q – FIFO or priority ordering – Priority inheritance rn Q retu waiting 38 WAMOS @ HSRM Wiesbaden 2014-02-13 Concurrent Access A. Zuepke ● Two souls want to enter the same body … – First come, first serve! The other soul has to wait. – Entry wait queue Q – FIFO or priority ordering – Priority inheritance Q 39 WAMOS @ HSRM Wiesbaden 2014-02-13 Parking Souls A. Zuepke ● The Parking Lot: – a place where souls can rest outside the body – parking: put the currently active soul in P – unparking: move a parked soul from P to Q – the parking queue P is an unsorted queue P Q 40 WAMOS @ HSRM Wiesbaden 2014-02-13 Parking Souls A. Zuepke ● The Parking Lot: – a place where souls can rest outside the body – parking: put the currently active soul in P – unparking: move a parked soul from P to Q – the parking queue P is an unsorted queue park P Q 41 WAMOS @ HSRM Wiesbaden 2014-02-13 Parking Souls A. Zuepke ● The Parking Lot: – a place where souls can rest outside the body – parking: put the currently active soul in P – unparking: move a parked soul from P to Q – the parking queue P is an unsorted queue call P Q 42 WAMOS @ HSRM Wiesbaden 2014-02-13 Parking Souls A. Zuepke ● The Parking Lot: – a place where souls can rest outside the body – parking: put the currently active soul in P – unparking: move a parked soul from P to Q – the parking queue P is an unsorted queue unpark P Q 43 WAMOS @ HSRM Wiesbaden 2014-02-13 Parking Souls A.