CS6210 - Project  3

Due: 11:59 p.m., Oct. 20, 1999
             (one minute prior to midnight on Wednesday night)
               This project is to be completed solo. No groups.

Compiling Info

A makefile that you can used to compile the projet is here. You will need to shift-click on the link to save the file.

There are some sample DataExchange programs available below: Read client
2nd version of Read client
Write client

Overview

The goal of this assignment is to write a distributed application using the Event Channel Paradigm  that has become popular (i.e.corba, DCOM, etc.) This assignment has two phases. In phase one you will create a client-server system consisting of a multi-threaded Stock Server that provides the current prices for a stock requested by a client. Clients are separate processes that are able to run on different hosts than the server (or the same host). In phase two, the servers will create physically separate proxies to handle the client requests.

Phase One:

The Client
The client component should be its own process. It should be designed so that it can execute no the same host as the server component or on a separate host with no change or recompililation of the code. the client will connect to the server component through either a well known port or through the use of some directory service (choose whichever you like).  After handshaking (if necessary), the client should be able to send a request to the server consisting of a set of stocks that it wishes to receive information from on a regular basis. The client will use these stock values to calculate a running value of the portfolio as it changes. The client will get the list of stocks qnd the number of shares that are owned from  a data file. the name of this file is passed in as the first argument on the command line. For instance, you would execute a client with the line "client stocks.1" and another instance of the client with "client stocks.2". Each client is considered a unique entity even if requests the same exact stocks as another client. The Format of the stocks file is as follows:

N
<STOCK SYMBOL 1> <NUM SHARES>
<STOCK SYMBOL 2> <NUM SHARES>
...
<STOCK SYMBOL N> <NUM SHARES>

N is an integer and there are N lines following it, each bearing a stock symbol and number of shares pair. So that if the client is interested in 5 stocks then there will be 6 lines in the file. The Client should display the current value of the portfolio when it starts up and it should update the display every time the portfolio value changes.

The Server
The server component should be its own process. Clients will connect to it through a well-known port or through some sort of directory service (choose one). The server should then create a separate thread to handle that particular clients request from that point onward. It is reasonable, but not required to do some optimizations so that clients that request the same information are handled by the same thread. This is mostly design dependent. Once every 5 seconds, the server will pick a random number of stocks from its inventory to change. Each stock will have a 50% chance of changing. If a stock changes then it has a 50/50 chance of going up or down. The amount each stock can change will vary from $0 to $10 in .25 increments. Some possible values are $1.25, $8.75, etcetera. For efficiency purposes, stock value updates should only be sent to the client when the value actually changes. The server will read the list of initial stocks and stock values from a data file passed in on the command line. For instance, you would start up the server by typing "server stocksfile". The format of the server input file will be as follows:

N
<STOCK SYMBOL 1>    <INITIAL VALUE>
<STOCK SYMBOL 2>    <INITIAL VALUE>
...
<STOCK SYMBOL N>   <INITIAL VALUE>

N is an integer and there are N lines following it, each bearing a stock symbol and initial stock value pair. The Stock value is a float. So that if the server maintained 30 stocks then there would be 31 lines in the file.

Phase Two:

For phase two of the project, you will modify the server so that when it processes the client requests, it will create a proxy entity that will calculate the value of the clients portfolio and then forward that value on to the client. The client and server will run on different hosts and the proxy should be able to run on either the client host or the server host or a third host. For purposes of this assignment, you will simply do a round robin assignment of proxies to available hosts. The list of hosts that are available will be part of the input to the server component.

The Client
As before, the client component should be its own process. It should be designed so that it can execute on any host with no change or recompililation of the code. The client will connect to the server component through either a well known port or through the use of some directory service (choose whichever you like).  After handshaking (if necessary), the client should be able to send a request to the server consisting of a set of stocks and requisite number of shares representing a portfolio. The client expects to reply from the server telling it connection information it should use to receive the portfolio evaluation values. Thereafter it expects to receive an update of the estimates value of that portfolio as the stocks that comprise that portfolio change.

The client will get the list of stocks and the number of shares that are owned from  a data file. The name of this file is passed in as the first argument on the command line. If you pass the connection info of the server to the client through a command line argument then it should come after the name of the data file. For instance, you would execute a client with the line "client stocks.1" and another instance of the client with "client stocks.2".

Each client is considered a unique entity even if requests the same exact stocks as another client. The Format of the stocks file is as follows:

N
<STOCK SYMBOL 1> <NUM SHARES>
<STOCK SYMBOL 2> <NUM SHARES>
...
<STOCK SYMBOL N> <NUM SHARES>

