next up previous contents
Next: B Additional Information Resources Up: Unix Communication Facilities Previous: 10 References

A Complete Source code

The source code for all programs is available here as tared gzip file. It can be extracted with

% gtar zxvf prgsource.tgz
on most UNIX systems that have the utilities GNU-tar and gzip installed.

The source code for the different programs are stored in different directories. This makes it easier to remember the purpose of a program or file.

Directory Name Purpose
common commonly used classes and subroutines
local example programs for local interprocess communication
distSOCKET example programs for distributed interprocess communication, socket version
distTLI example programs for distributed interprocess communication, TLI version
performance performance measurement programs
environment example programs which get information about the environment in which they are executed
rpc a modified RPC example from [Stev90]
Table 29: Overview of Source Code Directories

The programs were written portability in mind, as they had to run on three different computer platforms. The platform dependent parts normally deal only with the absence of include files and other easy to fix problems. The layout of all programs is derived from [POSIX.1].

Nearly all programs were tested and run under the systems described in Chapter 7. The examples in the distTLI directory could only be tested on aidan, as this was the only platform that had the TLI support enabled.

Nearly all programs needed a common set of utility functions. Therefore these functions were collected in the common directory. The link-library libcommon.a, together with the include file common.h allows all programs to access these functions easily.

The programs were not designed to be as short as possible on paper, they were designed to be maintainable. Therefore the layout of all programs is spacious. This was of great help whilst the programs were being developed.

A.1 Makefiles

Makefiles were used to keep control over the large number of programs and data files.

File Name Purpose Page
Makefile Makefile for all programs gif
Makefile.def general definitions for all other Makefiles gif
Makefile.def2 additional definitions for the end of all other Makefiles gif
Makefile.hpux definitions for HP 9000/710/HP-UX 9.01 gif
Makefile.i386 definitions for i586/Linux 1.2.9 gif
Makefile.sparc definitions for SparcCenter 2000/Solaris 2.5 gif
Table 30: Makefiles

The common defines in Makefile.def and Makefile.def2 allows all other Makefiles in the subdirectories to be reasonable short. Definitions suitable for the used system are read in automatically. To compile the programs on a new platform, only a new file Makefile.hosttype is needed, where hosttype is the contents of the environment variable $HOSTTYPE. This allows the compilation of the code on different platforms without any changes in the makefiles.

A.1.1 Makefile

Makefile

Makefile

Makefile

A.1.2 Makefile.def

Makefile.def

A.1.3 Makefile.def2

Makefile.def2

A.1.4 Makefile.hpux

Makefile.hpux

A.1.5 Makefile.i386

Makefile.i386

A.1.6 Makefile.sparc

Makefile.sparc

A.2 Commonly used Subroutines

The common directory (see Table 31) contains various functions and classes that are used by the example or performance measurement programs. Most of the files are used to build a link-library libcommon.a, which is used together with common.h in the main directory to be available for all the other programs.

File Name Purpose Page
Makefile Makefile for this directory gif
../common.h Header file which defines the functions and classes in this directory, used by all programs gif
catchchildren.c install a signal handler that cares about zombies generated by fork gif
clocktimer.h defines the class clocktimer, which measures used clock time gif
clocktimer.c implements the class clocktimer gif
cputimer.h defines the class cputimer, which measures used CPU time gif
cputimer.c implements the class cputimer gif
errordekl.c declares global error object error gif
errors.h defines the class errors that makes error handling easier gif
errors.c implements the class errors gif
measurement.h defines the class measurement that makes it easier to measure performances gif
measurement.c implements the class measurement gif
readdata.c for performance measurements: read the data generated by writedata(). The time used to read all the data can be written out gif
readline.c provide a function that reads a line from cin and recognizes EOF immediately gif
readline2.c read a line from a file descriptor gif
readn.c simulate normal I/O read() for sockets, pipes,... gif
readwritedata.h common definitions for readdata.c and writedata.c gif
ssleep.c higher resolution sleep function gif
synchronize.c functions that makes it possible for two processes to synchronize themselves gif
writedata.c for performance measurements: write data read by readdata(). The time used to write all the data can be written out gif
writen.c simulate normal I/O read() for sockets, pipes, ... gif
Table 31: Purpose of Files in the common Directory

