Page 1 of 1

Bit of an idea for scheduling...

Posted: Sun Mar 11, 2007 3:14 am
by earlz
I no longer work on my OS much, but what do you think of this idea..

What if an application could schedule itself? or at least a thread..

kindof like

Code: Select all

...
{
  StopAndScheduleThreadNextFor(1000);
}

basically what this would do is tell the OS for this thread to run in 1000ms, or 1 second, and then waits for the current time slice to be over

This way there wouldn't just be an empty wait loop for 1000ms...the OS could give away the processing time to others..

This would be especially useful in sound drivers..imagine it, you put all the sound bytes into the DMA buffer, call this with something like 750ms or something(forgot how much time normal 44k time is..), copy the next chunk of sound into DMA, and repeat...just-in-time DMA..

Posted: Sun Mar 11, 2007 3:37 am
by ineo
Isn't it already the same with the sleep/nanosleep functions ?
What exactly would you like to achieve ?

I think I missed your point.

Posted: Sun Mar 11, 2007 10:12 am
by salil_bhagurkar
This does happen in operating systems. Taking your example when the application needs to put bytes in the dma buffer, it issues a system call and until the system call completes the application is blocked from running on the cpu unless the application needs to do other processing in that time. Hence other applications do get the advantage.