views:

31

answers:

1

Just a simple question: in a single-task system OS copies smt to memory and then 'goes to' somewhere there and program returns control to task manager later. But in multitasking OS we just make a few steps inside the process and than return to task manager waiting for own turn. How do we 'go to task manager' without 'goto' and 'ret's?

(The only thing that comes to mind - some strange interruption in CPU like 'have made one instruction' )

+2  A: 

There are two major types of multi-tasking systems. Cooperative and Pre-emptive.

In a cooperative system each task is given control then expected to run for some period. It must then voluntarily return control to the scheduler. This may be through run-to-completion of a scheduled function or by calling a yield() function. It is possible to make the system unresponsive by executing a task that doesn't yield.

In a preemptive system the scheduler maintains full control of what task runs and for how long through enforcement of time-slicing and/or task priority. The enforcement itself is typically triggered by a system clock that generates interrupts at some fixed rate. Because of this property it is more difficult to make the system unresponsive but still possible through priority inversion or resource deadlocks.

Amardeep
Interesting. I'll read smt. else about it.
MInner