Java concurrency multithreading part 1

Java concurrency Multi-threading part 1 is discussing the multiple threads of execution inside the same application. In other way, multi-threading application is like an application that has multiple CPUs executing different parts of the code at the same time.

Java concurrency multithreading part 1

Also, possible to have the threads of an application be executed by different CPU in same time.

Benefits.

  1. Better utilize the computer resources.
  2. Utilize and contains multiple CPUs or the CPU contains multiple execution cores.
  3. provide a better user experience.
  4. share resources of a computer more fairly among users.

Difference Between Multi-threading and Multi-tasking

Multithreading.

  • Execute multiple programs at same time.
  • CPU switching involve between the threads often.
  • component does not involve multi processing.
  • Fast.
  • Termination of thread takes less time.
  • Each process shares same resources.

Multitasking.

  • Multiple threads of execution inside the same program.
  • Multitasking involves often CPU switching between the tasks.
  • Separate memory.
  • Slow.
  • Termination of process takes more time.
  • each process is allocated separate resources.

More about .

  • This is the great way to increase the program performance.
  • Multi-threading is challenging than multi-tasking, so this is little bit hard.
  • Executing within the same program and are hence reading
  • and writing the same memory .
  • Errors not show on single CPU machines because thread is execute separately.

Multi-threading and concurrency in java.

Multitasking – Multiple tasks/processes running concurrently on a single CPU, 

Multiple parts of the same program running concurrently.

Concurrency Model.

  • Multiple threads executing within the same application this is called
  • shared state concurrency model. concurrency model in another way
  • is specifies how threads in the system collaborate to complete the tasks they are given. 
  • Different concurrent model split the tasks in different ways.
  • Also communicate with the thread in different ways.

 Concurrency promises to perform certain task faster in the program. Concurrency of the java is allowing us to run the several programs parallel. The backbone of the java concurrency is threads and above we have discussed the multithreading. Multi-threading is the hardest part of the concurrency.

PHP Tutorial 01.

One thought on “Java concurrency multithreading part 1”

Leave a Reply

Your email address will not be published. Required fields are marked *