Skip to content

Instantly share code, notes, and snippets.

@Floofies
Last active November 26, 2019 18:50
Show Gist options
  • Save Floofies/1a705bf2e4a42d2d226393019468448c to your computer and use it in GitHub Desktop.
Save Floofies/1a705bf2e4a42d2d226393019468448c to your computer and use it in GitHub Desktop.
Voluntary Preemptive Multitasking section for Wikipedia
=== Voluntary Preemption ===
Voluntary Preemption is most simply described as a hybrid combination of both cooperative multitasking and preemptive multitasking.
Voluntary Preemption is implemented via a source code compilation technique whereby a source-to-source compiler implements an analogue to preemption via the automatic insertion of cooperative yields; such a compiler produces newly re-entrant programs which effectively replicate the behavior of preemption.<ref>{{cite journal |author-first1=Abha |author-last1=Moitra |title=Voluntary Preemption: A Tool In The Design Of Hard Real-Time Systems |journal=International Symposium on Formal Techniques in Real-Time and Fault-Tolerant Systems, Second International Symposium Nijmegen, The Netherlands, January 8–10, 1992 Proceedings |pages=87–106}}</ref>
To implement Preemptive Multitasking via Voluntary Preemption, a compiler analyzes source code using a process calculus algorithm which predicts the amount of time a process will control the processor; locations in the source code at which the given time slice quantum is met or exceeded are the points at which control of the processor should be yielded.
In Abha Moitra's journal<ref>{{cite journal |author-first1=Abha |author-last1=Moitra |title=Voluntary Preemption: A Tool In The Design Of Hard Real-Time Systems |journal=International Symposium on Formal Techniques in Real-Time and Fault-Tolerant Systems, Second International Symposium Nijmegen, The Netherlands, January 8–10, 1992 Proceedings |pages=87–106}}</ref> a process calculus algorithm Split is proposed with which a compiler may analyze source code. The Split algorithm ascertains the points at which a process will control the processor as its running time reaches a pre-determined time slice quantum. When the running time of a process has been ascertained to exceed or match the time slice quantum, the source code is bisected at that point and a cooperative yield or scheduler control point is inserted there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment