13.07.2015 Views

iAPX 286 Operating System Writers Guide 1983

iAPX 286 Operating System Writers Guide 1983

iAPX 286 Operating System Writers Guide 1983

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

TASK MANAGEMENTexample, when an application calls the operating system to request receipt of a message from anothertask, the operating system determines whether a message is waiting for delivery. If no message iswaiting, then the operating system must switch the task from RUNNING state to WAITING state.Later when another task calls the operating system to send a message to the waiting task, the operatingsystem must change the task from WAITING state to READY state. In cases such as these, theoperating system plays a bookkeeping role, simply keeping track of which tasks are waiting and associatingevents with the correct waiting tasks.The operating system plays a much more significant role, however, when it determines which of theready tasks to dispatch (the transition from READY state to RUNNING state) or when to preemptthe task that is executing (the transition from RUNNING state to READY state). These decisionsaffect the overall performance of the system, both throughput and response to external events.POLICIES AND MECHANISMSBecause of the difficulty of establishing an effective policy for dispatching and preemption decisions,it is desirable to clearly separate mechanisms from policies. The only control an operating system canexercise over tasks is deciding which task to execute and how long to let it run before changing toanother task. The scheduling mechanisms must exert such control in a manner that the policies canadjust. For example, to control how long a task executes, the scheduler implements a mechanism forpreempting the task after a certain time period has elapsed. The mechanism consists of an intervaltimer (such as Intel's 8254 Programmable Interval Timer) that interrupts the executing task periodicallyso that the operating system can determine whether the task has yet exceeded the time-sliceallocated to it. The length of the time-slice is a variable that the policy layer can control. The policylayer sets the length of the time-slice to reflect the importance of the task.The separation of policy and mechanism applies as well to deciding which task to execute next. Forexample, the scheduling mechanism associates a priority number with each task. When changing tasksit always chooses the task with highest priority. The priority, however, is a variable, and the policylayer determines its value.For the policy layer to make reasonable decisions about scheduling, the mechanism layer may need tocollect statistics about the run-time behavior of tasks, for example:• Elapsed time in the system• Total of actual time serviced by processor• Running average of actual length of time-slice(Note that interrupt-scheduled tasks subtract from the time allocated to software-scheduled tasks.)The privilege levels of the <strong>iAPX</strong> <strong>286</strong> architecture can support the separation between mechanisms andpolicies. The mechanisms belong to the kernel of the operating system, and as such they should be welltested, highly reliable, and not subject to frequent change; in other words, they are good candidatesfor PL O. Policies, on the other hand, are subject to frequent change and, as a result, are less reliable.Running scheduling policies at PL I ensures that errors cannot corrupt kernel procedures.4-9 121960-001

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!