[fpc-pascal] Threading vs Parallelism ?
Jon Foster
jon-lists at jfpossibilities.com
Thu Mar 30 18:29:15 CEST 2017
On 03/29/2017 01:15 PM, Michael Van Canneyt wrote:
>
>
> On Wed, 29 Mar 2017, Dimitrios Chr. Ioannidis via fpc-pascal wrote:
>
>> Hi,
>>
>> On 29/3/2017 9:57 μμ, fredvs wrote:
>>> Hello.
>>>
>>> Some developers treat me as dinosaur because I use threads in place of
>> doing
>>> parallelism.
>>>
>>> Huh, ok, but why parallelism is better and how to do it with fpc ?
>>
>> a nice article I've found long ago when I was researching the same
>> topic "Threading/Concurrency vs. Parallelism" is the following :
>>
>> http://tutorials.jenkov.com/java-concurrency/concurrency-vs-parallelism.html
>>
>>
>> and I tried the multithreadprocslaz package in Lazarus :
>>
>> http://wiki.freepascal.org/Parallel_procedures
>
> Showing nicely that parallelism in a single process implies threads.
> I would not pay too much attention to what these developers are saying.
>
>
Either I'm dense, which is entirely possible, or the author of that article
didn't do a good job of making his point, even assuming he had one.
Thinking about this a bit more I would say that "threads" are a means
(vehicle) to achieve parallelism. I think that in the majority of
programming contexts they are synonymous. But I can think of other contexts
where they may not be: Say animating a film. You have 1000 computers
generating frames to be assembled into a final sequence. The process of
dispatching each frame render is most likely not going to be done with the
OSes thread call, but through a networked work queue of some sort (ala
Torque or something). So you have the "task" (rendering the movie) being
worked on in "parallel" via a networked job dispatch mechanism.
Or the case of using "make -j ..." which "forks" multiple jobs (compile,
link, ...) in parallel based on a dependency tree.
I say threading is parallelism, even if just one form of it. The other
methods of parallelism I mentioned here could also be done in FPC with the
appropriate code. But that is a rather nebulous topic to discuss. Concrete
answers for which are only available when you know how a specific job needs
to be broken up.
I'm still looking for a good easy to use job queue myself...
-Jon
--
Jon Foster
JF Possibilities, Inc.
jon at jfpossibilities.com
More information about the fpc-pascal
mailing list