What's it called when multiple threads execute at the same time? Parallelism? Concurrency? 🤔 Is there a difference? (Spoiler: Yes!) Let me explain in a few tweets, ripping off @pressron's #InsideJava blog post "On Parallelism and Concurrency". 🧵 inside.java/2021/11/30/on-…
Parallelism: Taking a task and splitting it up, so multiple CPUs can compute partial solutions in parallel to solve the task in less wall-clock time. Concurrency: Having a number of tasks that need to be arranged in a way that solves as many of them per $time_unit as possible.
Some parallelizable tasks: * sorting an array * inverting a matrix * rendering graphics Some examples for concurrency: * processing incoming web requests * making outbound calls to DB and/or other web services * observe file system for changes
@nipafx Is it fair to view a concurrency as a subset of constraint solving problems? Also Is it fair to say, concurrency problems tries to keep a core as busy as possible. Arranging tasks such that a core is utilised to the fullest.
@nipafx What do you mean "arranged in a way"?If they're concurrently running why would there need to be any precedence? How does and order of them being run make sense if they are running concurrently?