preemptive vs cooperative OS!

  • Thread starter Thread starter esara
  • Start date Start date
E

esara

Hi
I have a problem to understand the different between the "cooperative"
and the "preemptive" multitasking OS it is mentioned in the book that
they are mentioned that they are both multitasking.. but from the
diagram i can see that the CPU in the preemptive case can take 2
process at the same time and that is not the case with the
cooperative.. So from user point of view what is the different?? I do
not see the use will notice any different??
thanks a lot
<quote>
The Cooperative
[application 1]--|
...................---------(win3.1)--(DOS)--[CPU]
[application 2]--|

The Preemptive
[application 1]-----------(win 95)----[CPU]
| |____|
[application 2]-----------|
Note: In preemptive diagram, 2 applications going to win95 and from
win95, 2 processes going to the same CPU
 
Hi
I have a problem to understand the different between the "cooperative"
and the "preemptive" multitasking OS it is mentioned in the book that
they are mentioned that they are both multitasking.. but from the
diagram i can see that the CPU in the preemptive case can take 2
process at the same time and that is not the case with the
cooperative.. So from user point of view what is the different?? I do
not see the use will notice any different??
thanks a lot
<quote>
The Cooperative
[application 1]--|
..................---------(win3.1)--(DOS)--[CPU]
[application 2]--|

The Preemptive
[application 1]-----------(win 95)----[CPU]
| |____|
[application 2]-----------|
Note: In preemptive diagram, 2 applications going to win95 and from
win95, 2 processes going to the same CPU

It's not easy to read ASCII art, I'll try to answer your question
as I understand it.

A CPU can only be running one process at a time.

A multitasking OS has several ways to let the CPU be shared amongst
the processes that want to use it. One way is a harware timer on
the motherboard that interupts whatever is running, at a fixed
interval. One system does it 60 times a second. The interupt switches
the CPU to a function called the "Scheduler" which looks at the list
of application processes (called a Queue) that are ready to use the
CPU and passed control to the process that the scheduler decides is
the highest priority, by a whole bunch of criteria, like how long it
has been since since a process last had the CPU.

The applications have no say in the matter. They get to run for 1/60th
a second, get interupted and sent to the low end of the queue, and the
scheduler reexamines the queue and gives control to the highest
priority process that's ready to run.

And so forth.

Cooperative multitasking means that all the application have to be
"well behaved" and give up the CPU frequently. The scheduler has no
way to interrupt a process that doesn't want to give up the CPU.
 
esara said:
Hi
I have a problem to understand the different between the "cooperative"
and the "preemptive" multitasking OS it is mentioned in the book that
they are mentioned that they are both multitasking.. but from the
diagram i can see that the CPU in the preemptive case can take 2
process at the same time and that is not the case with the
cooperative.. So from user point of view what is the different?? I do
not see the use will notice any different??


A preemptive multitasking OS will interrupt a running process when its
timeslice is up. Cooperative multitasking, on the other hand, relies on
the process itself to be nice and hand over control to other processes
when it does not need it. In the latter case, a poorly designed
application can easily monopolize the entire machine.


-WD
 
Back
Top