Jump to content

  • Log In with Google      Sign In   
  • Create Account

Cooperative Multitasking system


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 rik_GT   Members   -  Reputation: 126

Like
0Likes
Like

Posted 19 January 2013 - 07:05 AM

Hi there

I'm trying to get around the concept of cooperative multitasking system and exactly how it works in a single threaded application.

My understanding is that this is a "form of multitasking in which multiple tasks execute by voluntarily ceding control to other tasks at programmer-defined points within each task."

So if you have a list of tasks and one task is executing, how do you determine to pass execution to another task? And when you give execution back to a previous task, how do resume from where you were previously?

I find this a bit confusing because I don't understand how this can be achieve without a multithreaded application.


Any advice would be very helpeful :)

Thanks



Sponsor:

#2 SiCrane   Moderators   -  Reputation: 9597

Like
3Likes
Like

Posted 19 January 2013 - 07:22 AM

Generally speaking, each unit of execution in a cooperative multitasking system still has it's own stack. The context switch mechanism preserves the stack for each unit of execution. For example, in Windows you can use cooperative multitasking via the fiber API. Switching to a different fiber is as simple as just calling the SwitchToFiber() function. How to figure out when to switch to another unit of execution depends on how you want the units of execution to share processing time; it's situation specific rather than one size fits all.

#3 rik_GT   Members   -  Reputation: 126

Like
0Likes
Like

Posted 19 January 2013 - 12:30 PM

Thanks for pointing out the fiber API ;)

 

Will have a look.

 

Thanks






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS