[fpc-devel] Parallel Computing

Boian Mitov mitov at mitov.com
Tue Nov 4 12:32:09 CET 2008


  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" <marcov at stack.nl>
To: "FPC developers' list" <fpc-devel at lists.freepascal.org>
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  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel 




More information about the fpc-devel mailing list