putting-the-you-in-cpu icon indicating copy to clipboard operation
putting-the-you-in-cpu copied to clipboard

Coop mutitasking correction/clarification

Open itoshkov opened this issue 1 year ago • 0 comments

I just read chapter 2 and I really like the article so far.

I wanted to add a bit of clarification regarding the coop multitasking:

Rather than the OS deciding when to preempt programs, the programs themselves would choose to yield to the OS. They would trigger a software interrupt to say, “hey, you can let another program run now.” These explicit yields were the only way for the OS to regain control and switch to the next scheduled process.

The OS would use any system call to check if the process has consumed its time slice and to switch to another process. The yield system call was there for the case, where your program doesn't need to make system calls (e.g. it's doing some number crunching and all the data it needs is in memory already), but you still want to be a good citizen and to give the other processes a chance to run.

itoshkov avatar Aug 29 '23 07:08 itoshkov