If there's no matching message in the pool, then![]()
get_msg
blocks the
running process; otherwise, the process continues to run. Once blocked, a
process remains blocked until a matching message appears in the pool, at
which point the process (or one of the competing processes) becomes
unblocked and ready to run. put_msg
never blocks. The scheduler moves ready processes into the CPU, and because
you weren't required to implement a pre-emptive scheduler, the process
remains in the CPU until it blocks or exits. Processes entering the system
are in the ready state.
Scheduling by shortest-job next produces minimum average wait times for any set of jobs. To create non-minimum average wait times under nearest-deadline first, assign deadlines inversely proportional to execution time; that is, longer executing jobs have closer deadlines. This deadline assignment inverts the job ordering produced by shortest-job next scheduling and results in non-minimal average wait times.
For example, consider three jobs with 1, 3, and 5 unit execution times. Under shortest-job next, the average wait time is
The base and top registers protect storage from errant accesses. The contents of the base and top registers determine the range of Primary-Store addresses accessible to the executing user process. Any storage access outside the range defined by the base and top registers results in a illegal-address interrupt.
int increase_by_one(mem) { return mem++ }
Give all competing processes access to the shared integer variable
lock
; initially, lock
equals 0. A process wishing to establish
mutual exclusion performs the following
while (increase_by_one(lock) != 0) { // sleep() or yield() or whatever. }
lock = 0
lock = 0
represents the stone in the bowl, and lock
> 0
represents the empty bowl. The atomic increase_by_one() instruction
lets a process grab the stone and empty the bowl un-interruptably, after
which the bowl remains empty until the stone is returned to the bowl by
assigning 0 to lock
.
This page last modified on 11 October 2001.