How to use the oi model in 5?

PHP中文网
PHP中文网Original
2017-06-20 09:21:341203browse

The application process is: Xiao Ming

Kernel: Xiao Wang

1 Blocking I/O model:

Xiao Ming borrows rice from Xiao Wang for cooking, and Xiao Wang temporarily No, but Xiao Ming didn't do anything else at this time (for example, he could still wash vegetables at this time), so he just waited there until Xiao Wang had rice, and then Xiao Ming carried the rice to his home and started cooking.

2 Non-blocking I/O model:

Xiao Ming asked Xiao Wang to borrow rice for cooking. Xiao Wang did not have it for the time being, but Xiao Ming went to wash the vegetables at this time. When he got back, he went to ask Xiao Wang if the rice was ready, until Xiao Wang had the rice, then Xiao Ming carried the rice to his home and started cooking.

3 I/O reuse model:

Many people in the village ran out of rice for cooking, so they all went to borrow rice from Xiao Wang. In this case, whether the person borrowing rice from Xiao Wang asks Xiao Wang every once in a while, or whether he waits for news about Xiao Wang somewhere, the person borrowing rice will at least not do other things well,

In this way, everyone will find an agent, and then everyone will discuss the situation with the agent and let the agent interact with Xiao Wang. When the data arrives, the agent notifies a specific person, and then the person carries the rice to his home and starts cooking.

4 Signal-driven model:

Xiao Ming borrowed rice from Xiao Wang for cooking. Xiao Wang didn’t have it for the time being, but Xiao Ming went to wash the vegetables at this time instead of waiting somewhere or asking questions constantly. Xiao Wang, because Xiao Wang will take the initiative to notify Xiao Ming when he has rice. When the notification comes, Xiao Ming carries the rice to his home and starts cooking.

5 Asynchronous model:

Xiao Ming borrows rice from Xiao Wang to cook. Xiao Ming finishes borrowing rice from Xiao Wang and goes to do other things. When Xiao Wang has the rice, He also took the initiative to carry the rice to Xiao Ming's house, and then notified Xiao Ming that the rice had arrived. At this time, Xiao Ming started cooking.

Synchronization: The application process actively copies data to user space.

Asynchronous: The kernel is responsible for copying data to user space. During this process, the application process is still doing its own thing.

Blocking, non-blocking, I/O multiplexing, signal driver, all are synchronous. The final asynchronous is the real asynchronous.

The above is the detailed content of How to use the oi model in 5?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn