Task scheduler infinite loop

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
rdos
Member
Member
Posts: 3306
Joined: Wed Oct 01, 2008 1:55 pm

Re: Task scheduler infinite loop

Post by rdos »

Combuster wrote:
ManyGifts wrote:Yes, I would like to use hardware task switching as it's my first kernel.
It's exactly the opposite: you do not want hardware task switching for reasons of simplicity.
Mostly you want to avoid hardware task switching because it doesn't work well with multicore CPUs, as the switching process is modifying descriptor types. Another problem is that you will often double save registers when using hardware task switching, which is caused by a badly designed interface where you must both load and save task state in one step. A typical software task switcher will first save the registers of the incoming task, select a new task, and then load a new task.
linguofreak
Member
Member
Posts: 510
Joined: Wed Mar 09, 2011 3:55 am

Re: Task scheduler infinite loop

Post by linguofreak »

bwat wrote:I don't think you've fully understood the terms you've used.
thomasloven wrote:Switching tasks when a process blocks helps in order to avoid bussy waiting
No. Switching tasks has nothing to do with avoiding busy waiting.
Busy waiting is when you continuously poll for a change in state.
In other words, it's when you're very busy doing nothing while you wait for something to do.
If the process blocks then it performs no work. The process cannot by definition be busy when blocked.


On a well designed system where the OS keeps a list of blocked processes that it then does not schedule to run, yes. On a crappily designed system where there's no such thing as blocking at the OS level, the process has to implement it itself, and the best it can do is busy waiting. In that case the process is both busy and blocked (or as close to blocked as you can get on such a system).
Post Reply