On Sun, May 18, 2003 at 05:14:33PM +0100, Roger Hayter wrote: > With nice -10 there is much more context switching and paging, > presumably because threads are not being allowed to finish what they are > doing. In both cases, CPU is "idle" for 40-80% of time. Is there a way > of measuring "voluntary" and "involuntary" context switching in Linux? I > presume a thread waiting for bandwidth in some way will voluntarily > relinquish control of the CPU.
Yes, a process or (kernel) thread that tries to do IO without that being possible (buffer full, no data available etc) goes to sleep. Nice processese do indeed get smaller timeslices, which will hurt something as multithreaded as fred a lot. Try running all non-freenet processes at a scheduling prio higher than fred (see the schedutils package for chrt, a tool to change scheduling class and prio) without decreasing it's timeslice, or use kaffe, which does userspace threading and thus shouldn't get hurt too much by smaller timeslices. Keep in mind that in that setup freenet won't get a single tick of cputime as long as someone else wants it though, so anybody can disable freenet on your machine if they can force something to use 100% CPU, and it can interact badly with things that want to use freenet but use 100% cpu while doing so. Or if you're feeling adventurous you could change the NICE_TO_TICKS macro in linux/kernel/sched.c and adjust the scheduling to favour less nice tasks a little more, and having it do all slices equally long. -- Frank v Waveren Fingerprint: 21A7 C7F3 fvw@[var.cx|stack.nl|chello.nl] ICQ#10074100 1FF3 47FF 545C CB53 Public key: hkp://wwwkeys.pgp.net/fvw at var.cx 7BD9 09C0 3AC1 6DF2 _______________________________________________ devl mailing list devl at freenetproject.org http://hawk.freenetproject.org:8080/cgi-bin/mailman/listinfo/devl
