Lecture 14: Pthreads Mutex and Condition Variables

Lecture 14: Pthreads Mutex and Condition Variables
1 / 1
Lecture 14: Pthreads Mutex and Condition Variables - slide 1 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 2 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 3 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 4 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 5 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 6 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 7 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 8 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 9 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 10 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 11 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 12 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 13 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 14 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 15 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 16 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 17 of 18 Lecture 14: Pthreads Mutex and Condition Variables - slide 18 of 18
Lecture 14: Pthreads Mutex and Condition Variables 1 Review: Mutual Exclusion 2 Software solution Disabling interrupts Strict alternation Petersons solution Hardware solution TSLXCHG Semaphore 3 Review: Semaphore Implementation down(S):

Related Topics

Download this presentation From Below

"Lecture 14: Pthreads Mutex and Condition Variables" is the property of its rightful owner. Permission is granted to download and print the materials on this website for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

Presentation Transcript

01
Lecture 14: Pthreads Mutex and Condition Variables 1<br>
02
Review: Mutual Exclusion 2 Software solution
Disabling interrupts
Strict alternation
Peterson’s solution
Hardware solution
TSL/XCHG
Semaphore<br>
03
3 Review: Semaphore Implementation down(&S):
If (S=0) then
Suspend thread, put into a waiting queue
Schedule another thread to run
Else decrement S and return

up(&S):
Increment S
If any threads in waiting queue, then
release one of them (make it ‘ready’)

Both the above are done atomically
by disabling interrupts
by TSL/XCHG<br>