CS333 Lab T-1:
Configuring Asynchronous Systems
Goals of this lab:
- Help you get started using Playground.
- Teach about graphical connection management in Playground.
- Introduce basic concepts of asynchronous distributed systems.
Introduction:
An asynchronous distributed system consists of a set of
processors that run at their own speeds, do not share a common clock,
do not have synchronized clocks, and do not share any memory. All
communication among the processors occurs by message-passing, and there
is no predictable upper bound on the time it takes for the communication
network to deliver a message.
With The Programmers' Playground, we construct distributed
applications from collections of modules running on
possibly different processors. Each module has an
an external data interface called the presentation
through which it interacts with its environment (the
outside world).
Communication among Playground modules is established by a
configuration consisting of logical connections
among the presentation items of different modules. If a module
writes a value into one of its presentation entries, then the value is sent to
each connected module in accordance with the logical configuration and the
presentation entries at those modules are updated accordingly. The
configuration is dynamic, meaning that logical connections
may be added and removed while the modules are running.
Directions:
Read over the entire assignment before starting.
Then, follow the instructions step by step.
- Getting Started:
As a first-time Playground user, you should
follow the set-up instructions before
proceeding with Step 2.
- Starting the Connection Manager:
At the beginning of each Playground session, you will start up a
Playground connection manager graphical interface.
If you haven't already done so,
- Create an xterm window.
- In the other xterm window, type PGcmgui to start up the connection
manager front-end.
An empty window should pop up on your screen. It is empty because you have no other
Playground modules running.
- Starting Some Playground Modules:
In order to experiment with configurations, you need to start up some Playground modules.
We have provided several Playground modules that do some simple calculations.
Create several more xterm windows (possibly running on various machines).
Start each of the following Playground applications running by typing their names in
different xterm windows.
- counter
- This module has one input/output presentation entry that is
incremented approximately once per second.
- consumer
- This module has one input
presentation item. It just prints the value of the variable to
the terminal whenever the value is changed externally.
- constant
- This module reads let's you enter non-negative integer values
and stores them into a single output presentation variable.
- square
- This module has one input presentation variables in and
one output presentation variable out,
both integers. Whenever the input is changed externally, the
output value is updated to be the square the input.
- product
- This module has two input presentation variables i1 and
i2, and one output presentation variable out,
all integers. Whenever the input numbers are changed externally, the
output value is updated to be the product of the inputs.
- Configuration:
At this point, you should see boxes in the graphical connection
manager front-end corresponding to the modules you started up in Step
3. Notice that each module has a name and one or more presentation
entries. However, nothing interesting will happen until logical
connections are established so that the modules can begin
communicating with each other.
To create a logical connection in the connection manager user
interface, just drag an arrow from the output port (circle) at the
presentation entry of one module to the name of the presentation entry
of the other module while holding the left mouse button. A
bidirectional connection is created the same way, but the middle mouse
button is held. To delete a connection, pick on the connection line
with the right mouse button. Modules may be repositioned on the
display by dragging, and may be rotated by clicking on their names.
Complete each of the following configuration exercises. Keep lab
notes that describe what you did and what happened to the next
class. (You will hand in all of your notes, including anything that
didn't go as you had expected.)
- Create a connection from the counter to the consumer.
Look at the shell in which the consumer is running.
Write down what is happening. Now delete the connection and
write down what happens. Try putting it back again.
Does computation continue even when there are no connections?
- Create a connection from the constant to the counter.
Enter a number into the constant module. (To edit the number,
double click on it. Then you'll see a blinking edit cursor for
editing the usual way.
To unselect stop editing the number,
press return or click elsewhere in the window.)
What happens in the consumer shell? Offer an explanation.
- Using the square module, create a configuration that causes the
consumer to
print out all the squares of the positive integers.
Draw the configuration in your notes.
- Now, instead of using the square module, try to
achieve the same effect (as in exercise 3 above) by using two counter modules,
a constant module (connected to both), a product module, and a consumer
module. Draw the configuration before you try it.
Does it work? Try it with a single counter and a product module.
Does that work? Offer a possible
explanation for the behaviors you have observed.
Turn in your lab notes to receive credit for completing
this tutorial.