Description
In this machine problem, we set the stage for a high-performance data query and processing system
for an ICU patient monitoring system. This system consists of a client program that sends data
requests to a data server program and then processes and “visualizes” the returned data. In this
machine problem we find our way around the system, collect some baseline performance data, and
sets up some infrastructure for subsequent machine problems.
The client program (to be implemented as program client.C is to fork off a process, which is
supposed to load the data server program (the source code is provided in file dataserver.C. The
client then issues requests to the server through what we will be calling request channels. Request
channels are a simple inter-process communication mechanism, and they are provided by the C++
class RequestChannel. Request channels provide the following interface:
RequestChannel(const string _name, const Side _side);
/* Creates a “local copy” of the channel specified by the given name.
If the channel does not exist, the associated IPC mechanisms are
created. If the channel already exists, this object is associated
with the channel. The channel has two ends, conveniently called
“SERVER_SIDE” and “CLIENT_SIDE”. If two processes connect through
a channel, one has to connect on the server side and the other on
the client side. Otherwise the results are unpredictable. */
~RequestChannel();
/* Destructor of the local copy of the channel.
By default, the Server Side deletes any IPC mechanisms associated
with the channel. */
string send_request(string _request);
/* Send a string over the channel and wait for a reply. This function
returns the reply to the caller. */
string cread();
/* Blocking read of data from the channel. Returns a string of characters
read from the channel. Returns NULL if read failed.
THIS FUNCTION IS LOW-LEVEL AND IS TYPICALLY NOT USED BY THE CLIENT. */
int cwrite(string msg);
/* Write the data to the channel. The function returns the number of
characters written to the channel.
THIS FUNCTION IS LOW-LEVEL AND IS TYPICALLY NOT USED BY THE CLIENT. */
You will be given a basic framework code, which you will be extending in a series of machine
problem. This framework consists of the following files:
simpleclient.C: This file contains a simplified but runnable form of the client. You will be using
this file and add functionality to it in this and subsequent machine problems.
Vers. 2016B Page 1
CPSC–313 Machine Problem 2
dataserver.C: This file contains the data server, described below.
reqchannel.H/C: These files contain the C++ RequestChannel.
The data server (in file dataserver.C) is to be compiled and then executed as part of your
program (in a separate process). This program handles three types of incoming requests:
hello : The data server will respond with hello to you too.
data