Synchronous and asynchronous

Synchronous, that is, the method is called and once called it must wait for the method to complete its return before continuing.

For example, if you go to the ATM of the bank to withdraw money, you have to wait until the ATM is finished and you get the money and withdraw the card before you can leave.

Asynchronous, Asynchronous, a method that does not care about method execution, fires the method to be invoked and continues, not blocking until the method completes, as synchronous does.

, for example, you want to take money this time, number is larger, the bank said you make an appointment or direct phone APP how much you want to take cash, the bank will prepare money for you this time, and this has nothing to do with you, then you just press the time set to get that for you, you are the triggers an asynchronous action.

Concurrency and parallelism

Concurrency is the Concurrency of multiple tasks running for a period of time, but not necessarily at the same time. They may run alternately or sequentially.

Parallelism, Parallelism, Parallelism, Parallelism, Parallelism, Parallelism, Parallelism.

A single-core CPU does not have parallel operations because a CPU can only execute one instruction at a time, and parallel operations only exist in multi-core cpus.

Blocking and non-blocking

When a thread is Blocking a common resource and does not release the lock, it is Blocking that other threads are waiting for it to release the lock.

Non-blocking means that threads are free to run without Blocking, not locking public resources, and not Blocking each other.

Read more on my blog:

1.Java JVM, Collections, Multithreading, new features series tutorials

2.Spring MVC, Spring Boot, Spring Cloud series tutorials

3.Maven, Git, Eclipse, Intellij IDEA series tools tutorial

4.Java, backend, architecture, Alibaba and other big factory latest interview questions

Life is good. See you tomorrow