ECE
329 Computer Systems Structures
|
|
Fall 2005
In this course students will learn the basics of operating systems, including
the creation, management, and scheduling of threads and processes; process
communication and synchronization; memory management; file systems; and
protection. Programming assignments connect the theory with practice and enable
students to further develop their programming skills.
Syllabus
Week
| Topic
| Assignment
|
1
| introduction / overview |
|
2
| C programming language |
assignment #1 (9/7 W) |
3
| computer and O/S structures |
|
4
| processes |
assignment #2 (9/21 W) |
5
| threads |
|
6
| CPU scheduling I |
exam #1 (10/7 F) |
7
| CPU scheduling II |
|
8
| process synchronization I |
assignment #3 (10/19 W) |
9
| process synchronization II |
|
10
| deadlocks |
assignment #4 (11/7 M) |
11
| C++ programming language |
|
12
| processes and threads on Windows |
exam #2 (11/18 F) |
13
| [break] |
|
14
| file systems |
assignment #5 (12/7 W) |
15 | I/O systems |
|
Final exam: 12/16 F, 8:00 - 11:00 AM
Textbook:
- A. Silberschatz, P. B. Galvin, and G. Gagne, Operating System Concepts,
6th edition, John Wiley and Sons, 2003.
Lectures and review questions courtesy of Bill Reid:
C function reference courtesy of Bill Reid:
To complement the theory with practice, you will implement several assignments
in the C programming language. Start by reading these general resources:
Project guide -- Project grading --
Example project report . These documents,
as well as the assignments themselves, are courtesy of Bill Reid.
- Programming assignment #1 (Queues, due
9/7) -- first be sure you are familiar with
doubly linked lists
- Programming assignment #2 (setjmp/longjmp, due 9/21) -- for reference, see
- Programming assignment #3 (threads, due
10/19)
- Programming assignment #4 (Windows threads, due 11/7). Write an application that allows the user to start and
terminate a Windows
thread by pressing a button on a graphical user interface (GUI). There are two
forms of terminating: stop, which is non-preemptive and requires the
thread to continuously check whether it should stop, and kill, which
preemptively kills the thread. The function to terminate the thread
should not return until the thread is terminated. The user
should also be able to select the priority of the thread both before it runs
and while it is running. While the thread is running, it should continuously
and indefinitely display a counter on the GUI indicating the progress of the
thread.
For this project you will need CreateThread, CloseHandle, TerminateThread,
CreateSemaphore, CreateMutex, WaitForSingleObject, ReleaseMutex,
ReleaseSemaphore, and SetThreadPriority.
See the MSDN on-line help,
and search using the function names for more specific information (be sure to
use the function, not the class methods).
To assist you in this project, you may start with this Visual C++ 6.0 project:
WinThreads.zip . Unzip the file and
double-click on WinThreads.dsw . You will need to modify the four files
near the bottom of WinThreadsDlg.cpp . For those wishing to use a
different IDE, here is a screenshot of the application to build:
WinThreads.bmp .
If you have trouble with your program freezing, it might be because the edit
box is being used unpredictably by the main thread. Feel free to replace
your SetWindowText call with a TRACE statement. TRACE is a Microsoft
macro that has the same syntax as printf, and it prints to the output window.
To view the output, run Build -> Start Debug -> Go, and make sure the output
window is visible (View->Output) which it should be by default.
To turn in your code, just email the files you modified, if all you did was
edit the .cpp (and possibly the .h) file. If you made more changes,
however, like adding buttons to the dialog, then do the following:
Delete the Debug directory (and Release, if you have one), then zip all your
files (recursively, including the res directory). Rename the zipped file
to '_zip' so that the email system won't block it, then email it to the assign
server and cc the grader.
- Programming assignment #5 (bounded buffer problem, due 12/7)
- Implement a class called Mutex with the following interface:
void Lock();
void Unlock();
- Implement a class called Semaphore with the following interface:
bool Wait(int timeout); // timeout is in milliseconds, negative
value means infinite
// returns true if signaled, false if timed out
void Signal();
- Implement a class called DataGenerator with the following interface:
int GetNextValue(); // returns the next data element in
the buffer; blocks if there is no value
This class creates a thread that continuously puts data into an internal
fixed-length buffer, simulating a real device. If the buffer is full,
the thread blocks. For simplicity, the data should be the Fibonnacci
sequence of integers 1, 1, 2, 3, ... N. After N, there should be a
single integer with the value -1 indicating the end of all the data. The
method GetNextValue() should be thread-safe.
- (Note: In all these classes, the constructor should create any
necessary resources, and the destructor should clean up)
- Write a console-based program that creates a DataGenerator, grabs data
continuously until the end of the data, and prints it on the screen.
Test the program under the conditions of the buffer becoming empty and
becoming full.
Instructor: Stan Birchfield, 207-A Riggs Hall, 656-5912, email: stb at clemson
Grader: Nikhil Rane, email: nrane at clemson
Lectures: 8:00-9:00am MWF, 227 Riggs Hall