tylerfilla / umsl-cmp-sci-4760-assignment-3

CMP SCI 4760 with S. Bhatia at UMSL in Fall 2017 (Operating Systems) - Assignment 3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tyler Filla
CS 4760
Assignment 3

Preamble
========

This project uses two independent programs, oss and child. The former is user-facing, while the latter is only used
internally. The assignment hints at possible expansion of this program in the future, so I made it a goal to keep the
code highly modular. The two programs both link with two static libraries, which are detailed below.

The clock library defines a clock object and the messenger library a messenger object. The clock object manages the
simulated operating system's clock. The messenger object manages message-passing between oss and child processes. Both
store their data in shared memory and protect against concurrent access using binary semaphores. In total, this means
two semaphores are used, one for each shared resource.

Also, I failed to read the very last sentence of the assignment when I designed the fundamentals of the project, which
adds the requirement to log acquisition and release of semaphores from the child. I hacked together a solution by
guarding the log file with shm_msg's semaphore and redirecting each child's stdout to it. This avoids the need to share
the filename via command-line arguments and maintain multiple open copies.

Directory Structure
===================

Project Root
 |
 +-- child.c        (the main file for the child program)
 |
 +-- clock.c        (the main file for the clock library)
 |
 +-- clock.h        (the corresponding header file for clock.c)
 |
 +-- Makefile
 |
 +-- messenger.c    (the main file for the messenger library)
 |
 +-- messenger.h    (the corresponding header file for messenger.c)
 |
 +-- oss.c          (the main file for the oss program)
 |
 +-- README

Building
========

To build, run the following command as usual:

$ make

Usage
=====

At any time, run the following command for help:

$ ./oss -h

The program will run with the assigned defaults if you run the following:

$ ./oss

Defaults:
- Log file: ./oss.log
- Maximum instantaneous slaves: 5
- Real time limit: 20 seconds

Cleanup
=======

To clean up after a build, use the following command:

$ make clean

About

CMP SCI 4760 with S. Bhatia at UMSL in Fall 2017 (Operating Systems) - Assignment 3

License:Creative Commons Zero v1.0 Universal


Languages

Language:C 98.5%Language:Makefile 1.5%