N is an integer and there are N lines following it, each bearing a stock symbol and number of shares pair. So that if the client is interested in 5 stocks then there will be 6 lines in the file. The client should display the current value of the portfolio when it starts up and it should update the display every time the portfolio value changes.

The Server:
The server component should be its own process. Clients will connect to it through a well-known port or through some sort of directory service (choose one). The server should then create a separate process which will act as a proxy for the client and calculate the value of the portfolio on its behalf and then forward that information to the client. For this phase, it is required to optimize the proxies so that they do not repeat so that if two clients request the same stocks then you reuse the existing proxy (i.e clients that request the same information are handled by the proxy).

Use the method described in Phase One to determine when stocks change, which stocks change, and how the server determines which stocks it has. If a client requests a stock that does not exist, simply return a value of 0.0 as its share value. Also, use the aforementioned data format to determine what stocks the server will manage. Additionaly, the server will also read a list of hosts that are available to run proxy components from another data file. For instance, you would start up the server by typing "server stocksfile hostsfile". The format of the host file is as follows:

N
<HOSTNAME 1>
<HOSTNAME 2>
...
<HOSTNAME N>

N is an integer and there are N lines following it, each bearing the name of a host that can execute a proxy. So that if there were 4 such hosts then there would be 5 lines in the file. You are allowed to duplicate hosts in the file.

The proxy:
The proxy that is created by the server will use the stock values and shares owned initially sent to the server to calculate a running value of the portfolio as it changes. Proxies can be started up in several ways including a combination of exec() and the unix rsh command. Be careful with the use of abosolute path names when doing this as the code has to run in a different directoy when I'm testing it then the one you in which you are developing it.

Which systems to use:
In order to keep some consistency in what all of us are doing, we should all develop this program on a SUN Sparc Solaris system. There are several Solaris machines generally available, notably elvis.cc.gatech.edu and asperta.cc.gatech.edu. You can log into any system on the CoC network, and then telnet to elvis by entering "telnet elvis" (from a unix system), or using the telnet window on WindowsNT and opening a connection to "elvis". Elvis has 4 CPU's and lots of memory, so it should not be a bottleneck for us getting our work done.

Coding the Program

You are required to use the ECHO Event Delivery System as the underlying communication infrastructure for this project. This is based on the publish/subscribe method of event delivery which should be ideal for this type of application. In addition, you will have to use some for of threads package as well to write the multi-threaded server. You may use the GNU Pth package from the first project if you so desire or you any other threads package. You might also choose to use the Georgia Tech Cthreads library since it was developed to closely work with ECHO. See project 1 for information on how to use the GNU Pth package.
 

Some Hints

The DataExchange and ECHO documentation contains comments on how to write threaded applications that use the event delivery paradigm. I strongly recommend reading those sections.
 

Testing Your Program

I will use the following data files to test your client for phase one & two. ClientTestFile#1, ClientTestFile#2, ClientTestFile#3. I will start up approximately 2 client each per file. I will use the following data files
to test for the serve: ServerTestFile#1, ServerTestFile#2. You can use the following files as sample host files as well: hostfile#1
hostfile#2
hostfile#3

Grading Criteria


10%    Compiles cleanly
10%    Used a multi-threaded server for Phase 1
10%    Used proxies properly in Phase 2
10%    Phase One: One client with server test file 1 & 2
10%    Phase One: Three clients with server test file 1 & 2
10%    Phase Two: One client with server test file 1 & 2
10%    Phase Two: Three clients with server test file 1 & 2
15%    Phase Two: Three duplicate clients with server test file 1
15%    Phase Two: Three duplicate clients with server test file 2

Turning In Your Program

Assignments will be submitted by e-mailing a shar archive of your work to the account cs6210@cc.gatech.edu. Do NOT email them to my personal account.

Instructions for creating a shar file are as follows:

1) Login to a unix machine. I am using "elvis.cc.gatech.edu" as the example here.

2)Type "shar files > sharfilename" where files is the list of the files that you are going to submit and sharfilename is the name of the shar file you re going to create. Make sure to mention how to compile your with files in your README file. If possible, include a Makefile to compile both your phase 1 and phase 2 clients, servers, and proxies.

Make sure that you do NOT include any binaries in your shar files. I am going to compile your programs from scratch. If you have any special commands needed to compile your code then mention them in your README file.

You can email a shar file to the cs6210 account by doing:

mail -s "Project 3 Submission" cs6210@cc.gatech.edu < project3.shar

Assignments will not be accepted late without prior arrangements with the TA.
 


Last Modified: Oct. 6, 1999