A.2.1 common/Makefile

common/Makefile

A.2.2 common.h

common.h

A.2.3 common/catchchildren.c

common/catchchildren.c

A.2.4 common/clocktimer.h

common/clocktimer.h

A.2.5 common/clocktimer.c

common/clocktimer.c

A.2.6 common/cputimer.h

common/cputimer.h

A.2.7 common/cputimer.c

common/cputimer.c

A.2.8 common/errors.h

common/errors.h

A.2.9 common/errors.c

common/errors.c

A.2.10 common/errordekl.c

common/errordekl.c

A.2.11 common/measurement.h

common/measurement.h

A.2.12 common/measurement.c

common/measurement.c

A.2.13 common/readdata.c

common/readdata.c

A.2.14 common/readline.c

common/readline.c

A.2.15 common/readline2.c

common/readline2.c

A.2.16 common/readn.c

common/readn.c

A.2.17 common/readwritedata.h

common/readwritedata.h

A.2.18 common/ssleep.c

common/ssleep.c

A.2.19 common/synchronize.c

common/synchronize.c

A.2.20 common/testerror.c

common/testerror.c

A.2.21 common/writedata.c

common/writedata.c

A.2.22 common/writen.c

common/writen.c

A.3 Local IPC

The local directory (see Table 32) contains the example programs for Chapter 3. They implement various local IPC mechanisms.

File Name Purpose Page
Makefile Makefile for this directory gif
fifoclient.c together with fifoserver.c: demonstrates the use of FIFOs gif
fifoserver.c together with fifoclient.c: demonstrates the use of FIFOs gif
message.c shows how to use System V IPC message queues gif
namedstreampipe.c implements function that creates a named stream pipe gif
pipe.c demonstrates the use of UNIX pipes gif
semaphore.c shows how to use System V IPC semaphores gif
shared.c shows how to use System V IPC shared memory gif
signal.c demonstrates the use of signals gif
Table 32: Purpose of Files in the local Directory

A.3.1 local/Makefile

local/Makefile

A.3.2 local/fifoclient.c

local/fifoclient.c

A.3.3 local/fifoserver.c

local/fifoserver.c

Example logfile

A.3.4 local/message.c

local/message.c

Example logfile

A.3.5 local/namedstreampipe.c

local/namedstreampipe.c

A.3.6 local/pipe.c

local/pipe.c

Example logfile

A.3.7 local/semaphore.c

local/semaphore.c

Example logfile

A.3.8 local/shared.c

local/shared.c

Example logfile

A.3.9 local/signal.c

local/signal.c

Example logfile

A.4 Distributed IPC

The distSOCKET directory (see Table 33) contains the socket version of the programs described/referred to in Chapter 6 and Chapter 8, while the directory distTLI contains the corresponding TLI example programs (see Table 34).

File Name Purpose Page
Makefile Makefile for this directory gif
udpclient.c show how to use UDP, client, socket version, needs udpserver(.c) as UDP server gif
udpserver.c show how to use UDP, server, socket version, needs udpclient(.c) as UDP client gif
tcpclient.c show how to use TCP, client, socket version, needs tcpserver(.c) as TCP server gif
tcpserver.c show how to use TCP, server, socket version, needs tcpclient(.c) as TCP client gif
safesend.c implements ``safe'' sendto()/recvfrom() functions for Chapter 8 gif
Table 33: Purpose of Files in the distSOCKET Directory

