Based on Chapter 4 of [Hai19]
(Usage hints for this presentation)
Computer Structures and Operating Systems 2023
Dr. Jens Lechtenbörger (License Information)
(Short answer: No. Issues such as priority inversion, deadlocks, starvation may arise.)
See previous slide or notes for explanations
See earlier slide or notes for explanations
See previous slide for explanations
Robotic spacecraft named Pathfinder
“Sojourner Rover” by NASA under Public domain; from Wikimedia Commons
This task is a variant of Exercise 4.10 of [Hai19]. Solve part (1) as self-study in Learnweb. Another variant as exercise task.
High-priority thread: “initially blocked; unblocked to handle event after 200 milliseconds” perform lock() on mutex run for 2 milliseconds on CPU perform unlock() on mutex terminate execution of the whole program Medium-priority thread: “initially blocked; unblocked to handle event after 200 milliseconds” run for 500 milliseconds on CPU Low-priority thread: “initially runnable” perform lock() on mutex perform I/O operation which leads to blocking for 600 milliseconds run for 3 milliseconds on CPU perform unlock() on mutex
Permanent blocking of thread set
“Gridlock” by Interiot~commonswiki and Jeanacoa under CC BY-SA 2.5 Generic; from Wikimedia Commons
myAccount
to yourAccount
by thread 1; transfer in
other direction by thread 2myAccount
, while thread 2 locks yourAccount
Deadlock if and only if (1) – (4) hold [CES71]:
Visualization of deadlock: cyclic resource allocation graph for previous example
Figure 4.22 of [Hai17]
Figure by Max Hailperin under CC BY-SA 3.0; converted from GitHub
(Note: Choice of shapes is arbitrary; just for visualization purposes)
These strategies are covered in subsequent slides.
(Refresh HTML presentation for other drawings)
Practical options
myAccount
has number 42, yourAccount
is 4711
myAccount
first (as 42 < 4711)
yourAccount
unlock()
lock()
M repeatedly during its time slice
Dining Philosophers
“Figure 4.20 of [Hai17]” by Max Hailperin under CC BY-SA 3.0; converted from GitHub
Starvation of P0
“Figure 4.20 of [Hai17]” by Max Hailperin under CC BY-SA 3.0; converted from GitHub
This document is part of an Open Educational Resource (OER) course on Operating Systems. Source code and source files are available on GitLab under free licenses.
Except where otherwise noted, the work “OS07: MX Challenges”, © 2017-2023 Jens Lechtenbörger, is published under the Creative Commons license CC BY-SA 4.0.
In particular, trademark rights are not licensed under this license. Thus, rights concerning third party logos (e.g., on the title slide) and other (trade-) marks (e.g., “Creative Commons” itself) remain with their respective holders.