Idle: Difference between revisions

From COMP15212 Wiki
gravatar Yuron [userbureaucratinterface-adminsysopPHRhYmxlIGNsYXNzPSJ0d3BvcHVwIj48dHI+PHRkIGNsYXNzPSJ0d3BvcHVwLWVudHJ5dGl0bGUiPkdyb3Vwczo8L3RkPjx0ZD51c2VyPGJyIC8+YnVyZWF1Y3JhdDxiciAvPmludGVyZmFjZS1hZG1pbjxiciAvPnN5c29wPGJyIC8+PC90ZD48L3RyPjwvdGFibGU+] (talk | contribs)
m (1 revision imported)
gravatar W81054ch [userbureaucratinterface-adminsysopPHRhYmxlIGNsYXNzPSJ0d3BvcHVwIj48dHI+PHRkIGNsYXNzPSJ0d3BvcHVwLWVudHJ5dGl0bGUiPkdyb3Vwczo8L3RkPjx0ZD51c2VyPGJyIC8+YnVyZWF1Y3JhdDxiciAvPmludGVyZmFjZS1hZG1pbjxiciAvPnN5c29wPGJyIC8+PC90ZD48L3RyPjwvdGFibGU+] (talk | contribs)
m (1 revision imported)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{#set: Priority=1 | Summary=What a processor does when there's nothing better to do.}}<!--
{{#set: Priority=1 | Summary=What a processor does when there's nothing better to do.}}<!--
-->{{#invoke:Dependencies|add|Process States,1|Process Scheduling,1}}
-->{{#invoke:Dependencies|add|Process States,1|Process Scheduling,1}}
In a simple, single-tasking system, when the processor cannot do
In a simple, single-tasking system, when the processor cannot do useful work it will simply ‘busy-wait’ until some stimulus
useful work it will simply ‘busy-wait’ until some stimulus
(in the one job it’s currently doing) occurs.
(in the one job it’s currently doing) occurs.


In a multitasking system system it is usual to
In a multitasking system system it is usual to [[Process_States|<strong>block</strong>]] the process and [[Process_Scheduling|schedule]] something else.
[[Process_States|<strong>block</strong>]] the process and
[[Process_Scheduling|schedule]] something else.


What if there are no tasks in the <strong>ready</strong> state?  The processor
What if there are no tasks in the <strong>ready</strong> state?  The processor cannot (permanently) ‘halt’ because something is liable to want to run again in future.
cannot (permanently) ‘halt’ because something is liable to
want to run again in future.


It is normal to provide some sort of “idle” task, which
It is normal to provide some sort of “idle” task, which busily does nothing except wait until a ‘real’ process
busily does nothing except wait until a ‘real’ process
becomes ready.  In modern processors there is often a ‘SLEEP’ type instruction which puts the processor into a
becomes ready.  In modern processors there is often a
low-power mode until (for example) an [[Interrupts|interrupt]] is requested, since only an external event is going to cause a change in processor state.
‘SLEEP’ type instruction which puts the processor into a
low-power mode until (for example) an [[Interrupts|interrupt]] is
requested, since only an external event is going to cause a change in
processor state.


The idle process will probably have to be a bit ‘special’,
The idle process will probably have to be a bit ‘special’, depending on the [[Process_Scheduling|scheduling]] algorithm.
depending on the [[Process_Scheduling|scheduling]] algorithm.


*In a real-time system (where, by definition, all other processes will block on occasion) it may be sufficient to simply run <code>idle</code> continuously at a uniquely low priority.
*In a real-time system (where, by definition, all other processes will block on occasion) it may be sufficient to simply run <code>idle</code> continuously at a uniquely low priority.
*In an interactive system it is undesirable for <code>idle</code> to have regularly scheduled time-slices as this can detract from the time available for useful processing.
*In an interactive system it is undesirable for <code>idle</code> to have regularly scheduled time-slices as this can detract from the time available for useful processing.


The idle process may be a bit smarter than purely ‘do
The idle process may be a bit smarter than purely ‘do nothing’; for example it could note the times it starts and stops for ‘accounting’ purposes. (You may be able to find this in (e.g.) the Unix <code>top</code> utility.)
nothing’; for example it could note the times it starts and
stops for ‘accounting’ purposes.
(You may be able to find this in (e.g.) the Unix <code>top</code> utility.)
----
----
 
{{BookChapter|21.3.5.11|Bottom of 872}}
{{PageGraph}}
{{PageGraph}}
{{Category|Processes}}
{{Category|Processes}}

Latest revision as of 10:03, 5 August 2019

Depends on Process StatesProcess Scheduling

In a simple, single-tasking system, when the processor cannot do useful work it will simply ‘busy-wait’ until some stimulus (in the one job it’s currently doing) occurs.

In a multitasking system system it is usual to block the process and schedule something else.

What if there are no tasks in the ready state? The processor cannot (permanently) ‘halt’ because something is liable to want to run again in future.

It is normal to provide some sort of “idle” task, which busily does nothing except wait until a ‘real’ process becomes ready. In modern processors there is often a ‘SLEEP’ type instruction which puts the processor into a low-power mode until (for example) an interrupt is requested, since only an external event is going to cause a change in processor state.

The idle process will probably have to be a bit ‘special’, depending on the scheduling algorithm.

  • In a real-time system (where, by definition, all other processes will block on occasion) it may be sufficient to simply run idle continuously at a uniquely low priority.
  • In an interactive system it is undesirable for idle to have regularly scheduled time-slices as this can detract from the time available for useful processing.

The idle process may be a bit smarter than purely ‘do nothing’; for example it could note the times it starts and stops for ‘accounting’ purposes. (You may be able to find this in (e.g.) the Unix top utility.)


Also refer to: Operating System Concepts, 10th Edition: Chapter 21.3.5.11, pages Bottom of 872


Articles on Processes
About this resource • Atomicity • Containers • Context • Context Switching • Daemons • Fork Unix • Hypervisor • Idle • Interprocess Communication • Multi Threading • Mutual exclusion • Pipes • Pointer Arithmetic • Process Control Block (PCB) • Process Priority • Process Scheduling • Process States • Processes • Queues • Queues Extra • Race Conditions • Real Time • Resources • Scheduler • Signal and Wait • Sleep • Starvation • Synchronisation • Thrashing • Threads • Unix Signals