I believe this answer to be more correct than the existing answers and editing them would have changed their essence. I have tried to link to various sources or wikipedia pages so others can affirm correctness.
Concurrency: the property of a system which enables units of the program, algorithm, or problem to be executed out-of-order or in partial order without affecting the final outcome 1 2.
A simple example of this is consecutive additions:
0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 = 45
Due to the commutative property of addition the order of these can be re-arranged without affecting correctness; the following arrangement will result in the same answer:
(1 + 9) + (2 + 8) + (3 + 7) + (4 + 6) + 5 + 0 = 45
Here I have grouped numbers into pairs that will sum to 10, making it easier for me to arrive at the correct answer in my head.
Parallel Computing: a type of computation in which many calculations or the execution of processes are carried out simultaneously 3 4. Thus parallel computing leverages the property of concurrency to execute multiple units of the program, algorithm, or problem simultaneously.
Continuing with the example of consecutive additions, we can execute different portions of the sum in parallel:
Execution unit 1: 0 + 1 + 2 + 3 + 4 = 10
Execution unit 2: 5 + 6 + 7 + 8 + 9 = 35
Then at the end we sum the results from each worker to get 10 + 35 = 45
.
Again, this parallelism was only possible because consecutive additions have the property of concurrency.
Concurrency can be leveraged by more than just parallelism though. Consider pre-emption on a single-core system: over a period of time the system may make progress on multiple running processes without any of them finishing. Indeed, your example of asyncronous I/O is a common example of concurrency that does not require parallelism.
Confusion
The above is relatively straightforward. I suspect people get confused because the dictionary definitions do not necessarily match what was outlined above:
- Concurrent: occurring or existing simultaneously or side by side 5.
- Concurrency: the fact of two or more events or circumstances happening or existing at the same time From searching on google: "define: concurrency".
The dictionary defines "concurrency" as a fact of occurrence, whereas the definition in the computing vernacular is a latent property of a program, property, or system. Though related these things are not the same.
Personal Recommendations
I recommend using the term "parallel" when the simultaneous execution is assured or expected, and to use the term "concurrent" when it is uncertain or irrelevant if simultaneous execution will be employed.
I would therefore describe simulating a jet engine on multiple cores as parallel.
I would describe Makefiles as an example of concurrency. Makefiles state the dependencies of each target. When targets depend on other targets this creates a partial ordering. When the relationships and recipes are comprehensively and correctly defined this establishes the property of concurrency: there exists a partial order such that order of certain tasks can be re-arranged without affecting the result. Again, this concurrency can be leveraged to build multiple rules simultaneously but the concurrency is a property of the Makefile whether parallelism is employed or not.