Homework 3

Create solutions to the following problems:

  1. Question 4.2 of Chapter 4 in the Concurrency Textbook
  2. Here is a solution to problem 2.5 of Chapter 2 in the Concurrency Textbook
    DRINKS = CREDIT[0],
    CREDIT[0] = (in.coin[5]   -> CREDIT[5]
                |in.coin[10]  -> CREDIT[10]
                |in.coin[20]  -> CHANGE[5]
                ),
    CREDIT[5] = (in.coin[5]   -> CREDIT[10]
                |in.coin[10]  -> CHANGE[0]
                |in.coin[20]  -> CHANGE[10]
                ),
    CREDIT[10]= (in.coin[5]   -> CHANGE[0]
                |in.coin[10]  -> CHANGE[5]
                |in.coin[20]  -> CHANGE[15]
                ),
    CHANGE[0]  = (can -> DRINKS),
    CHANGE[5]  = (can -> out.coin[5]  -> DRINKS),
    CHANGE[10] = (can -> out.coin[10] -> DRINKS),
    CHANGE[15] = (can -> out.coin[5]  -> out.coin[10] -> DRINKS).
    Add to this specification a WALLET process and a TEST process that do the following things. The WALLET process should model a wallet that contains 50p and keeps track of how much money it has as its owner removes and adds coins while acquiring cans from the vending machine. The TEST process should be defined like this:
    TEST = TEST[50][0],
    TEST[i: 0 .. 50][n: 0 .. 3] = ...
    It should keep track of the amount of money in the wallet and the number of cans acquired by the owner. If it ever detects that the owner has acquired three cans and has 5p in the wallet, it should emit the action "correct" and then transfer control to the STOP process. List the alphabets of each process and show the output of LTSA when runing its Check→Safety analysis. How does LTSA interpret the situation in which TEST has successfully executed the "correct" action?

Place the FSP specifications that you create for these problems in a PDF or text file and send it to me via e-mail. Do NOT submit .doc, .docx, .odt, or other document formats.

You may NOT work in teams on this assignment. Please write the honor code statement at the top of your submitted assignment. The honor code statement is:

On my honor as a University of Colorado at Boulder student, I have neither given nor received unauthorized assistance on this work.

This homework is due by 11:59 PM on Wednesday, February 25th.

This homework is worth 30 points: 10 points for question 1 and 20 points for question 2.

Kenneth M. Anderson, 2009