Re: [fpc-pascal] getting started with threads

2009-09-21 Thread Marco van de Voort
In our previous episode, Jonas Maebe said: I use own lockfree FIFO http://www.emadar.com/fpc/lockfree.htm to distribute task between threads its much faster and well scaling on multicore. Note that it won't work as is on non-x86 machines, because it's missing memory barriers (and I

Re: [fpc-pascal] getting started with threads

2009-09-19 Thread Dariusz Mazur
Helmut Hartl pisze: -Original message- From: Dariusz Mazur dar...@emadar.com Sent: Fri 18-09-2009 16:24 To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org; Subject: Re: [fpc-pascal] getting started with threads David Emerson pisze: I am getting started

Re: [fpc-pascal] getting started with threads

2009-09-19 Thread Micha Nelissen
Jonas Maebe wrote: on x86 too). Atomic operations are not memory barriers by themselves, and the fact that you perform an atomic operation does not mean that afterwards all cpu's will immediately see this new value. Explain? Isn't the point of an atomic update that it doesn't matter whether

Re: [fpc-pascal] getting started with threads

2009-09-19 Thread Jonas Maebe
On 19 Sep 2009, at 10:36, Micha Nelissen wrote: Jonas Maebe wrote: on x86 too). Atomic operations are not memory barriers by themselves, and the fact that you perform an atomic operation does not mean that afterwards all cpu's will immediately see this new value. Explain? Isn't the

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Vincent Snijders
David Emerson schreef: I am getting started with threads (linux/cthreads) and I'm very happy so far, but unsure of the best way to tackle my situation. I have a program that needs to perform about 10,000 independent tasks, which usually involve waiting for I/O; thus it makes sense to use

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Dariusz Mazur
David Emerson pisze: I am getting started with threads (linux/cthreads) and I'm very happy so far, but unsure of the best way to tackle my situation. I have a program that needs to perform about 10,000 independent tasks, which usually involve waiting for I/O; thus it makes sense to use

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Jonas Maebe
On 18 Sep 2009, at 16:24, Dariusz Mazur wrote: I use own lockfree FIFO http://www.emadar.com/fpc/lockfree.htm to distribute task between threads its much faster and well scaling on multicore. Note that it won't work as is on non-x86 machines, because it's missing memory barriers (and I

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Florian Klaempfl
Jonas Maebe schrieb: On 18 Sep 2009, at 16:24, Dariusz Mazur wrote: I use own lockfree FIFO http://www.emadar.com/fpc/lockfree.htm to distribute task between threads its much faster and well scaling on multicore. Note that it won't work as is on non-x86 machines, because it's missing

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Dariusz Mazur
Jonas Maebe pisze: On 18 Sep 2009, at 16:24, Dariusz Mazur wrote: I use own lockfree FIFO http://www.emadar.com/fpc/lockfree.htm to distribute task between threads its much faster and well scaling on multicore. Note that it won't work as is on non-x86 machines, because it's missing memory

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Jonas Maebe
On 18 Sep 2009, at 21:30, Dariusz Mazur wrote: On 18 Sep 2009, at 16:24, Dariusz Mazur wrote: I use own lockfree FIFO http://www.emadar.com/fpc/lockfree.htm to distribute task between threads its much faster and well scaling on multicore. Note that it won't work as is on non-x86

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Dariusz Mazur
Jonas Maebe pisze: On 18 Sep 2009, at 21:30, Dariusz Mazur wrote: On 18 Sep 2009, at 16:24, Dariusz Mazur wrote: I use own lockfree FIFO http://www.emadar.com/fpc/lockfree.htm to distribute task between threads its much faster and well scaling on multicore. Note that it won't work as is

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Jonas Maebe
On 18 Sep 2009, at 23:04, Dariusz Mazur wrote: But is this optimal solution: procedure SysThreadSwitch; begin Sleep(0); end; WinThreadManager.ThreadSwitch :=...@systhreadswitch; procedure ThreadSwitch; begin CurrentTM.ThreadSwitch; end; We have 2 unnecessary invoke

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Helmut Hartl
-Original message- From: Dariusz Mazur dar...@emadar.com Sent: Fri 18-09-2009 16:24 To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org; Subject: Re: [fpc-pascal] getting started with threads David Emerson pisze: I am getting started with threads (linux/cthreads) and I'm

[fpc-pascal] getting started with threads

2009-09-17 Thread David Emerson
I am getting started with threads (linux/cthreads) and I'm very happy so far, but unsure of the best way to tackle my situation. I have a program that needs to perform about 10,000 independent tasks, which usually involve waiting for I/O; thus it makes sense to use several threads so that some

Re: [fpc-pascal] getting started with threads

2009-09-17 Thread Mark Emerson
Nice to see you posted this. Love, Dad On Thursday 17 September 2009 06:07:48 pm David Emerson wrote: I am getting started with threads (linux/cthreads) and I'm very happy so far, but unsure of the best way to tackle my situation. I have a program that needs to perform about 10,000