Background:
The scheduling of processes within a computer depends upon three main factors:
Goals:
In this lab, you will
Reading:
Collaboration: You will complete this lab in teams of 1 to 3 of your choice. You may, as always, consult with your classmates on issues of design and debugging.
This header declares some structure types and functions specific to job scheduling:
void initializeJobQueue( void ) initializes the job
queue with no jobs currently pending.
void insertJob( struct Event* job ) adds the
specified job to the job queue.
struct Event* selectJob( void ) selects the next
job to run from the job queue, removes the job from the queue, and
returns it.
struct jobQueue contains pointers to two struct
jobQueueNodes for a linked list that can form a jobQueue for
any scheduling algorithm.
scheduler_fcfs.c as a template for implementing the
Shortest Job Next (SJN) and Priority scheduling algorithms according
to the scheduler.h interface.
eventList structure, ordered by their start time.
registerJob event that enters the job into the
system's data structure for ready processes.
scheduler. If jobs
are pending, the scheduler event retrieves the next job using
the selectJob procedure and runs the job. If no
jobs are pending, time is advanced until the next event will
occur.
processEvent event
is triggered. This adds any required scheduler overhead to the
clock. If processes run without preemption, then the process is
run to completion. If preemption is allowed, the process runs
for its time slice or until it is completed, whichever is
sooner. When the process stops, a new scheduler event is
triggered.
registerJob events, the program reads a
sequence of jobs from a file for use in the simulation. Each job
arrival generates an event, which is placed in
the eventList.
arrival_time processing_time priority
JOB_FILE_NAME. (Initially defined
as
"/home/weinman/public_html/courses/CSC213/examples/scheduler/scheduler_job_data.txt"
.)
TIME_QUANTUM is 0 for non-preemptive
scheduling or the size of the time slice for preemptive
scheduling. (Defaults to 0.)
SCHEDULER_OVERHEAD specifies the amount
of simulation time consumed by the scheduler each time it is
called. (Defaults to 0.35.)
eventList and executes it. The scheduler is
treated as an event that is executed at the beginning of the
simulation and after each job or time slice ends.
PRINT_INPUT causes the job specifications to
be printed as they are read from JOB_FILE_NAME.
PRINT_EVENT_LIST causes the event list to be
printed each time through the main event loop.
PRINT_STATS causes the accumulated
job statistics to be printed each time through the main event
loop.
SCHEDULER_OVERHEAD
and TIME_QUANTUM at compile time.
SCHEDULER_OVERHEAD. (Record your measurements in
a text file or a spreadsheet.)
scheduler_simulation.c.
processJob event handler
in scheduler_simulation.c as indicated
by /* YOUR CODE HERE */. If the
constant TIME_QUANTUM is positive, then a job is
allowed to run continuously only for that time slice. If the job
will not finish within the time slice, then the time remaining for
the job is reduced by the time slice, and the scheduler is invoked
again.
SCHEDULER_OVERHEAD you did in step A.1, with the
time quanta being 0.05, 0.1, 0.15, and 0.2. (Record your
measurements in a text file or a spreadsheet.)
time_quantum = TIME_QUANTUM / 2^(priority-1)
SCHEDULER_OVERHEAD given in step A.1 and the same
time quanta specified in step B.2.
scheduler_simulation.c from
step B.1 implementing the RR algorithm.
As always, for the programs in steps A.2, B.1, and B.3, please follow the instructions for submitting programs.
Note that the exam is Friday 10/3. While the lab has been "partitioned," it is not due in its entirety until Tuesday 10/7 so that you have ample time to study. According to syllabus, the exam carries three times more weight than any given lab.