由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
CS版 - 谁能说说同步/异步IO和阻塞/非阻塞IO的区别?
相关主题
MPI里面nonblock通信的memory怎么处理问个mult-core的clock synchronization问题
想学下cloud,有什么比较好的书推荐吗? (转载)请教如何在outlook 2010里设置gmail IMAP
c不用thread,如何写“按任意键退出”?Why programmers work at night
求助:准备PhD退学了,怎么跟导师说比较好?有必要旁听 operating system design吗? (转载)
SOAP service, how to make sure it runs only 1 process? (请教一个线程synchronized 问题
关于A* 和BFS请问有哪些high performance TCP statck on LINUX? (转载)
ML和WSN方向比较 (phd), wsn业界工作是不是很难找?MPI问题求助。Help! (转载)
计算机发展已经走火入魔了MSN 被 BLOCK 了 不知道是什么原因 除wirewall issue 外
相关话题的讨论汇总
话题: io话题: blocking话题: data
进入CS版参与讨论
1 (共1页)
h*****n
发帖数: 209
1
【 以下文字转载自 Programming 讨论区 】
发信人: hanuman (神猴), 信区: Programming
标 题: 谁能说说同步/异步IO和阻塞/非阻塞IO的区别?
发信站: BBS 未名空间站 (Mon Jan 24 23:50:56 2011, 美东)
感觉同步I/O就是阻塞I/O,异步I/O就是非阻塞I/O啊,
但是好像这两组概念又不太一样。希望版上的大牛发表高见。
s*****y
发帖数: 897
2
synchronous means that the OS will work on your IO request once they get you
r request.
asynchronous means the OS will delay to work on your IO request. Maybe it is
because OS is busy working on some other stuff or the IO is not aviable.
Blocking IO means you call the IO function to get the data. The function you
called will not return until the data is avaiable.
Non-Blocking IO means you call the IO function and the IO function returns r
ight away. The IO fucntion will just post a message to the work queue and th
e other process will fetch the message from this queue and then begin to get
the data from the IO. Once the data is ready, they will notify you the data
is ready.

【在 h*****n 的大作中提到】
: 【 以下文字转载自 Programming 讨论区 】
: 发信人: hanuman (神猴), 信区: Programming
: 标 题: 谁能说说同步/异步IO和阻塞/非阻塞IO的区别?
: 发信站: BBS 未名空间站 (Mon Jan 24 23:50:56 2011, 美东)
: 感觉同步I/O就是阻塞I/O,异步I/O就是非阻塞I/O啊,
: 但是好像这两组概念又不太一样。希望版上的大牛发表高见。

h*****n
发帖数: 209
3
Thanks a lot.
Questions from your definition:
1) What if there is no data available for Synchronous IO? In such case
Synchronous IO needs to wait, and it behaves the same as Blocking IO, right?
2) Asynchronous IO is one kind of Non-Blocking IO, right?

you
is
you
r
th
get
data

【在 s*****y 的大作中提到】
: synchronous means that the OS will work on your IO request once they get you
: r request.
: asynchronous means the OS will delay to work on your IO request. Maybe it is
: because OS is busy working on some other stuff or the IO is not aviable.
: Blocking IO means you call the IO function to get the data. The function you
: called will not return until the data is avaiable.
: Non-Blocking IO means you call the IO function and the IO function returns r
: ight away. The IO fucntion will just post a message to the work queue and th
: e other process will fetch the message from this queue and then begin to get
: the data from the IO. Once the data is ready, they will notify you the data

h*****n
发帖数: 209
4

you
is
you
r
th
get
What does "the other process" mean? Is it a system process?
data

【在 s*****y 的大作中提到】
: synchronous means that the OS will work on your IO request once they get you
: r request.
: asynchronous means the OS will delay to work on your IO request. Maybe it is
: because OS is busy working on some other stuff or the IO is not aviable.
: Blocking IO means you call the IO function to get the data. The function you
: called will not return until the data is avaiable.
: Non-Blocking IO means you call the IO function and the IO function returns r
: ight away. The IO fucntion will just post a message to the work queue and th
: e other process will fetch the message from this queue and then begin to get
: the data from the IO. Once the data is ready, they will notify you the data

s*****y
发帖数: 897
5
synchronoous and asychronous means whehter the IO prcoess your request once
they get your request.
It depends on how you write your code. You could do synchronous + Blocking o
r synchronous + nonblocking.

right?

【在 h*****n 的大作中提到】
: Thanks a lot.
: Questions from your definition:
: 1) What if there is no data available for Synchronous IO? In such case
: Synchronous IO needs to wait, and it behaves the same as Blocking IO, right?
: 2) Asynchronous IO is one kind of Non-Blocking IO, right?
:
: you
: is
: you
: r

s*****y
发帖数: 897
6
Your process or your applicaion process may send a message through a message
queue to another IO process who will process your data request.

【在 h*****n 的大作中提到】
:
: you
: is
: you
: r
: th
: get
: What does "the other process" mean? Is it a system process?
: data

h*****n
发帖数: 209
7
Thanks.
But we can only do asynchronous + nonblocking, and there is no asynchronous
+ blocking, right?

once
o

【在 s*****y 的大作中提到】
: synchronoous and asychronous means whehter the IO prcoess your request once
: they get your request.
: It depends on how you write your code. You could do synchronous + Blocking o
: r synchronous + nonblocking.
:
: right?

k****n
发帖数: 1334
8
4种都有,看这个,解释得很清楚
http://www.ibm.com/developerworks/linux/library/l-async/?S_TACT

asynchronous

【在 h*****n 的大作中提到】
: Thanks.
: But we can only do asynchronous + nonblocking, and there is no asynchronous
: + blocking, right?
:
: once
: o

z*****n
发帖数: 7639
9
Synchronous IO, according to its name, the data
is coming in synchronously. Your program/task
should also run synchronously (e.g, by a timer
interrupt) in order to get the data in the same pace.
Asynchrounous IO means data coming in asynchronously.
Your program should be either designed in a fashion
that either incoming data triggers the IO task (i.e.,
interrupt) or the program periodically polls the
IO port for data.
Blocking/Nonblocking IO means how your program deals
with the IO operation. For example, if the polling
function stays (by running a loop) until a piece
of data is obtained, then it is a blocking IO function.

right?

【在 h*****n 的大作中提到】
: Thanks a lot.
: Questions from your definition:
: 1) What if there is no data available for Synchronous IO? In such case
: Synchronous IO needs to wait, and it behaves the same as Blocking IO, right?
: 2) Asynchronous IO is one kind of Non-Blocking IO, right?
:
: you
: is
: you
: r

h*****n
发帖数: 209
10
I am confused.
I think you are talking about Synchronous Communication and Asynchronous
Communication, not the Synchronous IO and Asynchronous IO.
But actually I am also not sure about the difference between these two kinds
of terms.

【在 z*****n 的大作中提到】
: Synchronous IO, according to its name, the data
: is coming in synchronously. Your program/task
: should also run synchronously (e.g, by a timer
: interrupt) in order to get the data in the same pace.
: Asynchrounous IO means data coming in asynchronously.
: Your program should be either designed in a fashion
: that either incoming data triggers the IO task (i.e.,
: interrupt) or the program periodically polls the
: IO port for data.
: Blocking/Nonblocking IO means how your program deals

z*****n
发帖数: 7639
11
An IO port has no difference from a communication
terminal. What do you think?

kinds

【在 h*****n 的大作中提到】
: I am confused.
: I think you are talking about Synchronous Communication and Asynchronous
: Communication, not the Synchronous IO and Asynchronous IO.
: But actually I am also not sure about the difference between these two kinds
: of terms.

h*****n
发帖数: 209
12
Thanks.
I just want to confirm that 1) Synchronous/Asyschronous IO and 2)
Synchronous/Asyschronous Communication have the same meaning.

【在 z*****n 的大作中提到】
: An IO port has no difference from a communication
: terminal. What do you think?
:
: kinds

1 (共1页)
进入CS版参与讨论
相关主题
MSN 被 BLOCK 了 不知道是什么原因 除wirewall issue 外SOAP service, how to make sure it runs only 1 process? (
一个随机序列的算法问题关于A* 和BFS
海外商业公司的IP会被Block么?ML和WSN方向比较 (phd), wsn业界工作是不是很难找?
谁能说说同步/异步IO和阻塞/非阻塞IO的区别?计算机发展已经走火入魔了
MPI里面nonblock通信的memory怎么处理问个mult-core的clock synchronization问题
想学下cloud,有什么比较好的书推荐吗? (转载)请教如何在outlook 2010里设置gmail IMAP
c不用thread,如何写“按任意键退出”?Why programmers work at night
求助:准备PhD退学了,怎么跟导师说比较好?有必要旁听 operating system design吗? (转载)
相关话题的讨论汇总
话题: io话题: blocking话题: data