Week 2: Introduction

Objective:

  • Work out the alphabets of simple systems.
  • Model simple systems with primitive CSP processes and basic operators.
  • Practice the labelled transition diagrams of processes.
  • Practice FDR scripts and use Probe to check the transitions of processes.
  1. Define the alphabet of:
    1. a telephone that has 12 buttons, a handset and a bell. The handset may be lifted or replaced.

{handset, bell, lifted, replaced, button1, button2, …, button12}

  • a lift system which serves floors 0 to 3 and has an up button on each floor (apart from the top), a down button on each floor (apart from the top), a goto.i button for each floor within the lift, an emergency halt button and also doors which open and close at each floor.

{floor0.up, floor1.up, floor1.down, floor2.up, floor2.down, floor3.down,

goto.0, goto.1, goto.2, goto3,

opendoor, closedoor, halt}

  • Write a CSP description of a server which can take one number and output its square with channels in and out.

S = in?x -> out.(x*x)-> SKIP

  • Write a CSP description of a multiplication component which has three input channels in1, in2, and in3, and one output channel out. It reads in one number from each input channel (in any order) and outputs their product.

P = in1?x ->in2?y ->in3?z ->out!(x*y*z) -> SKIP

  • Write a recursive CSP description of a heater that has four power settings. The switch can be turned at one way only, and please use the events up to model this process.  Then, can you use mutual recursion to describe this process again?

P = up.0 -> up.1 ->up.2 ->up.3 -> P

P0 = up.0 -> P1

P1 = up.1 -> P2

P2 = up.2 -> P3

P3 = up.3 -> P0

Please  draw the labelled transition diagrams for Q5, Q6 and Q7

  • There are three coins contains up to 4 pennies, which may be removed one at a time by the action out1p, until the stack is empty. At any time, the number of coins may be brought up again to its maximum of 4 by the single action refill. Define the process Stack.

If we change the number of the coins to 30, the action is changed to out.m where m is any natural number, can you redesign the transition diagram?    

  • Each customer of a bank first opens an account. He or she then makes any number of deposits and withdrawals, and finally may terminate the account. Let us initially ignore the amount of each deposit or withdrawal, and not worry about whether the account is in credit or debit. Define process Acc0 to model the account; it should have alphabet {open, deposit, withdraw, terminate}.
  • Now extend the alphabet of process Acc0 from Question 6 to include the events deposit.n and withdraw.n, for any natural number n, and also include an event balance.m, for integer m, that returns the balance of the account. An account has balance 0 when opened and may be closed only when it has balance 0.
  1. Define process Acc1 to model the account in which any deposit and withdrawal are allowed (i.e. unlimited credit is allowed).
    1. Define process Acc2 to model the account in which a withdrawal is allowed only if it does not overdraw the account (i.e. no credit is allowed).

Please code the FDR scripts for Question 2 to 4, and use the Probe to check the behaviours.

Q2.csp

channel in:{0..5}

channel out:Int

P = in?x -> out!x*x -> SKIP

Note that if the data type for in is Integer too, the Probe is crashed. But why?

Q3.csp

channel in:{0..5}

channel out:Int

P = in?x ->in?y -> in?z -> out!x*y*z -> SKIP

Q4.csp

channel up:{0..3}

P = up.0 -> up.1 -> up.2 -> up.3 -> P

P0 = up.0 -> P1

P1 = up.1 -> P2

P2 = up.2 -> P3

P3 = up.3 -> P0

All papers are written by ENL (US, UK, AUSTRALIA) writers with vast experience in the field. We perform a quality assessment on all orders before submitting them.

Do you have an urgent order?  We have more than enough writers who will ensure that your order is delivered on time. 

We provide plagiarism reports for all our custom written papers. All papers are written from scratch.

24/7 Customer Support

Contact us anytime, any day, via any means if you need any help. You can use the Live Chat, email, or our provided phone number anytime.

We will not disclose the nature of our services or any information you provide to a third party.

Assignment Help Services
Money-Back Guarantee

Get your money back if your paper is not delivered on time or if your instructions are not followed.

We Guarantee the Best Grades
Assignment Help Services