Computer Science 611
Lab - Concurrent servers with TLI using threads
Objective: To convert a process-level concurrent server to a thread-level concurrent server and how to implement one in a solaris environment using TLI.
Lab: Hunter Creech lab
In this activity, you will take an existing TLI server from the Comer text which has been written using process level currency and convert it to the same server using threaded concurrency. While one will commonly find unix server examples written using fork(), this will provide some experience using the threaded concurrency tools available in the solaris.
The server example you will convert is the SUPER (INETD) server example. You are to convert the server and use the "original" client to test it and run it against both servers (the original and your new one).
Today you will tend to find more TLI-based servers and less Berkley-based servers, so you should have some experience with both. Hopefully you should find that TLI is not drastically different. In addition you will see that the issue of threaded versus process-level concurrency is orthogonal to the OS or API.
The original TLI clients and servers are available on my account in the directory ~dgame/comer in a tar file named v3.tli.dist.tar. Untar the tar file to your account in a directory of your choosing:
tar -xvf ~dgame/comer/v3.tli.dist.tar
Then you should have a v3.tli.dist directory in your account with sources to use for building the servers. Go to the examples directory and you will find sources and a Makefile to build the executables. This will allow you to make a quick test of the client-server connection. Changes necessary are to include "CC=gcc" in the Makefile and to change the service names to append 611 on them, e.g. "echo" to "echo611". This change will use some predefined port numbers which are high enough to allow non-root users (you) to use them. The service names must be changed in both the clients and the servers. Upon completing these changes, recompile and be sure the client-server interaction works.
Then you will need to take the "superd" server and convert it to run using threads. In order to minimize the effort of this task, I have provided a template threaded application to run on solaris. It can be found at ~dgame/comer/solaristhread. First compile the program and be sure that you can run it. Compile it with
gcc filename.c -lthread
Than take the template and use it to make changes to the superd file to created a threaded version of superd for submission. This takes a little thought but not a lot of coding. Find where the service (sv_funcs.c) are called in the superd.c file and make the changes to incorporate the thread calls. The only really significant things to remember when using the thread calls are that
Details of submission will follow.