5

I read that it is possible to have parallelism without concurrency. Is this correct?

Suppose you have two tasks, A and B, and each require two steps to complete: A1, A2, B1, B2. Also, a process is composed of threads.

Here I how I think of concurrency and parallelism:

Sequential

          Time ----->
Thread 1: A1 A2 B1 B2

Concurrent

          Time ----->
Thread 1: A1    A2  
Thread 2:    B1    B2

Parallel (and concurrent)

          Time ----->
Thread 1: A1 A2
Thread 2: B1 B2

If this is correct, then it wouldn't be possible to have parallelism without concurrency.

Also, if this model is correct, you could have the following:

Sequential (and concurrent)

          Time ----->
Thread 1: A1    B1  
Thread 2:    A2    B2

This probably wouldn't be a good idea, but it seems conceptually possible.

anon
  • 2,143
  • 3
  • 25
  • 37

2 Answers2

2

From wikipedia

Parallel computing is closely related to concurrent computing—they are frequently used together, and often conflated, though the two are distinct: it is possible to have parallelism without concurrency (such as bit-level parallelism), and concurrency without parallelism (such as multitasking by time-sharing on a single-core CPU). In parallel computing, a computational task is typically broken down in several, often many, very similar subtasks that can be processed independently and whose results are combined afterwards, upon completion. In contrast, in concurrent computing, the various processes often do not address related tasks; when they do, as is typical in distributed computing, the separate tasks may have a varied nature and often require some inter-process communication during execution.

Using that explanation as a guide I think your assessment is accurate, but it is missing parallelism without concurrency, which is mentioned in the quote above.

Jose Martinez
  • 11,452
  • 7
  • 53
  • 68
1

First, you can't execute tasks sequentially and at the same time have concurrency. Concurrency implies that more than one task can be in progress at any given time (which obviously contradicts sequentiality). So your last picture is not about concurrency.

And it's not about parallelism as well (because there is no simultaneous execution).

So you drew a sequential execution despite the number of worker threads.

Regarding the parallelism without concurrency: according to all sources I've read, the picture would be

          Time ----->
Thread 1: B1 B3 A1
Thread 2: B2    A2

where B1, B2 and B3 are subtasks of task B.

As we can see, A and B tasks are executed sequentially (i.e. not concurrently), but are executed using parallelism (because their subtasks are executed simultaneously).

Of course, questions arise: "how can we start executing another subtask before we get the result of the previous one?" and "what conceptually distinguishes a task (intuitively independent of other tasks) from a subtask (which is a part of some sequence that forms a task)?". In other words, why are we talking about B1, B2, B3, A1, A2 subtasks instead of independent tasks T1, T2, T3, T4 and T5? But I leave it for those who, unlike me, can shed some light on this issue.

Ilya Serbis
  • 21,149
  • 6
  • 87
  • 74