Java Concurrency

Amdahl’s Law: If P is the part of a program that can be run in parallel on N processors, and (1 − P) is the part that cannot be parallelized and must run sequentially, then the maximum speedup that can be achieved by using N processors is

\frac{1}{(1-P) + \frac{P}{N}}.

Using Threads to tasks in parallel, causes 2 issues we must take care of:

  1. Visibility : Am I looking at the “Most Updated Data”?
  2. Access : I want to change D and He wants to change D as well, both on the same time.

If either of the above is not taken care of properly, it can result into problems like Deadlocks, Incorrect Data and so on.

Continued…

Comments are disabled for this post