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

2006-09-30 Thread Micha Nelissen
Marco van de Voort wrote: >> 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. > > Ugly. Better define a procedure TryYieldTimeSlice() or so. No need to follow > Windowisms with archaic reasons. Yes ag

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

2006-09-30 Thread Marco van de Voort
> > 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 m

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

2006-09-30 Thread Micha Nelissen
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 th

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

2006-09-30 Thread Micha Nelissen
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. O

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

2006-09-29 Thread Graeme Geldenhuys
On 29/09/06, Micha Nelissen <[EMAIL PROTECTED]> 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, f

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

2006-09-29 Thread Micha Nelissen
Graeme Geldenhuys wrote: > The Sort Demo, which is a port of the Threads demo included with > Delphi 7, shows this clearly. I can archive and post the source, but Try inserting some Sleep(0) to force the kernel to switch to another thread ? In real worker threads you wouldn't do this of course, b

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

2006-09-29 Thread Micha Nelissen
Graeme Geldenhuys wrote: > We have a problem!!! > > The test project /fcl/tests/threads.pp as well as a Sort Demo (Bubble, > Section and Quick Sort) all execute the threads in sequence, waiting > for the previous thread to complete, before the next one executes. > Kind of defeats the point of usin

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

2006-09-28 Thread Graeme Geldenhuys
So far using FPC 2.0.2 and 2.0.4 and latest Lazarus (svn) it works fine under Windows. I am now busy building FPC 2.1.1 (svn) under Windows and will redo the whole process. Will post the result shortly Regards, - Graeme - On 28/09/06, Vincent Snijders <[EMAIL PROTECTED]> wrote: Graeme G

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

2006-09-28 Thread Graeme Geldenhuys
The only FPC/Lazarus for windows I have is under the same VMWare session as I used for Delph 7. And yes it works there, using FPC 2.0.2 with a Lazarus 0.9.15 (9152). I'll be at home in a hour, so then I can try under FPC 2.1.1 and latest Lazarus. Regards, - Graeme - On 28/09/06, Vincent Snij

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

2006-09-28 Thread Vincent Snijders
Graeme Geldenhuys wrote: Just to give some more feedback. Using that same Sort App, I compiled it under Delphi 7, and ran it under Linux using WINE and the threading worked correctly. So somewhere in FPC or Lazarus lies the problem. Yeah I know, not very specific. :-) Can you try running the

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

2006-09-28 Thread Graeme Geldenhuys
Just to give some more feedback. Using that same Sort App, I compiled it under Delphi 7, and ran it under Linux using WINE and the threading worked correctly. So somewhere in FPC or Lazarus lies the problem. Yeah I know, not very specific. :-) Graeme. On 28/09/06, Graeme Geldenhuys <[EMAIL P

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

2006-09-28 Thread Graeme Geldenhuys
Attached is the Sort Demo - for incase you have Lazarus. Graeme. On 28/09/06, Graeme Geldenhuys <[EMAIL PROTECTED]> wrote: ok, I see hundreds of a's - press b and quite a bit later I see hundreds of b's. Do you have lazarus? I can then post the Sort Demo to show that one as well. Regards,

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

2006-09-28 Thread Graeme Geldenhuys
ok, I see hundreds of a's - press b and quite a bit later I see hundreds of b's. Do you have lazarus? I can then post the Sort Demo to show that one as well. Regards, - Graeme - On 28/09/06, Marco van de Voort <[EMAIL PROTECTED]> wrote: > The test project /fcl/tests/threads.pp I see rando

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

2006-09-28 Thread Marco van de Voort
> The test project /fcl/tests/threads.pp I see random alteration of a and b here. > The threads.pp test project in fcl, shown a lot of a's on the screen > and after a while, starts displaying b's on the screen. Looking at > the source, I gather the a's and b's are supposed to be mixed as each >

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

2006-09-28 Thread Graeme Geldenhuys
We have a problem!!! The test project /fcl/tests/threads.pp as well as a Sort Demo (Bubble, Section and Quick Sort) all execute the threads in sequence, waiting for the previous thread to complete, before the next one executes. Kind of defeats the point of using threads. The Sort Demo, which is