Synchronous asynchronous non-blocking blocking

Synchronous and asynchronous

The so-called synchronization is to complete a task relies on other tasks, just waiting to be dependent on the completion of the task, the task can be considered dependent on the completion of this task is a reliable sequence. Either succeed are successful, failed and failed, two state of the task can be consistent. The asynchronous is no need to wait to be dependent on completion of the task, but notification is dependent on what work tasks to complete, depending on the tasks executed immediately, as long as they completed the task is complete. As a final task was dependent on whether truly complete, depending on its mission can not be determined, so it is unreliable task sequence. We can call and send text messages to good analogy synchronous and asynchronous operation.

In the design of the IO process usually encountered in a synchronous or asynchronous mode selection process is. Because synchronous and asynchronous lot of I / O processing methods on the caller, will encounter this problem in database products. Because the I / O operation is usually a time-consuming operation, I / O performance bottleneck is usually in a task sequence. But handling asynchronous and synchronous impact on the reliability of the program is very large, synchronized to ensure reliability of the program, and asynchronous can improve the performance of the program, you must be a balance between reliability and performance, there is no perfect solution.

Blocking and non-blocking

Blocking and non-blocking mainly from the CPU consumption for the blocking CPU is stopped to wait for a slow CPU operation is complete only then do another thing. In this non-blocking is a slow operation of the CPU to do otherwise when performing other things, the slow isochronous operation is completed, the CPU then followed by a subsequent operation is completed. Although on the surface of a non-blocking manner can significantly improve CPU utilization, but also brought another consequence is the thread switching system increases. CPU time can increase the cost of the compensating system can not switch needs a good evaluation.

Guess you like

Origin www.cnblogs.com/shujiying/p/11110857.html