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

Graeme Geldenhuys graemeg.lists at gmail.com
Sat Sep 30 00:13:22 CEST 2006


On 29/09/06, Micha Nelissen <micha at neli.hopto.org> wrote:
> There is no bug. The time slice management is simply different. Try
> attached demo (it's your demo modified). You will notice that output
> will be mixed.
>
> Linux simply gives longer timeslices to threads (for efficiency reasons).
>
> Micha


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.

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.

Sorry for all the trouble... :-)

Regards,
  - Graeme -



More information about the fpc-pascal mailing list