Starting from:

$29

Project 1 – Thread Management


OSP2: An Operating System Project


What to do. Implement the Threads module of OSP2.
The project files are found on Blackboard in the Assignments section. Details of what you are
supposed to do are in the OSP2 manual, Chapter 4. The only additional requirement is that the
dispatcher should schedule threads using the following strategy:
• Threads are scheduled according to their priority. Threads with the same priority are to
be scheduled according to the time they were inserted in the ready queue.
• The priority is calculated by the following expression (higher value means higher priority):
total time the thread was waiting in the ready queue
1+total CPU time all the threads in the same task have used so far
• When a thread is dispatched, it is given a CPU time slice of 100 time units. If the thread is
still running at the end of its time slice, it is preempted and put back into the ready queue.
• If an interrupt occurs before the current thread finished 90% of its time slice and the thread
does not get blocked on some event (i.e., the thread is in the ready queue and not some
other queue), that thread has the highest priority when the dispatcher is invoked next.
• You must devise an organization for the ready queue by which scheduling will not require
scanning the entire queue in order to find the highest priority thread. (This is not obvious
due to the denominator in the priority formula.) You are not required to make the scan of
the ready queue optimal—just make it faster than linear.
Note: to implement this strategy, threads must remember the total CPU/wait time they used so
far. There also must be an account of the total CPU time of all the threads in each task.
Your objective in this project is to get your implementation to run under OSP2 without errors
and warnings with the parameter file in the Misc subdirectory.
1

More products