Actually here a "good" implementation of _parallel_ for can be beneficial,
if it implements the pool for sure without Spin Locks. Most developers
(including me until recently), are probably unaware that Windows, Linux, and
Solaris, switch to Spin Locks when you have multiple cores. I thought a
context switch was always done on Lock, but it appears I was wrong. This
means that thread pools will waste CPU cycles if they are blocked by locks,
a good _parallel_ for implementation can ensure proper pool implementation
and thus improve performance.
With best regards,
Boian Mitov
-------------------------------------------------------
Mitov Software
www.mitov.com
-------------------------------------------------------
----- Original Message -----
From: "Marco van de Voort" <[EMAIL PROTECTED]>
To: "FPC developers' list" <[email protected]>
Sent: Tuesday, November 04, 2008 3:22 AM
Subject: Re: [fpc-devel] Parallel Computing
In our previous episode, Boian Mitov said:
True, in their case it is core pool. Another concern is that in multicore
situation the operating systems tend to use spinlocks for the threads
instead of context switching locks. This probably will lead to CPU waste
if
locks are used to suspend the threads in the pool.
Well, that is the responsibility of the programmer. He can choose between
a
_paralel_ for and a non paralel one. But indeed it could be a waste if
some
iterations of the for loop can last longer than others.
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel