CS 322 Fall 2013
Project 5
OSP2: Thread Scheduling
Due Tuesday, December 3rd at 10:00 P.M.

Please submit a directory named by your two first names by the deadline on royal
		/Shared/cs322/submit/proj5
It must contain your ThreadCB.java, TimerInterrupHandler.java and a readme with

You may work in groups of two. Collaboration within a group is, of course, unrestricted. You may discuss the program with members of other groups, but what you turn in must be your own group's work.

It is a violation to the Honor Code not to acknowledge others' work fully and openly.
You should cite any online resources you consulted to help you solve this project.
You may NOT directly copy any code or any text from anywhere.

Setup

The project files are in the Thread directory on royal
/Shared/cs322/public/proj5
Follow the instructions in the readme file to If you are using Eclipse:
  1. create a src folder in your Thread project,
  2. create a package whose name is osp.Threads inside the src folder,
  3. place the ThreadCB.java and TimerInterrupHandler.java templates inside that package and
  4. configure the build path (Configure Build Path...) so that OSP.jar (the External JAR) is added as one of the Libraries.
This setup is needed as the simulator classes expect a TaskCB object of type osp.Threads.ThreadCB.

Fourth Hour

Read Chapter 4 the OSP2 manual.

Implement the Thread module of the OSP2 simulator to increase your understanding of CPU scheduling.

Choose a basic scheduling algorithm: FIFO with or without preemption.
To get pre-emptiion set a time quantum in TimerInterrupHandler.java.

Project

The goal is now to add to the Thread module a multi-level queue that uses the round-robin scheduling algorithm on each level.

To do so, create a multi-level queue that consists of two separate queues:

  1. a high priority queue, which uses round-robin scheduling with a quantum value of 30 and
  2. a lower priority queue, use round-robin scheduling with a quantum value of 100.

When a thread is inserted into the multi-level ready queue,
it is placed in the high priority queue if its last CPU burst was smaller or equal to the quantum value of 30,
otherwise it is placed in the low priority queue.

To make this work it is necessary to keep track of the last CPU burst for the thread, and to use HClock.get().

Notes