1 / 3

HW7: Due Dec 17th 23:59

HW7: Due Dec 17th 23:59. /* Assume that there are two processes */ char count=0,x=0,y=0,z=0; void process() { char me=_ pid +1; /* me is 1 or 2*/ Try: x= me; if (y ==0 || y== me) ; else goto Try ; z =me; i f ( x == me) ; else goto Try; y =me ; if(z ==me);

ronny
Download Presentation

HW7: Due Dec 17th 23:59

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. HW7: Due Dec 17th 23:59 • /* Assume that there are two processes */ • char count=0,x=0,y=0,z=0; • void process() { • char me=_pid +1; /* me is 1 or 2*/ • Try: • x= me; • if (y ==0 || y== me) ; • else gotoTry; • z=me; • if (x == me) ; • else goto Try; • y=me; • if(z==me); • else goto Try; • /* enter a critical section */ • count++; • InCritSec: … • count --; • /* leaving a critical section */ • goto Try; • } • To specify a corresponding Promela specification • Note that no atomic allowed • To specify the following properties in LTL • Note that procname[pid]@label returns a nonzero value only if a statement at the correonding label is executable now • Mutual exclusion • Deadlock-freedom • Starvation-freedom • Check whether your Promela spec satisfies the above three properties by using Spin. Also explain the counter examples.

  2. 2. Build the following mutual exclusion protocol in Promela. - Your Promela spec should contain 2 processes. - You should use a global lock with atomic keyword to check entrance to the critical section. - Verify the following correctness properties of your Promela model • Mutual exclusion • Liveness mtype ={n,t,c} byte lock=0; active [2] proctype process() { byte status=n; … }

  3. 2. Build the following mutual exclusion protocol in Promela. And verify the correctness of your Promela model • Mutual exclusion • Liveness • You may use a global variable turn to indicate which process has a higher priority to enter critical section • Note that you can access a local variable of the other processes through remote reference procname[pid]:localvar mtype={n,t,c}; byte lock; byte turn=255; active [2] proctype process() { … }

More Related