Hey folks! I was recently reading the book "Use Your Head - java", and at the beginning of it there is a part where he says that the best way to teach is by adding images that match the text while explaining the content in a more colloquial language, and I I think the best way to learn is to teach, so I'm going to try to combine a little of both to see if I can stick this content in my head better.
In short, parallelism means you are dealing with several things at the same time
Concurrency is as if you were switching between tasks but only doing one at a time.
Imagine you're a busy chef:
Concurrency: You're cooking a big meal and you're juggling multiple tasks. You're chopping vegetables for a salad, heating up a pan for the steak, and setting the table. You're doing all these things, but one at a time. You might pause to check on the steak, then go back to chopping. It's like having a lot of plates spinning in the air.
Parallelism: Now imagine you have a sous-chef. You can both work on the meal at the same time. You're cooking the steak, and they're making the salad. You're both working on different parts of the meal simultaneously, which means the whole meal is getting ready faster.
Challenge:
Try finding a simple task in your daily life that can be done concurrently and another that benefits from parallelism. Share your examples in the comments below!
Top comments (0)