[fpc-pascal] Threads executing in sequence instead of parallel

Micha Nelissen micha at neli.hopto.org
Sat Sep 30 09:23:21 CEST 2006

Graeme Geldenhuys wrote:
> pointed out).  This sounds like an interesting topic and something
> work understanding.  After all, it gave me enough headaches and a
> false positive - thinking it is a bug.

Btw, here is a quote from the interview, default length seems to be
150ms: (it also explains the usefulness of longer timeslices: caches)

another property of SCHED_BATCH scheduling is the use of much longer
timeslices. Eg. right now it's 3 seconds for a default priority
SCHED_BATCH task - while normal tasks have 150 msec timeslices. For
things like numeric calculations it's good to have as long timeslices as
possible, to minimize the effect of cache trashing. Eg. on a
sufficiently powerful CPU with a 2 MB L2 cache, the 'population time' of
the cache can be as high as 10 milliseconds. So if there are two numeric
calculation tasks that both fully utilize the L2 cache (in nonobvious
patterns), and which context-switch every 150 milliseconds, then they
will waste 10 milliseconds on cache-rebuilding in the first 6% of their
timeslice. This shows up as a direct 6% slowdown of the numeric
calculation jobs. Now, if SCHED_BATCH is used, and each task has a 3000
milliseconds timeslice, then the cache-rebuild overhead can be at most
0.3% - a far more acceptable number.


More information about the fpc-pascal mailing list