File Name Purpose Page
Makefile Makefile for this directory gif
udpclient.c show how to use UDP, client, TLI version, needs udpserver(.c) as UDP server gif
udpserver.c show how to use UDP, server, TLI version, needs udpclient(.c) as UDP client gif
tcpclient.c show how to use TCP, client, TLI version, needs tcpserver(.c) as TCP server gif
tcpserver.c show how to use TCP, server, TLI version, needs tcpclient(.c) as TCP client gif
acceptcall.c help function for tcpserver.c: accept an incoming connection request gif
Table 34: Purpose of Files in the distTLI Directory

A.4.1 distSOCKET/Makefile

distSOCKET/Makefile

A.4.2 distSOCKET/udpclient.c

distSOCKET/udpclient.c

A.4.3 distSOCKET/udpserver.c

distSOCKET/udpserver.c

Example logfile

A.4.4 distSOCKET/tcpclient.c

distSOCKET/tcpclient.c

A.4.5 distSOCKET/tcpserver.c

distSOCKET/tcpserver.c

Example logfile

A.4.6 distSOCKET/safesend.c

distSOCKET/safesend.c

A.4.7 distTLI/Makefile

distTLI/Makefile

A.4.8 distTLI/udpclient.c

distTLI/udpclient.c

A.4.9 distTLI/udpserver.c

distTLI/udpserver.c

A.4.10 distTLI/tcpclient.c

distTLI/tcpclient.c

A.4.11 distTLI/tcpserver.c

distTLI/tcpserver.c

A.4.12 distTLI/acceptcall.c

distTLI/acceptcall.c

A.5 Performance

The performance directory (see Table 35) contains the programs to measure the performance of various IPC facilities for Chapter 7. The WWW version of this document contains hyper-links to the measured data and performance/timing graphs in Postscript.

File Name Purpose Page
Makefile Makefile for this directory gif
fifoclient.c measures performance of FIFOs (together with fifoserver.c) gif
fifoserver.c measures performance of FIFOs (together with fifoclient.c) gif
memory.c measures the throughput of memory in normal and shared memory gif
message.c measures how long it takes to send/receive System V IPC messages gif
pipes.c measures how fast pipes are gif
semaphore.c measures how fast semaphore operations are gif
shared.c measures how long it takes to add/remove a shared memory region gif
signaloverhead.c measures the overhead of synchronizing tasks with signals gif
socketlocal.c test the performance of local sockets via socketpair() gif
systemcalloverhead.c measures the overhead of a system call gif
tcpsclientoverhead.c measures the overhead in establishing a TCP connection gif
tcpsclientthroughput.cmeasures performance of a TCP connection, uses tcpserverconcurrent(.c) as TCP server gif
tcpsservercon-
currentoverhead.c
needed for measurements by tcpsclientoverhead.c gif
tcpsserverconcurrent.c measures performance of a TCP connection, uses tcpsclientthroughput(.c) as TCP client gif
timeroverhead.c measures the overhead of using the timer classes gif
udps.h some common definitions for udpsserver.c and udpssclient.c gif
udpsclient.c measures performance of UDP, client, needs udpsserver(.c) as UDP server gif
udpsserver.c measures performance of UDP, server, needs udpsclient(.c) as UDP client gif
Table 35: Purpose of Files in the performance Directory

A.5.1 performance/Makefile

performance/Makefile

performance/Makefile

performance/Makefile

A.5.2 performance/fifoclient.c

performance/fifoclient.c

Result on

Performance graph Time graph

A.5.3 performance/fifoserver.c

performance/fifoserver.c

Result on

Performance graph Time graph

A.5.4 performance/memory.c

performance/memory.c

Result on

A.5.5 performance/message.c

performance/message.c

Result on

Performance graph Time graph

A.5.6 performance/pipes.c

performance/pipes.c

Result (read, synchronized) on

Result (write, synchronized) on

Result (read, unsynchronized) on

Result (write, unsynchronized) on

Performance graph

A.5.7 performance/semaphore.c

performance/semaphore.c

Result on

A.5.8 performance/shared.c

performance/shared.c

Result on

Performance graph Time graph

A.5.9 performance/signaloverhead.c

