- Page 1 and 2: Concurrent Systems II (CS3D4/CS3BA2
- Page 3 and 4: POSIX Threads • POSIX Threads aka
- Page 5 and 6: Six Separate Threads Master Thread
- Page 7 and 8: Where… • ‘thread’ is the ID
- Page 9 and 10: Hello World -- Creating Threads int
- Page 11 and 12: Hello World -- Thread Function void
- Page 13 and 14: Wilde/Stoker/Ubuntu h-3.1$ cc -lpth
- Page 15 and 16: Interaction • No thread interacti
- Page 17 and 18: Interactions & Dependencies • Int
- Page 19 and 20: …to do Parallel Programming • H
- Page 21 and 22: Hardware Main Memory Level 2 Cache
- Page 23 and 24: Shared Memory Machine • Each proc
- Page 25: Concurrent Program • A Concurrent
- Page 29 and 30: 1 - Flow Dependence S1: write to lo
- Page 31 and 32: 3 - Output Dependence S1: write to
- Page 33 and 34: Dependence in Loops j k k i 1 2 j 5
- Page 35 and 36: How can we transform it? • We can
- Page 37 and 38: Issues: • The variable sum, as wr
- Page 39 and 40: Summarising: • We could paralleli
- Page 41 and 42: Example • Sample function: y = 0.
- Page 43 and 44: Synchronisation • We’ve looked
- Page 45 and 46: Shared Variable S: Thread 1 after T
- Page 47 and 48: Mutual Exclusion in pthreads. • M
- Page 49 and 50: Shared Variable S Protected by Mute
- Page 51 and 52: Lock and Unlock Mutex • pthread_m
- Page 53 and 54: } /********** Critical Section ****
- Page 55 and 56: Problem Tutorial • The transpose
- Page 57 and 58: Producers and Consumers • Essenti
- Page 59 and 60: Condition Variables (2) • Dramati
- Page 61 and 62: From Thread U’s POV (2) • If C
- Page 63 and 64: From Thread U’s POV (4) • Acqui
- Page 65 and 66: Thread S (2) • Acquire Mutex M
- Page 67 and 68: Semaphores • Computer Semaphores
- Page 69 and 70: Semaphore Consumer ◾Acquire Mutex
- Page 71 and 72: Semaphores (3) • Useful for count
- Page 73 and 74: Sample Solution for ∏ • Calcula
- Page 75 and 76: unsigned long long clock_cycles() {
- Page 77 and 78:
The Challenge of Concurrency • Co
- Page 79 and 80:
Concurrent Execution • A concurre
- Page 81 and 82:
Notation Trivial Concurrent Program
- Page 83 and 84:
Trivial Concurrent Program p1: n
- Page 85 and 86:
Example — Jumping Frogs • A fro
- Page 87 and 88:
If the frogs can only move “forwa
- Page 89 and 90:
State Diagrams for Processes • A
- Page 91 and 92:
Book Reference Principles of concur
- Page 93 and 94:
Correctness • (Correctness in Seq
- Page 95 and 96:
Using State machines • We can des
- Page 97 and 98:
The Critical Section Problem (2)
- Page 99 and 100:
Observations & Implications • Rem
- Page 101 and 102:
Simplify Critical Section Problem i
- Page 103 and 104:
State Transitions r1,s1,1 r1: await
- Page 105 and 106:
Deadlock Free? • Deadlock Free: I
- Page 107 and 108:
Scorecard Mutual Exclusion Deadlock
- Page 109 and 110:
Attempt #2 Critical Section Problem
- Page 111 and 112:
Attempt #2 Fails… • Attempt 2 f
- Page 113 and 114:
Attempt #3 Critical Section Problem
- Page 115 and 116:
Attempt #3 Fails… • Attempt 3 f
- Page 117 and 118:
Attempt #4 loop forever Critical Se
- Page 119 and 120:
Attempt #4 Fails… • Attempt 3 f
- Page 121 and 122:
Attempt #5, derived from #4 Critica
- Page 123 and 124:
Verification of concurrent programs
- Page 125 and 126:
A quick overview of some mathematic
- Page 127 and 128:
A quick overview of some mathematic
- Page 129 and 130:
Proving correctness by induction
- Page 131 and 132:
A quick overview of some temporal l
- Page 133 and 134:
A quick overview of some temporal l
- Page 135 and 136:
Temporal logic at work • Consider
- Page 137 and 138:
Promela • Promela [Protocol/Proce
- Page 139 and 140:
Process (2) • A process type (pro
- Page 141 and 142:
SPIN Hello World Example SPIN = Sim
- Page 143 and 144:
Promela Variables (2) • Arrays
- Page 145 and 146:
Statements (2) • The skip stateme
- Page 147 and 148:
If Statement if :: (n % 2 != 0) ->
- Page 149 and 150:
Atomic Statement atomic { stat1; st
- Page 151 and 152:
Process Execution / Evaluation Sema
- Page 153 and 154:
The Closed World Assumption • The
- Page 155 and 156:
Process memory management • In a
- Page 157 and 158:
Virtual memory • Give each proces
- Page 159 and 160:
Virtual memory 0 0 process 1 2 32 0
- Page 161 and 162:
Memory management requirements and
- Page 163 and 164:
E.g. Virtual memory implementation
- Page 165 and 166:
Multi-level page tables Virtual add
- Page 167 and 168:
Typical process memory layout memor
- Page 169 and 170:
Translation look aside buffer • E
- Page 171 and 172:
Page fault handling Start Access pa
- Page 173 and 174:
Fetch policy • When should a page
- Page 175 and 176:
Page replacement policy • A page
- Page 177 and 178:
Page replacement policy • First-I
- Page 179 and 180:
Clock Algorithm 179 Trinity College
- Page 181 and 182:
Resident set management • Variabl
- Page 183 and 184:
Resident set management Local Repla
- Page 185 and 186:
Resident set management Δ Working
- Page 187 and 188:
Resident set management 187 Trinity
- Page 189 and 190:
Cleaning policy • Page buffering
- Page 191 and 192:
Load control • We can use a few d
- Page 193 and 194:
Process state transitions • Proce
- Page 195 and 196:
Preemptive and nonpreemptive schedu
- Page 197 and 198:
Scheduling algorithms • First-Com
- Page 199 and 200:
Scheduling algorithms • Shortest-
- Page 201 and 202:
Scheduling algorithms • Priority
- Page 203 and 204:
Scheduling algorithms • Round-Rob
- Page 205 and 206:
Example Process Arrival Time Next B
- Page 207 and 208:
Scheduling algorithms • Multi-lev
- Page 209 and 210:
Scheduling algorithms • Multi-lev
- Page 211 and 212:
Multi-processor scheduling • Flyn
- Page 213 and 214:
Layered file I/O (1) Application Di
- Page 215 and 216:
Disk access • Disks are slow ◾
- Page 217 and 218:
Disk scheduling • So, the order i
- Page 219 and 220:
Disk scheduling algorithms (2) •