0

Someone said that:

Concurrency is like a person juggling with only 1 hand. Regardless of how it seems the person is only holding at most one ball at a time. Parallelism is when the juggler uses both hands.

I understand the main assumptions.

But can someone make references?

I mean:

balls - threads?

hand - process/core?

person - processor/core?

I know this is a strange question but I believe that it could solve a basic view on this subject.

EDIT

Based on your answers I must say I'm a bit confused.

I thought that the person is a process.

This process may have many threads.

No matter whether a computer is single or multi-cores.

So one hand would be one core.

So balls are threads. And this core can handle only one thread at the time.

If there is a single-core processor and more then one thread, concurrency could be present.

Threads are switched between each other. But only one thread works at a time.

If there are a multi-core processor and many threads, each thread can be done by each core separately exactly at the same time, so parallelism is present.

What do you think?

2 Answers2

1

My understanding is you're asking for technicals. I found this one to be a good explanation:

What is the difference between concurrent programming and parallel programming?

Here's a visual example. Threads on a non-threaded machine:

        --  --  --
     /              \
>---- --  --  --  -- ---->>
Threads on a threaded machine:

     ------
    /      \
>-------------->>

If you like gedamial's answer - show him some love!

  • There are so many misconceptions about definitions. For example, treating the processor as if it were the core. That's why I wanted a basic reference. – Ziemowit Andrzejewski Feb 05 '19 at 19:47
  • 1
    Core, or virtual core is a stable basis, in my opinion, rather than physical processor. Ie in GPUGPU this is perhaps even more visible - single processor houses hundreds 'cores'. For a purpose of the conversation fgpa could be another example - ie one piece of sillicon houses numerous gates. Please consult if this is of interest: https://www.uio.no/studier/emner/matnat/fys/FYS3240/v11/undervisningsmateriale/forelesninger/Lecture9%20%20Parallel%20programming%20v2.pdf. – Przemyslaw Iwanczak Feb 06 '19 at 08:12
0

Concurrency is a design where a program can continue to function without an expectation of an evaluation of a task until a certain later point,
Parallelism is one of the implementations of this design, another common one being context switching,
It's a design consideration where you allow for safe assumption that the result of the task will be non-blocking.

In this metaphor the hand is the thread executing the program, the ball is the task being executed, and the person would be the running process.
The example of a person juggling with one hand is that of context switching, you can change between separate tasks within a process and this will allow him to handle several tasks at the same time, but ultimately he never holds more than one ball at a time
Using a second hand is an implementation where he uses a second thread (hand) to simultaneously handle two tasks.

Here's a pretty straight-forward post explaining this concept https://www.quora.com/What-is-the-difference-between-concurrency-and-parallelism

Scy
  • 245
  • 1
  • 12