Concurrency (with Java) - pt 1

·

1 min read

Table of contents

No heading

No headings in the article.

A chunked up commentary about my understanding of concurrency.

Oftentimes, the term parallelism colloquially gets mixed up with concurrency. Lets debunk the terms individually.

Parallelism is multiple computations being performed at the same time (parallely). Concurrency is when these multiple computations interact in the process. Its a subtle distinction. Lets clear the air by considering an example: A system having a multicore processor that is processing two separate programs shows us what parallel computing is. However, when these programs interact during execution or share a resource or at the very least have something to do with eachother - they become concurrent while being parallel. Consider the case of a single processor system. A program being executed by multiple threads albeit one thread at a time gives a picture of pure concurrency without parallelism.

2 main kinds of concurrency come to mind. Domain Decomposition and Task Decomposition. A combination of the two is expected too. Usually in the context of large data the former is employed wherein the data is divided among several workers which perform the same task to different sets of data. While the latter involves each worker performing different tasks.

Something to note is that its not guaranteed that a concurrent approach is always faster compared to a sequential approach. Many factors weigh in.