# Concurrency vs Parallelism

## Concurrency: dealing with multiple tasks at once

Example: trying to eat while having a conversation.

* It might be possible to do so, but you can't talk while chewing your food because you only have 1 mouth.
* Your mouth switch context so often between chewing and talking, you might think that you are doing both in parallel at the same time (but actually, no).
* In the context of software engineering, having 1 mouth in the example is the same as having only 1 thread.&#x20;
* Doing tasks asynchronously (with a single thread) will help us to achieve concurrency.

## Parallelism: doing multiple tasks at once

Example: eating while having a conversation, but you have 2 mouths.

* You have 2 mouths so you can eat and talk at the same time.
* If eating while having a conversation will make the it finish at 10 minutes, having 2 mouths will help you to finish it in 5 minutes.
* In the context of software engineering, having 2 mouths in the example is the same as having 2 threads with different cpu cores handling them.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://note.levelcode.org/software-engineering-notes/concurrency-vs-parallelism.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
