assignments:a1
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
assignments:a1 [2009/03/09 03:04] – jonathan | assignments:a1 [2009/03/20 04:06] (current) – jonathan | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Assignment 1 ====== | ====== Assignment 1 ====== | ||
+ | Assignment 1 due date:before class on Wednesday March 18th. | ||
+ | |||
+ | The following is a Spin description of a mutual exclusion algorithm using a semaphore variable '' | ||
< | < | ||
Line 9: | Line 12: | ||
int r = 1; /* semaphore */ | int r = 1; /* semaphore */ | ||
- | bit p1, p2; | + | bit p1, p2 = 0; |
active proctype P1() { | active proctype P1() { | ||
do | do | ||
- | :: p1 = 0; | + | :: atomic{r > 0 -> r = 0}; /* request(r)*/ |
- | atomic{r > 0 -> r = 0}; /* request(r)*/ | + | |
p1 = 1; /* critical section */ | p1 = 1; /* critical section */ | ||
+ | p1 = 0; | ||
atomic { r = 1}; / | atomic { r = 1}; / | ||
od | od | ||
Line 23: | Line 26: | ||
active proctype P2() { | active proctype P2() { | ||
do | do | ||
- | :: p2 = 0; | + | :: atomic{r > 0 -> r = 0}; /* request(r)*/ |
- | atomic{r > 0 -> r = 0}; /* request(r)*/ | + | |
p2 = 1; /* critical section */ | p2 = 1; /* critical section */ | ||
+ | p2 = 0; | ||
atomic { r = 1}; / | atomic { r = 1}; / | ||
od | od | ||
} | } | ||
</ | </ | ||
+ | |||
+ | You must come up with an Event-B model for the above program. Prove that your model is safe and deadlock free. | ||
+ | |||
+ | Hint: In Event-B you have to think **events** rather than statements in a coding language. | ||
+ | |||
+ | Submit a Latex hardcopy of your work and a mutex.zip file via electonic submit: | ||
+ | | ||
+ | |||
+ | The zip file can be created from the Rodin export facility (see Rodin Tutorial). |
assignments/a1.1236567881.txt.gz · Last modified: 2009/03/09 03:04 by jonathan