[fpc-pascal] Threading vs Parallelism ?

noreply at z505.com noreply at z505.com
Wed Apr 12 14:52:17 CEST 2017


On 2017-03-30 11:29, Jon Foster wrote:
> 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 modify the film format...

Example: create a 10 hour video that is composed of 100 files.

You have 100 computers, or 100 threads, or, 100 processes..Each computer 
creates 1 file.
The video is composed of 100 files but is really just a single video.

You open up VLC to play the video, and it opens 100 files, but the end 
user just opens a single file that links to each of these 100 files.

This could be the stupidest ridiculous parallel video creation technique 
ever. I'm not sure...
Or it could be an idea...



> 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.

What about the difference between parallelism vs concurrency?

Rob Pike has some videos on it and meetup events discussing it on 
youtube.



More information about the fpc-pascal mailing list