Bit of an idea for scheduling...

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.
Post Reply
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Bit of an idea for scheduling...

Post 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..
ineo
Posts: 19
Joined: Wed Oct 18, 2006 3:20 am

Post 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.
User avatar
salil_bhagurkar
Member
Member
Posts: 261
Joined: Mon Feb 19, 2007 10:40 am
Location: India

Post 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.
Post Reply