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

Micha Nelissen micha at neli.hopto.org
Sat Sep 30 09:19:50 CEST 2006


Graeme Geldenhuys wrote:
> Ah, finally some explanation that makes sence!  Thanks Micha, your
> modified demo does in fact make Linux switch between threads.  I also
> tried the Sleep(0) you mentiond in the Sort Demo.  Sleep() didn't do
> the trick, but using the BurnCPU() method from Demo1 did.

Ok, maybe Sleep(0) in sysutils has to use the sched_yield syscall for
linux. This may be a feature request to be reported in bug tracker IMHO.

> Where can I read more about the timeslices to threads under Linux. It
> obviously works vastly different to Windows (and FreeBSD as someone
> 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.

http://kerneltrap.org/node/517/print is an interview with one of the
authors, Ingo Molnar. Search for 'timeslice length' if you don't want to
read it all :-).

Micha



More information about the fpc-pascal mailing list