Concurrency and Parallelism are related words but not same.
Parallelism is executing the multiple tasks simultaneously that help to increase the system speed. these tasks can run simultaneously on another processor core, another processor, or an entirely different computer that can be a distributed system. while concurrency is concerned with dealing with several things simultaneously or managing concurrent events while essentially hiding latency. The main aim of concurrency is to maximize the CPU by minimizing its idle time. While the current thread or process is waiting for input-output operations, database transactions, or launching an external program, another process or thread receives the CPU allocation.
Main Difference between Concurrency and Parallelism are detailed below
Concurrency is about dealing with lots of things at once. Parallelism is about doing lots of things at once. An application can be concurrent but not parallel, which means that it processes more than one task at the same time, but no two tasks are executing at the same time instant. An application can be parallel but not concurrent, which means that it processes multiple sub-tasks of a task in a multi-core CPU at the same time. An application can be neither parallel nor concurrent, which means that it processes all tasks one at a time, sequentially. An application can be both parallel and concurrent, which means that it processes multiple tasks concurrently in a multi-core CPU at the same time.
That’s all about Concurrency and Parallelism, a very important concept in java multi- threading concept.
Comments