Illustrate behavior of
Emphasis on whether this thread is
pauseon execution or not.
We consider current function is blocking function if any instruction of this function is blocking.
Otherwise we say this function is non-blocking function.
Current thread is paused on execution, usually due to waiting for resources.
Cwill wait for user keyboard input.
readsystem call to load data from network.
writesystem call to flush data to persistence layer.
- current thread waiting for resource lock to release from another thread.
All the examples illustrate the fact that, while executing blocking function, current thread must wait for other threads or operating system to finish the underlying task before executing next instruction.
Blocking has nothing to do with
user thread. Just as example
1-3 above, current thread is waiting for OS to finish its job. But as a matter of fact, OS operation is done by system thread, hence it is still deemed as
blocking can wait on another user thread, as shown for case
blocking emphasis on pause behavior of
single thread, but it must happen because of another thread, regardless of
Current thread does not wait. It keeps executing instruction without pause.
Illustrate behavior between
Emphasis on whether thread should
coordinatewith other threads or not.
We consider a function that involves only single thread or does not need to coordinate with other threads at all as non-synchronized.
One the other hand, a function is synchronized/asynchronized if thread have to coordinate with others.
A function is synchronized if thread must process communication immediately after sent/receipt. Like answering phone call.
A function is asynchronized if thread is able to process communication whenever comfortable. Like email communication.
This conception is regarding how a single thread should handle request.
A function is
not multiplexing if the single thread is to solely handle the entire request from inbound to outbound. From connection acceptence to read/write and eventually, disconnection etc.,
Upon completion, this thread is released or terminated. It is more like a dedicate maid of a client.
Otherwise, if the single thread will handle across multiple request. The thread will provide service separately.
For instance it will handle connection establishment of many client, also handle I/O of many client as well. It does not dedicate to specific request.
This would drastically enhance the performance.