1 / 8

Exercise I

Implement asynchronous communication between threads in Java using unbounded FIFO buffers. Initialize the buffers. Discuss encapsulation forms and techniques. Define components for merging, replicating, and adding values. Design a connector network for a washing machine interface.

trevinos
Download Presentation

Exercise I

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. Exercise I • Implement in Java asynchronous communication between threads via unbounded FIFO buffers. Provide also a means to initialize these buffers.

  2. Exercise II • Let a Java component be a package with two special static classes IChn and OChn which declare by means of static attributes a collection of input and output channels, respectively. Discuss possible forms of encapsulation and the corresponding techniques to enforce them.

  3. Exercise III • Define a Java component Merger with a class IChn declaring two asynchronous input channels in1, in2, and a class OChn declaring a single asynchronous output channel out. The component reads non-deterministically from the input channels in1 and in2 and outputs these values along its output channel out in the original order.

  4. Exercise IV • Define a Java component Replicator with a class IChn declaring an asynchronous input channel in, and a class OChn declaring two asynchronous output channels out1 and out2. The component sends the value received from its input channel in to both its output channels out1 and out2.

  5. Exercise V • Assume given a Java component Adder that outputs the sum of the values read from its input channels in1 and in2 along its output channel out. Using the above components (except the Merger), construct a component MAIN that builds a network generating the Fibonacci sequence along its output channel fib.

  6. Washing Machine Interface

  7. Behavior of Buttons • Successively pressing the Program button (3) cycles through the following choices: • Cotton; Color; Synthetic; Delicate; Wool; Quick; Rinse & Spin; Spin • Successively pressing the Options button (4) cycles through the following choices: • Eco+; Rinse+; Pre-wash; [no-choice] • Successively pressing the Spin button (5) cycles through the following choices: • No Spin; Rinse & Hold; [no-choice] • Successively pressing the Temp button (6) cycles through 5 different choices for the temperature setting. • Successively pressing the Delay Start button (7) cycles through 25 different choices (1-24 plus 0) for the delay setting. • Pressing the Start (8) button takes the current values of all choices and starts the (Pre-wash, Wash, Rinse, Spin) cycle they specify.

  8. Exercise VI • Design the Reo connector network for the interface of the washing machine as described in the previous slides and the lecture. Explicitly describe every component you use in your design. The simpler and more generic your components are, the better the design (and your grade).

More Related