Difference Between Blocking and Non-Blocking I/O
Blocking I/O | Non-Blocking I/O |
---|---|
Blocking I/O is when a process is waiting for an I/O operation to complete. |
Non-blocking I/O means that when user call GetData(). |
For example, if users are trying to write data from your application into a file on disk, then if another process wants access too at that same time then they would have their own read or write operations started at the same time as yours. This can cause problems because there’s no guarantee that they’ll finish before the user does. |
In our example above, it returns immediately without waiting until all the requested data has been transferred over (and returned). The result here could be different depending on how busy those other processes were when calling GetData(), So this doesn’t really matter much here; just know that what we’re doing now won’t block any other programs from getting their jobs done either since everything happens on its own schedule – even though it might seem like nothing else was happening while waiting around forever. |
Blocking and Nonblocking IO in Operating System
Blocking and non-blocking IO are two different methods used by OS to handle I/O operations. A blocking call is where the OS decides that it needs to wait for a certain operation to complete before allowing the program to continue execution. The result of this is that user can’t do anything else while waiting on a system call; if your program doesn’t have any other activity, then it should be able to wait indefinitely without causing any problems. On the other hand, non-blocking calls (also known as asynchronous operations) don’t block the thread until they finish their work; instead, this type of system call returns immediately after completing its job without having any effect on what’s happening in other threads.
Contact Us