changing scheduling slice time
Phillip Susi
psusi at cfl.rr.com
Wed Dec 7 20:19:19 UTC 2005
Patrick Wagstrom wrote:
> So I've got a bit of an issue. I've noticed that Ubuntu tends to force
> a lot of context switches on the system, my breezy systems average about
> 2000 context switches a second (as reported by dstat) and around 1000
> interrupts/s. While this is good for creating a really responsive OS,
> it's bad for some cases, at least I think so.
>
Just because you have a lot of context switching does not mean that the
kernel is preempting tasks after a short time slice. It may simply be
the processes you are running tend to wake up and process a small amount
of data before going back to sleep.
> Specifically, the case I'm referring to is reading data from HDTV tuner
> cards. It appears that under Ubuntu, the large amount of context
> switches don't allow programs to ever completely clear out the buffer.
> Add in more tasks, the less likely it is to clear out the buffer. This
> isn't because of the load, more because the slices aren't long enough to
> copy all of the data out of the buffer onto the disk.
>
What makes you think it doesn't empty the buffer before it goes back to
sleep? It may just be waking up and consuming all of the data in the
buffer in small chunks, so there are a lot of context switches.
> When the system is under basically no load and the capture program is
> the only thing running, it has no problem getting a perfect data stream.
> However, if I start watching the stream at the same time as it's
> recording, even if it never hits the disk, the increased task switching
> and small time slice, causes the buffers to overfill.
>
Again, what do you base this conclusion on? When you are doing this
what is your cpu load? It may simply be that your cpu can't manage to
capture and encode the video while decoding and playing it all in real
time. This may have to do with the codec you are using ( one that is
rather cpu intensive? ).
> As a reference, I performed a similar test under fedora core 4, which
> averages to about 300 interrupts/s while idle and around 35 context
> switches. Even under heavy heavy load (copying lots of files, rendering
> with pov-ray in the background, etc), it was able to keep up with no
> problem.
Was this with the same video capture/encoder program using the same
settings?
>
> So, can anyone tell me how to change the scheduling slice time in
> Ubuntu? I'd hate to have to abandon Ubuntu and set everything up again
> with Fedora if it's just a matter of a kernel recompile or something
> simple like that.
>
> Thanks!
>
> --Patrick
> http://patrick.wagstrom.net/
>
>
More information about the ubuntu-users
mailing list