Part 0
Finish the modification of Assignment 4 that we started in the
recitation. Multiple copies of it should be able to send solutions to
solution_server. Be sure that it is hardware independent by
sending all data as 16-bit values in network byte order. Use the
solution_server from the recitation.
You can find all of the files needed to compile the solution_server here. When testing, keep these files in their own directory and do not modify them, except that you will need to remove the references to -lsocket from the makefile to compile under Linux. You will also need to modify item.h to chnage the value of N.
Part 1
You will write three programs for this part.
Part 1a: bounder_buffer
This is a server that listens for connections on two ports.
The two port numbers are command line parameters.
Use two separate threads for this. Each thread will be a serial server.
The first thread will read items from the network
(just as solution_server does),
using the first command line argument as the port number.
It will put the items in a bounded buffer like the one from
Part 1 of Assignment 5. If the buffer is fill, the thread holds the
connection open and does not accept additional requests on this port
until it can put the item in the buffer. Make the buffer have a fixed,
moderate size of 20. The second thread will wait for a connection and send
an item from the bounded buffer to the remote host. If the buffer is
empty, hold the connection open until an item can be sent. Make sure the
buffer uses appropriate synchronization.
Part 1b: producer
This is a program that has a host and port number as command line parameters
(like your solution_maker from the recitation, but it is only the
producer part. The items it producers are not all solutions, but they
contain unique integers between 0 and N-1.
Part 1c: consumer
This is a program that has 4 command line parameters.
The first two are a host (buffer_host) and port number
(buffer_port) for reading partial solutions
from the bounded_buffer server above. The next two are a host
(solution_host) and port number (solution_port)
to send actual solutions to the solution_server.
Use at least 4 machines to run these programs: solution_host, buffer_host, producer_host, and consumer_host. Run the solution_server on the solution_host using the solution_port. Run the bounded_buffer on the buffer_host using the buffer_port. Run at least one producer on a producer_host using the buffer_host and buffer_port as parameters. Run at least one consumer on a consumer_host using the four command line parameters: buffer_host, buffer_port, solution_host, and solution_port.
Part 2: Optional
This part is optional and can be used to pull up your grade from past
assignments. Make your bounded_buffer program from Part 1 into
a parallel server. Each of the two threads you used in Part 1 will now create
a new thread each time a connection is made.
Handing in your assignment
Use this cover sheet. All parts of this
assignment must be completed and ready to demonstrate at noon on the due date.
No late assignments are permitted for the one.
The cover sheet and the instructions for demonstrating your program on the due date are now available.
Checking off your project: