[fpc-devel] C++ gets language-internal concurrency support

David W Noon david.w.noon at ntlworld.com
Wed Aug 17 18:49:51 CEST 2011


On Wed, 17 Aug 2011 18:14:03 +0200 (CEST), Marco van de Voort wrote
about Re: [fpc-devel] C++ gets language-internal concurrency support:

> In our previous episode, David W Noon said:
> 
> > The threads t1 and t2 execute in parallel.  Moreover, they will
> > execute in parallel with any code that occurs between the
> > declaration that start the threads and the join() method calls that
> > synchronize them with the invoking thread.  On a SMP system they
> > will execute physically in parallel, not simply timesliced against
> > one another.  The underlying implementation model is that of POSIX
> > threads.
> 
> I know, but this is an explicit form of parallelism, and spawns one
> thread, not much different from Delphi tthread. (specially as coupled
> with anonymous methods in later versions)
> 
> The .NET/Prism "parallel for" however spawns multiple
> threads, one for each "for" iteration, probably with some maximum. 

This is like OpenMP and its parallelisation of FORTRAN DO-loops, which
can also be used for C/C++ for-loops.  It is quite a separate concept
from that of the std::thread class (and its vendor-supplied
predecessors).

> Note that I'm not so sure that the "parallel for" is a good (read:
> practical) thing to have, it is just that I noted some discrepancy in
> M. Schnell's original post where he tied the new C++ features to the
> Prism functionality.

Mu FORTRAN experience of it is that it is poor practice.  The
granularity of the workload is too fine for the context switching
overheads of threads.  Perhaps the slower execution speed of CIL (.NET,
Mono) byte code masks the context switching overheads and makes this
practice look less inefficient.
-- 
Regards,

Dave  [RLU #314465]
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
david.w.noon at ntlworld.com (David W Noon)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20110817/4f971755/attachment.sig>


More information about the fpc-devel mailing list