diff --git a/.DS_Store b/.DS_Store index ea8c9d1..0fd94af 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/assessment/.DS_Store b/assessment/.DS_Store index fc41d7b..90ed229 100644 Binary files a/assessment/.DS_Store and b/assessment/.DS_Store differ diff --git a/code/parallel/.DS_Store b/code/parallel/.DS_Store index dc3fc4d..f832b9d 100755 Binary files a/code/parallel/.DS_Store and b/code/parallel/.DS_Store differ diff --git a/lectures/deadlock.html b/lectures/deadlock.html new file mode 100755 index 0000000..4fdf8c8 --- /dev/null +++ b/lectures/deadlock.html @@ -0,0 +1,178 @@ + + + + +Deadlock + + + + + + + + + + + + +
+
+

Deadlock

Dr Carey Pridgeon

Created: 2021-01-26 Tue 15:46

+
+
+
+

Deadlock

+
+
+
+
+
+
+

Deadlock

+
    +
  • What Deadlock is and how to avoid it.
  • + +
+
+
+
+
+

+
    +
  • This occurs when two or more threads need more than one shared resource in +order to complete a task.
  • + +
+ +
+

deadlock.png +

+
+
+
+
+
+

+
    +
  • Unless access to these resources is strictly controlled by means of careful +program design, deadlock can easily happen.
  • + +
+
+
+
+
+

Preventative measures

+
    +
  • Condition Variables +
      +
    • By introducing an extra layer of control, being imposing order of access +rather than simply granting of access, Condition variables can go some way in +prevention of deadlock.
    • + +
  • +
  • They can also, if used correctly, be used to release resources if held for too +long without a complete set of requirements (all required resources) being +met. This is complex to code, and not something we can cover.
  • + +
+
+
+
+
+

Curative Measures

+
    +
  • Here we have two options
  • +
  • Deadlock Breaking Algorithms +
      +
    • These act after the system in question has been in a state of deadlock for a +set period of time, typically numbered in milliseconds or less. It works by forcing +all resource gathering threads to let go of all of their resources and start +again. Essentially a soft reset.
    • + +
  • +
  • Redundant System +
      +
    • The second option, cheaper and becoming more common as hardware gets cheaper, +is to emplace a duplicate system, running in parallel and ready to take over +if the first system locks up.
    • + +
  • + +
+ + + +
+
+
+
+

Obligatory XKCD

+ +
+

travelling_salesman_problem.png +

+
+ +
+
+
+
+ + + + + + diff --git a/lectures/deadlock.org b/lectures/deadlock.org new file mode 100755 index 0000000..229d3e4 --- /dev/null +++ b/lectures/deadlock.org @@ -0,0 +1,57 @@ +#+TITLE: Deadlock +#+AUTHOR: Dr Carey Pridgeon +#+EMAIL: ab0475@coventry.ac.uk +* setup :noexport: +#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:t reveal_control:t +#+OPTIONS: reveal_mathjax:t reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil +#+OPTIONS: reveal_width:1200 reveal_height:800 +#+OPTIONS: toc:nil num:nil H:2 ^:{} +#+REVEAL_MARGIN: 0.2 +#+REVEAL_MIN_SCALE: 0.5 +#+REVEAL_MAX_SCALE: 2.5 +#+REVEAL_TRANS: none +#+REVEAL_THEME: night +#+REVEAL_HLEVEL: 999 +#+REVEAL_EXTRA_CSS: ../css/presentation.css +#+REVEAL_ROOT: https://cdn.jsdelivr.net/reveal.js/3.0.0/ +#+STARTUP: showeverything +# Licenced under Creative Commons Attribution-ShareAlike 4.0 +# International by Dr Carey Pridgeon 2021 +* Deadlock +** Deadlock +- What Deadlock is and how to avoid it. +** +- This occurs when two or more threads need more than one shared resource in + order to complete a task. +[[file:img/deadlock.png]] +** +- Unless access to these resources is strictly controlled by means of careful + program design, deadlock can easily happen. +** Preventative measures +- *Condition Variables* + - By introducing an extra layer of control, being imposing order of access + rather than simply granting of access, Condition variables can go some way in + prevention of deadlock. +- They can also, if used correctly, be used to release resources if held for too + long without a complete set of requirements (all required resources) being + met. This is complex to code, and not something we can cover. +** Curative Measures +- Here we have two options +- *Deadlock Breaking Algorithms* + - These act after the system in question has been in a state of deadlock for a + set period of time, typically numbered in milliseconds or less. It works by forcing + all resource gathering threads to let go of all of their resources and start + again. Essentially a soft reset. +- *Redundant System* + - The second option, cheaper and becoming more common as hardware gets cheaper, + is to emplace a duplicate system, running in parallel and ready to take over + if the first system locks up. + + + +** Obligatory XKCD +file:img/travelling_salesman_problem.png +- Copyright: Randall Munroe +- Mirrored to avoid bandwidth stealing +- This Lecture is Licensed under [[https://creativecommons.org/licenses/by-sa/4.0/][Creative Commons Attribution-ShareAlike 4.0 International]] +- By Dr Carey Pridgeon Coventry University, UK, 2021