Re:Real-Time Scheduling
Posted: Wed Aug 20, 2003 4:02 am
what is closest to a real-time system on a legacy PC is MP3/video streaming. Your decoded frames have to be made ready on time so that they're not missed by the playback device.
Unfortunately, as those frames usually come from a mass storage device that has no realtime constraint (i.e. you can't determine how long the FS will need to find the next block of the encoded stream) and go through a codec which may need variable processing time (afaik, you can't predict how long a frame will need for decoding by just looking at the encoded stream, can you?) you lack informations to know how much in advance you must run the thread.
Now, you could still improve the quality of the playback by telling the disk requests scheduler "you failed to deliver 3 frames on deadlines, i want my request to become even more important" and by giving more buffer space for your 'input stream' (so that less head displacement are required) ...
You could also try to do the same for the CPU: if you see you fail to decode the frames with the given priority, make a larger playout buffer and slightly increase your thread's weight on the system.
btw, anyone who blame your OS to start a defrag or disk indexing while he's watching a DivX is just a looser that can't edit a cron job (imho)
Unfortunately, as those frames usually come from a mass storage device that has no realtime constraint (i.e. you can't determine how long the FS will need to find the next block of the encoded stream) and go through a codec which may need variable processing time (afaik, you can't predict how long a frame will need for decoding by just looking at the encoded stream, can you?) you lack informations to know how much in advance you must run the thread.
Now, you could still improve the quality of the playback by telling the disk requests scheduler "you failed to deliver 3 frames on deadlines, i want my request to become even more important" and by giving more buffer space for your 'input stream' (so that less head displacement are required) ...
You could also try to do the same for the CPU: if you see you fail to decode the frames with the given priority, make a larger playout buffer and slightly increase your thread's weight on the system.
btw, anyone who blame your OS to start a defrag or disk indexing while he's watching a DivX is just a looser that can't edit a cron job (imho)