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.
Important note on the Git repository. You must use Git to maintain your project files
and you must make frequent commits to your repository. The Git repository must be in Github
classroom. Follow this link to create a repository in this course’s classroom:
After a few clicks you will get a repository named cse306-project-1-YourGuthubId. The repository will automatically become private and you must not attempt to share it.
We will be checking your repository and your commit logs to make sure that substantial
activity has been taking place over a period of time. If there are less than 3 nontrivial commits,
significant penalty will be applied.
We recommend that you read a brief Git tutorial to learn the concepts, but avoid using
command line tools to work with the repository, to save yoursel from costly mistakes. Pick a nice
graphical tool like GitKraken, SmartGit, TortoiseGit, or SourceTree (GitKraken and SmartGit
work on all platforms, are commercial, but free for academic use; TortoiseGit is Windows only;
SourceTree is Windows+Mac). Otherwise, chances are that you will make mistakes that will
waste your time and may affect your grade. (Messing up your git repository is not an excuse.)
Your code must be well-structured, documented, properly indented, and there must be no
compilation warnings or errors. These factors will be taken into account in grading.
How to submit. Zip-up your main branch and submit the zip file via Blackboard. Github
has a button for generating such zip files: Clone or download>Download ZIP. Normally, the zip
file will have a top folder with a name like cse306-project-1-YourGuthubId-master, but if
not then make sure that your submitted zip file has a top folder with such a name (-master is
dispensable, but the rest is not). Do not forget to include your name and student Id in the
program source-files. Submission is electronic only.
This project is to be done individually. Each source file must include the following pledge:
I pledge my honor that all parts of this project were done by me individually, without collaboration with anyone, and without consulting any
external sources that could help with similar projects.
The author name, the Id, and the pledge must be as specified to avoid penalty.