Multithreading - you need to know a few concepts

1. Synchronization (Synchronous) and asynchronous (Asynchronous)

  Synchronous and asynchronous usually used to describe a method call.

  Once the synchronization method call, the caller must call the method returns to continue until the subsequent behavior.

  Like an asynchronous method invocation messaging, once started, the method call returns immediately, the caller can continue the subsequent operations.

  

2. concurrent (Concurrency) and parallel (of Parallelism)

  Concurrency and parallelism are two concepts very easily confused, they can perform together represent two or more tasks, but with different emphases.

  Emphasis on the concurrent execution of multiple tasks alternately, there is a possibility between multiple tasks or serial, and parallel is "both" in the true sense

  

3. Critical Area

  The critical area is used to indicate a public resource or shared data can be used by multiple threads. But each time, only one thread to use it, but a critical resource area is occupied, in order to use this resource other threads must wait.

  eg: a printer can only perform one task, the rest of the wait is currently being executed after the execution;

4. blocked (Blocking) and non-blocking (Non-Blocking)

  Blocking and non-blocking usually used to describe the interaction between multithreaded.

  Obstruction: a thread holds the critical area resources. Then all other resources needed in this thread must wait in this critical area. Waiting causes the thread to hang;

  Non-blocking the contrary, it stresses that there is a thread can interfere with other threads, all threads will attempt to continue to perform forward;

 

5. deadlock (Deadlock)
  deadlock: two or more threads need to hold each other's resources, resulting in an infinite wait;

  

Guess you like

Origin www.cnblogs.com/SuperManer/p/11639539.html