exercises6-withanswers

exercises6-withanswers - COMP30112: Concurrency Exercises...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: COMP30112: Concurrency Exercises Howard Barringer April 2008 1. Simple example : Write a very simple model of a VCR machine can only do play and stop actions. Model the VCR as a process, VCR , using FSP, and draw the LTS. Answer: VCR = PLAY, PLAY = ( play-> SSTOP ), SSTOP = ( stop-> PLAY ). Notes VCR is an example of an FSP process, whereas PLAY and SSTOP are local FSP processes. They are local to the VCR process Note the process name SSTOP is used instead of STOP. This is because STOP is a reserved local process name which means that there cannot be any more transitions. The action stop may be used as shown. Or by use of substitution you can arrive at a more concise definition of VCR. VCR = (play-> stop-> VCR). References See the SWITCH example in lecture 2 2. Choice : Extend the model of the VCR to include a pause action and draw the LTS. One can only pause after a play action, and it can be followed by either a play action or a stop action. Check that the VCR can perform the actions given by the trace: play -> stop -> play -> pause -> play -> pause -> stop Answer: 1 CS3112 Concurrency Some Exercises VCR = PLAY, PLAY = ( play-> PLAYING ), PLAYING = ( stop-> VCR | pause -> PAUSE ), PAUSE = ( stop-> VCR | play-> PLAYING ). Notes The SSTOP process has been changed to a PLAYING process because you now have an option of either a stop action or a pause action so SSTOP is an inappropriate process name. If stop then you go back to the PLAY state allowing you to play again, If pause you go into a new state PAUSED where you can choose to stop or play . References See the DRINKS example in lecture 2 3. Choice : Draw the LTS for the MICROWAVE FSP process below. What is the alphabet of the process, how many states and transitions are there? MICROWAVE = ( put_food_in-> SETTINGS ), SETTINGS = ( set_heat_level-> set_time-> COOK | set_time-> set_heat_level-> COOK ), COOK = ( cook-> take_food_out-> MICROWAVE ). Answer: 2 CS3112 Concurrency Some Exercises Alphabet: { cook, put food in, set heat level, set time, take food out } States: 6 Transitions: 7 4. Non-determinism : Draw the LTS for the LIBRARY FSP process below. What is the alphabet of the process, how many states and transition are there? LIBRARY = ( take_book_to_desk-> give_details-> take_book->OPTIONS ), OPTIONS = ( renew-> OPTIONS | return_on_time-> LIBRARY | return_late-> FINE ), FINE = ( pay_fine-> LIBRARY | pay_fine-> never_go_back -> STOP ). Answer: Alphabet: { give details, never go back, pay fine, renew, return late, return on tim take book, take book to desk } States: 7 Transitions: 9 3 CS3112 Concurrency Some Exercises Notes The process FINE is non-deterministic since after the action pay fine. it may behave as either LIBRARY or (never go back-> STOP)....
View Full Document

This note was uploaded on 02/08/2012 for the course CSCI 6232 taught by Professor Rotenstreich during the Spring '11 term at GWU.

Page1 / 18

exercises6-withanswers - COMP30112: Concurrency Exercises...

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

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