CS 576S
Homework #1
: Shared Variables.
Consider two processes which communicate with each other by sending messages. Each message consists of an arbitrarily long (but bounded) sequence of integers, called packets, having values between 1 and N. A process may decide to initiate a message transmission at any time. The two operations used to transmit and receive messages are called send and get. The get operation is non-blocking. A get operation returns a null message if nothing has been sent by the other party. The send operation blocks only if there is no communication activity in the other process. The two processes have distinct id's known by the send and get operations. Each process has an input buffer which stores messages that have not been read yet.
Use a Pascal-like notation to code the send and get procedures. Your solution must use a single shared variable of type integer, call it buf. The read and write operations on buf are atomic. No mutual exclusion and synchronization constructs are available to you. You are required to minimize the number of bits needed to represent the shared variable buf.
Special Instructions:
1. The homework must include the following sections: Problem Definition, Solution Overview, Annotated Algorithm, and Discussion. It is the solution overview that carries most of the points.
2. In addition to being correct, your solution must also ensure fairness.
3. The homework must be typed and must adhere to the highest level of professionalism possible. The presentation must be clear and concise. The layout must be clean and easy to read.
4. Please pay special attention to constructing elegant solutions.