From 6b2502cef7a8cd6944d4989727e90955fa6d8a44 Mon Sep 17 00:00:00 2001 From: carey Date: Wed, 26 Jan 2022 10:49:39 +0000 Subject: [PATCH] update --- .DS_Store | Bin 10244 -> 10244 bytes assessment/.DS_Store | Bin 6148 -> 6148 bytes code/parallel/.DS_Store | Bin 10244 -> 10244 bytes lectures/deadlock.html | 178 ++++++++++++++++++++++++++++++++++++++++ lectures/deadlock.org | 57 +++++++++++++ 5 files changed, 235 insertions(+) create mode 100755 lectures/deadlock.html create mode 100755 lectures/deadlock.org diff --git a/.DS_Store b/.DS_Store index ea8c9d10ec7f27aafc85e6f3f5d308814aad6b74..0fd94af401da1027eeec76159e4eeda767816ff4 100644 GIT binary patch delta 378 zcmZn(XbIS$FEIIzU>Uoav5tbVk@@6EA^XWHf})!R1&x`&5{4iN6GO0sfQYNMkhDy^ zfN)Y`a&~%AeraBcbAC>KkyB1-YPh`iFxU%PL;7aiAkwB{&`OMB_;W}1LZVdCII^-WU2rF delta 472 zcmZn(XbIS$FTi+m@&lO$O^NDiBV#ii1!E(lS{;RI3u7Z41ruX~+FDKyaaBWG&xG8{ zs_L5Bx|x%^WaSxWO%@Q8*d%Do#CQUvTSL6M+SJHgN5R4rujUzG%`+#z5%y4$l9GuR z5Kc-=&Q34NFU?DF&d^-9jmS*S&kN41N}U`pvdbf0fWJ5+zuXfj7EqL0mYG@} zonDlg5?qj&oSB!dZ2y4)43r%LUD?3~v~|F|sgfZdGMS^)^gWzU%j=%f>{&XH5 delta 97 zcmZoMXffEJ%EEYZ@+{T{Pl@VkBV#ii1!E(lS{;RI3u7Z41ruX~+FDKyaaBWG&xG8{ hs_L5Bx|s}Mz{m)p8Tg?zjGDFi9*YF?W_FIh`~aZB6v+Sp diff --git a/code/parallel/.DS_Store b/code/parallel/.DS_Store index dc3fc4d26cf19e4afed0834eca57ac6b5ea9292c..f832b9d4e84b5b95faa3be3106e4a4af52e1e9da 100755 GIT binary patch delta 356 zcmZn(XbG6$C7U^hRb%47jShs{0$(M;;R47m)64A~5+3~3CR3^_nLo*@ND<}&0b zl@}Kz<>V(ZFfi<#{7i)FHaSnKAU!gWjl3Zqqo delta 42 ycmZn(XbG6$&nUMsU^hRb+++bkhs{0$(M+35L?&}@Y&grfnO)%*%jR=p%*+5X1`a*| 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