Due: 11:59 p.m.,
Jan. 24, 2002
(One minute prior
to midnight on Thursday, Jan. 24th.)
This project is to be
completed individually.
Goal
The goal of this assignment is to introduce the concept of real-time scheduling and explore the dynamic adaptation of process priorities. You will be required to implement a number of communicating processes on a Linux platform and explore the implications of using a user level resource manager.
Implementation
Write a program that creates two threads - a Sensor thread and a Device thread. These threads should communicate via a shared memory queue, where the Sensor has write-only queue access and the Device has read-only queue access. Create a Controller to control the fill level of the queue by modifying the scheduling priorities of the Sensor and the Device. (See 'man sched_setscheduler' for information on scheduling and SCHED_RR.)
Implement in C or C++ on a computer for which you have superuser rights for setting real-time priorities. (You've been given access to the eight computers in the EDHPC cluster - the kernels have been modified so you can change process priorities without being a superuser.) You can do your development on any computer for which your rights match that criteria. It will be graded on the EDHPC computers, so run it there before turning the project in. Note that since you'll be changing process priorities, you need to be the only user on the machine to ensure the correct results.
Use the Controller (use SCHED_RR) to initialize scheduling priorities at:
Controller: 10
Sensor: 9
Device: 8The Sensor represents an actual sensor that is recording data from the world, where the data occurs at random times (such as a microphone recording the random sounds a roomful of people make while sleeping). Whenever data is received, the Sensor delivers the data by writing to the queue, then sleeps (nanosleep) for a random time as described below.
The Device reads one entry from the queue, then sleeps for a random time as described below.
The Controller should monitor the fill level of the queue. If the queue is more than 65% full, change the Sensor priority to 8 and the Device priority to 9. If the queue is less than 35% full, the Device should be given priority 8 and the Sensor priority 9. The Controller will use shared memory to inform the Sensor and the Device of their adjusted priorities. Once the Controller monitors the fill level (and perhaps does priority adjustments & messages), it sleeps for 9 ms.
A Sensor or Device at priority 9 should sleep for a random time between 22 and 44 ms between queue accesses. A Sensor or Device at priority 8 should sleep for a random time between 31 and 51 ms.
Once you've completed your program, perform this experiment for at least 200 seconds and draw a graph showing the fill level of the queue. (If the queue shows instability, vary the random delay ranges until you find a stable situation. Graph the queue behavior for both the stable and unstable cases.)
Resources
- Linux man pages
- Makefile
- pThreads class handouts & references
Due Date & Turn-In Process
When: Jan. 24, 2002, before midnight. This is one minute prior to midnight on Thursday, Jan 24th. No late assignments will be accepted unless prior arrangements have been made.
Where: To: lkdaley@cc.gatech.edu, Subject: CS 4220 Project I
What: Submit the following in a UNIX "tar" archive.
- The source code (preferably one C/C++ file, one h file, and a Makefile).
- A README file explaining the usage of the program, assumptions you made, etc. Everything that helps us compiling and testing your application.
- A report including graphs showing the behavior of the queue.
Make sure that you do NOT include any binaries in your tar files. We are going to compile your programs from scratch. If you have any special commands needed to compile your code then mention them in your README file.