![]() |
CISC422/853: Formal Methods in Software Engineering: Computer-Aided Verification (Winter 2009)
Assignment 1 (Bogor)Due: Feb 5, 2009 (in class)
|
Let n be the number of workers. Rule 1. Every worker starts with rank r=0. Rule 2. Every worker with rank r=0 can promote herself to rank r=1. Rule 3. To promote herself from rank r to rank r+1 an worker shall: a) first, record herself as having rank r+1, and then b) record herself as the last worker to have reached rank r+1. Rule 4. Every worker in ranks 0<r<n can promote herself to rank r+1 iff a) she is not last worker to have reached rank r, or b) all other workers have ranks below hers. Rule 5. Workers with rank n are boss; after a finite amount of time they have to demote themselves back to rank 0.Unfortunately, the workers at the cooperative are not entirely sure if these rules ensure a crucial property they have come to value over the years:
thread P(int id) { boolean isHighest; ... loc loc4: isHighest := invoke isHighestProcess(id) goto loc5; loc loc5: when isHighest do { // process id can advance ... }
Rule 3. To promote herself from rank r to rank r+1 an worker shall: a) first, record herself as the last worker to have reached rank r+1, and then b) record herself as having rank r+1.That is, the new Rule 3 is just like the old one except that the order of the steps a) and b) is reversed. Modify your BIR code from Parts a)-d) appropriately to reflect this replacement. Rerun your analyses. How does this modification affect the Single-Boss property?