Lab 4: CPU Scheduler
Due Dates:
- Pseudocode: Thursday, February 16, 2012 by 10:00 PM
- Program: Wednesday, February 29, 2012 by 10:00 PM
- Pseudocode: lab4-pseudocode
- Program: lab4
Lab description
Write a CPU scheduler for the following algorithms:- FCFS
- SJF
- STRF
- Priority
- Preemptive Priority
- Round-robin (time quantum = 2)
- Process ID
- Arrival time
- CPU burst time
- Priority (higher = higher priority)
ALGORITHM_NAME: Scheduling process ID NUMBER. For testing purposes, use at least the following two files: The process data file may have any information for any number of processes up to 10. Finally, name the source code file lab4.cpp.
Pseudocode
For this lab, design your implementation using pseudocode. Additionally, in the pseudo code document, indicate the type of data structures that you'll use to keep track of the process information.Example Execution
$ ./lab4 processData1.txt FCFS: Scheduling process ID 1 FCFS: Scheduling process ID 2 FCFS: Scheduling process ID 3 FCFS: Scheduling process ID 4 FCFS: Scheduling process ID 5 SJF: Scheduling process ID 1 SJF: Scheduling process ID 2 SJF: Scheduling process ID 4 SJF: Scheduling process ID 3 SJF: Scheduling process ID 5 STRF: Scheduling process ID 1 STRF: Scheduling process ID 2 STRF: Scheduling process ID 3 STRF: Scheduling process ID 3 STRF: Scheduling process ID 4 STRF: Scheduling process ID 1 STRF: Scheduling process ID 5 PRIORITY: Scheduling process ID 1 PRIORITY: Scheduling process ID 4 PRIORITY: Scheduling process ID 3 PRIORITY: Scheduling process ID 5 PRIORITY: Scheduling process ID 2 PREEMPTIVE PRIORITY: Scheduling process ID 1 PREEMPTIVE PRIORITY: Scheduling process ID 1 PREEMPTIVE PRIORITY: Scheduling process ID 3 PREEMPTIVE PRIORITY: Scheduling process ID 4 PREEMPTIVE PRIORITY: Scheduling process ID 3 PREEMPTIVE PRIORITY: Scheduling process ID 1 PREEMPTIVE PRIORITY: Scheduling process ID 5 PREEMPTIVE PRIORITY: Scheduling process ID 2 ROUND-ROBIN: Scheduling process ID 1 ROUND-ROBIN: Scheduling process ID 2 ROUND-ROBIN: Scheduling process ID 3 ROUND-ROBIN: Scheduling process ID 1 ROUND-ROBIN: Scheduling process ID 4 ROUND-ROBIN: Scheduling process ID 5 ROUND-ROBIN: Scheduling process ID 1 ROUND-ROBIN: Scheduling process ID 5 ROUND-ROBIN: Scheduling process ID 1 ROUND-ROBIN: Scheduling process ID 5 ROUND-ROBIN: Scheduling process ID 1 ROUND-ROBIN: Scheduling process ID 5 ROUND-ROBIN: Scheduling process ID 5
Submission
Submit the pseudo code and source code files using the handin program. For example, to submit the pseudo code for this lab, type the following in a terminal exactly as it appears:handin lab4-pseudocode lab4-pseudocode.txt
For the program for this lab, type the following in a terminal exactly as it appears:
handin lab4 lab4.cpp
Alternatively, you can submit the assignment from
Rubric: Pseudocode
Points Item ---------- -------------------------------------------------------------- _____ / 5 Outlines major design _____ / 5 Limited amount of actual code _____ / 5 Indicates data structures _____ / 15
Rubric: Program
Points Item ---------- -------------------------------------------------------------- _____ / 5 Uses filename from command-line _____ / 5 Correct syntax for output (ALGORITHM_NAME: Scheduling process ID NUMBER) _____ / 15 Correctly outputs sequence for FCFS _____ / 15 Correctly outputs sequence for SJF _____ / 15 Correctly outputs sequence for STRF _____ / 15 Correctly outputs sequence for Priority _____ / 15 Correctly outputs sequence for Preemptive Priority _____ / 15 Correctly outputs sequence for Round-robin _____ / 100
Hints
- For more information on pseudo code, see Wikipedia's page and this short video.