L12a.sp11 - Mutual Exclusion in Shared Memory Slides...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Mutual Exclusion in Shared Memory Slides provided by Prof. Jennifer Welch
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Shared Memory Model Processors communicate via a set of shared variables, instead of passing messages. Each shared variable has a type , defining a set of operations that can be performed atomically .
Background image of page 2
3 Shared Memory Model Example p 0 p 1 p 2 X Y read write write read
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Shared Memory Model Changes to the model from the message-passing case: no inbuf and outbuf state components configuration includes a value for each shared variable only event type is a computation step by a processor An execution is admissible if every processor takes an infinite number of steps
Background image of page 4
5 Computation Step in Shared Memory Model • When processor p i takes a step: pi 's state in old configuration specifies whch shared variable is to be accessed and with which operation operation is done: shared variable's value in the new configuration changes according to the operation's semantics p i 's state in new configuration changes according to its old state and the result of the operation
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Observations on SM Model Accesses to the shared variables are modeled as occurring instantaneously (atomically) during a computation step, one access per step Definition of admissible execution implies asynchronous no failures
Background image of page 6
7 Each processor's code is divided into four sections: entry: synchronize with others to ensure mutually exclusive access to the … critical: use some resource; when done, enter the… exit: clean up; when done, enter the… remainder: not interested in using the resource Mutual Exclusion (Mutex) Problem entry critical exit remainder
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Mutual Exclusion Algorithms A mutual exclusion algorithm specifies code for entry and exit sections to ensure: mutual exclusion: at most one processor is in its critical section at any time, and some kind of "liveness" or "progress" condition. There are three commonly considered ones…
Background image of page 8
Mutex Progress Conditions no deadlock: if a processor is in its entry section at some time, then later some processor is in its critical section no lockout: if a processor is in its entry section at some time, then later the same processor is in its critical section bounded waiting: no lockout + while a processor is in its entry section, other processors enter the critical section no more than a certain number of times. These conditions are increasingly strong.
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 37

L12a.sp11 - Mutual Exclusion in Shared Memory Slides...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online