My textbook usually explains concepts in terms of unix, linux, and windows. However, when it comes to asynchronous and synchronous I/O, it only explains it in the context of windows OS. Because of this, I am wondering if asynchronous and synchronous I/O is OS independent? Are both types of I/O available to all of unix, linux, and windows? Or is it only windows OS that has these abilities.
Thank you.
答案 0 :(得分:1)
This is a very broad question, and the answer depends on the context.
For I/O between the CPU and other peripherals, it depends on the hardware I/O interface. Most devices in your system use an synchronous interface, such as the PCI-express bus. Other devices (typically slower performing ones) can use an asynchronous interface to communicate, such as the serial port.
If your question is about inter-process communications within an operating system, the OS typically provides both synchronous or asynchronous methods. This is because certain applications specifically requires synchronous communications, while others requires specifically needs asynchronous communications. You can think of the following question instead: is it crucial for your program to wait for a message to be sent or received before doing anything else, or can you ignore them for now and check up on them later?
Synchronous communications require the sender to wait and do nothing until the message has been successfully delivered by the recipient. The same applies for receiving a message: the receiving process will wait and do nothing until the intended message has been received.
In asynchronous communications, the sender will send out a message, and then proceed with other tasks without waiting. The receiver also do not need to block-wait until a message arrives. It will periodically check to see if any messages are available.