程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Understanding IO model of learning notes for Python introductory development

編輯:Python

The point of this section

  • understand IO Model
  • master network IO Two stages of

The duration of this section needs to be controlled 15 Within minutes

IO Model is introduced

To better understand IO Model , We need to review in advance : Sync 、 asynchronous 、 Blocking 、 Non blocking

Sync (synchronous) IO And asynchronous (asynchronous) IO, Blocking (blocking) IO And non blocking (non-blocking)IO What are the differences , What's the difference ? In fact, different people may give different answers to this question , such as wiki, I think asynchronous IO and non-blocking IO It's a thing . This is actually because different people have different knowledge backgrounds , And in the context of the discussion (context) It's not the same . therefore , In order to better answer this question , Let me first limit the context of this article .

 The background of this paper is Linux In the environment network IO. The most important reference of this article is Richard Stevens Of “UNIX Network Programming Volume 1, Third Edition: The Sockets Networking ”,6.2 section “I/O Models ”,Stevens In this section, various kinds of IO Characteristics and differences , If English is good enough , Direct reading is recommended .Stevens The style of writing is famous for its simplicity , So don't worry about not understanding . The flow chart in this paper is also taken from the reference .
Stevens There are five kinds of comparison in the article IO Model:
* blocking IO
* nonblocking IO
* IO multiplexing
* signal driven IO
* asynchronous IO
from signal driven IO( Signal driven IO) Not commonly used in practice , So we mainly introduce the other four IO Model.

Say it again IO The objects and steps involved in the occurrence . For one network IO ( Here we have read give an example ), It involves two system objects , One is to call this IO Of process (or thread), The other is the system kernel (kernel). When one read When the operation occurs , The operation will go through two stages :

1) Wait for the data to be ready (Waiting for the data to be ready)
2) Copy data from the kernel into the process (Copying the data from the kernel to the process)

It's important to remember these two points , Because of these IO The difference between models is that there are different situations in the two stages .


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved