Re: Cooperative multitasking OS-??



ssubbarayan wrote:
Dear experts,

Sorry if this sounds novice.I would like to really understand whats
meant by Cooperative multitasking OS?I read another thread in this
group which was explaining about the advantages and disadvantages it
has over a preemptive system.
From what I understood going through the discussion,Cooperative to me
looks like FIFO scheduling mechanism.
Can any of you throw some light on this or provide some links to
understand about this concept?I hit google and wikipedia but did not
get a satisfactory explaination.
Wikipedia IIRC says,Cooperative multitasking systems existed during
pre win9xOS days and non existant almost in current scenerio.Is this
true?

How different is this Cooperative system from roundrobin or FIFO?How
does the OS kernel decide which task/process to promote at any point
of time?

What sort of applications need cooperative functionality?

I don't know if everybody uses the same definition, but I've recently implemented what I call a cooperative scheduler. Just like a preemptive scheduler, there's a list of tasks with priorities. When the scheduler is called, it picks the runnable task with the highest priority to run.

The only real difference with a preemptive kernel is that the selected task will run until it blocks itself and calls the scheduler again. If an interrupt unblocks a higher priority task, it will have to wait. This requires some discipline from the programmer to make sure none of the tasks run for excessive amounts of time between two calls to the scheduler.

The advantage is that you don't to worry about shared data between tasks. The only time you need to use semaphores is when you actually want to sleep in a critical section. Priority inversion is also less of a problem. For me, an additional advantage is that it requires less memory to save the context (i.e. the stack), because tasks are only switched at well defined points.

The disadvantage is of course that high priority tasks don't always get to run right away. In some cases, this can be mitigated by doing more in the interrupt handler itself, such as putting incoming data in a FIFO.


.



Relevant Pages

  • Re: RFC for a new Scheduling policy/class in the Linux-kernel
    ... B is holding a lock. ... A grants its priority B until B releases the lock. ... We want to charge B's critical section to B, ... scheduler computes how much time A has used recently, ...
    (Linux-Kernel)
  • [RFC][PATCH] O(1) Entitlement Based Scheduler
    ... This patch is a modification of the Oscheduler that introduces ... _entitlement_ to CPU resources that is determined by the number of _shares_ ... This patch provides both soft and hard CPU usage rate caps per ... one getting the most can be given a better priority, ...
    (Linux-Kernel)
  • Re: RFC for a new Scheduling policy/class in the Linux-kernel
    ... A grants its priority B until B releases the lock. ... We want to charge B's critical section to B, ... spent while holding locks. ... scheduler computes how much time A has used recently, ...
    (Linux-Kernel)
  • Re: Renice X for cpu schedulers
    ... (That's all that any of these dynamic priority heuristics ... really seem to do -- weight the scheduler towards switching to ... the design _intent_; but I think it's fairly accurate in terms of the ... non-threaded design of the X server makes it ...
    (Linux-Kernel)
  • [patch] 2.6.21-rc4 nicksched v32
    ... Considering the recent attention on CPU schedulers, ... but it is yet another scheduler. ... struct pipe_inode_info; ... 'User priority' is the nice value converted to something we ...
    (Linux-Kernel)