One, synchronous and asynchronous:
Synchronization: The caller needs to wait for the callee to respond before the next action can take place.
Async: The caller does not need to wait for the callee to respond and proceed directly to its own action. There may be a response from the callee at some point in the future.
Two, concurrency and parallelism
Parallelism refers to the occurrence of two or more events at the same time, while concurrency refers to two or more events that occur within the same interval .
Three, critical section
The code that accesses the critical resource in each process is called a critical section (a Critical section) (A critical resource is a shared resource that only one process is allowed to use at a time). Only one process is allowed to enter the critical section at a time.
The scheduling principle of a process entering a critical section is:
1. If there are several processes that require access to an idle critical section, only one process is allowed to enter at a time. 2. At any time, there must be more than one process in the critical area. If a process has entered its own critical section, all other processes attempting to enter the critical section must wait. 3, the process of entering the critical area should be exited within a limited time so that other processes can enter their critical areas in time. 4, if the process can not enter their own critical section, you should give up the CPU, to avoid the process of "busy" phenomenon. Four, blocking and non-blocking blocking are not allowed to come back,
Non-blocking is what you do first, I'll see if there's anything else. Blocking and non-blocking are often used to describe the interaction between multiple threads. For example, if a thread occupies a critical section resource, all other threads that need the resource must wait in this critical section, waiting for the thread to hang. This situation is blocking. At this point, if the resource-hogging thread has been reluctant to release resources, all other threads that are blocking the critical section will not work.
Non-blocking allows multiple threads to enter the critical section at the same time
Blockingqueue in Java is the blocked Representative class
Java Concurrency Concept-1