performance/signaloverhead.c

Result on

A.5.10 performance/socketlocal.c

performance/socketlocal.c

Result (read, synchronized) on

Result (write, synchronized) on

Result (read, unsynchronized) on

Result (write, unsynchronized) on

Performance graph

A.5.11 performance/systemcalloverhead.c

performance/systemcalloverhead.c

Result on

A.5.12 performance/tcpsclientoverhead.c

performance/tcpsclientoverhead.c

Result (accumulated) on

Result (raw data) on

Measurement between two HP 9000/710/HP-UX 9.01 on same Ethernet:

Measurement between pike17 and aidan:

A.5.13 performance/tcpsclientthroughput.c

performance/tcpsclientthroughput.c

Result on

Performance graph Time graph

Measurement between different computers:

Performance graph Time graph

A.5.14 performance/tcpsserverconcurrentoverhead.c

performance/tcpsserverconcurrentoverhead.c

Result on

Measurement between two HP 9000/710/HP-UX 9.01 on same Ethernet:

Measurement between pike17 and aidan:

A.5.15 performance/tcpsserverconcurrent.c

performance/tcpsserverconcurrent.c

Read result on

Write result on

Time graph

Measurement between two HP 9000/710/HP-UX 9.01 on same Ethernet:

Measurement between pike17 and aidan:

Time graph

A.5.16 performance/timeroverhead.c

performance/timeroverhead.c

Result on

A.5.17 performance/udps.h

performance/udps.h

A.5.18 performance/udpsclient.c

performance/udpsclient.c

Result (throughput) on

Result (speed differences) on

Performance graph Time graph

Measurement between two HP 9000/710/HP-UX 9.01 on same Ethernet:

Measurement between pike17 and aidan:

Performance graph

A.5.19 performance/udpsserver.c

performance/udpsserver.c

A.6 Program Environment

A program often has to find out in what kind of environment it runs or which facilities the operating system has. The programs in the environment directory (see Table 36) show how to find out various things about a used operating system / computer. These programs were used for getting information about the used systems. Most of the programs are not described directly in the main document. The WWW version of this document contains hyper-links to the results of the programs on the three used systems.

File Name Purpose Page
Makefile Makefile for this directory gif
confstrtest.c shows how to get configuration dependent string variables gif
getpipecapacity.c get capacity of pipes gif
hostadress.c print (internet) addresses and aliases of current host gif
systemtype.c prints information about the hardware and software the program is running on gif
sysconftest.c print all constants that are available via sysconf() gif
sysvipclimits.c obtain the maximum nuber of System V IPC objects per process gif
Table 36: Purpose of Files in the environment Directory

A.6.1 environment/Makefile

environment/Makefile

A.6.2 environment/confstrtest.c

environment/confstrtest.c

Result on

A.6.3 environment/getpipecapacity.c

environment/getpipecapacity.c

Result on

A.6.4 environment/hostadress.c

environment/hostadress.c

Result on

A.6.5 environment/systemtype.c

environment/systemtype.c

Result on

A.6.6 environment/sysconftest.c

environment/sysconftest.c

Result on

A.6.7 environment/sysvipclimits.c

environment/sysvipclimits.c

Result on

A.7 Remote Procedure Calls

The directory rpc contains a modified RPC example source code from [Stev90] that demonstrates how to use RPC.

File Name Purpose Page
Makefile Makefile for this directory gif
date.x Specification of remote date and time service gif
dateproc.c remote procedures, called by server stub gif
rdate.c client program for remote date service gif
Table 37: Purpose of Files in the rpc Directory

A.7.1 rpc/Makefile

rpc/Makefile

A.7.2 rpc/date.x

rpc/date.x

A.7.3 rpc/dateproc.c

rpc/dateproc.c

A.7.4 rpc/rdate.c

rpc/rdate.c

Example logfile


next up previous contents
Next: B Additional Information Resources Up: Unix Communication Facilities Previous: 10 References

Gerhard Müller