printer client/server (lpr/lpd) - a producer-consumer system example -------------------------------------------------------------------- This directory contains the source code for two programs - tiny-lpr, that spools files for printing, and tiny-lpd, a printing daemon that takes files from the spool directory and sends tem to the printer, one file at a time. To compile the programs, type 'make' (or 'gmake', to use gnu make). Experiment with running these programs. Check what happens if you run multiple 'tiny-lpr' (producer) processes at the same time. Check how the system works if more then one printer daemon (tiny-lpd) is being run at the same time. Try modifying the system so that only a single printer daemon may be running at the same time. Note: to ease running the programs, the spool directoy path is given as a relative path (this of-course must be changed to a full path in a real system). Thus, you should run both programs from the source directory in order for them to work, or modify the file path macro SPOOL_DIR in file 'tiny-lp-common.h' to a full path, and copy the contents of the 'tiny-spooldir' directory to the new location. You may also check the semaphore set created by the tiny-lpd program, by issuing the following command: ipcs -s If done after running tiny-lpd, you will see something similar to this: ------ Semaphore Arrays -------- semid owner perms nsems status 128 choo 666 2 note that the 'msgid' field contains a value that is different from what was supplied to the 'semget()' system call by the tiny-lpd program. This is the value that you should use when trying to remove the semaphore set, using the 'ipcrm' command.