h**o 发帖数: 548 | 1 我在查一个网络socket programming 中的错误。
通过dtrace 我发现大部分cpu 被耗在以下system call:pollsys recvfrom sendto 上。
请问pollsys 一般被谁调用,什么情况下被调用,是周期性的调,信号中断调,事件激
发?如果 用 select() 就可以避免 pollsys?
我没找到相关文档,只知道pollsys is normally used
for checking whether there is any data that can be read from or write to a
file descriptor. |
T*******i 发帖数: 4992 | 2 on Solaris?
If so, it should be the same as poll. You'd better check if how much timeout
is set.
上。
【在 h**o 的大作中提到】 : 我在查一个网络socket programming 中的错误。 : 通过dtrace 我发现大部分cpu 被耗在以下system call:pollsys recvfrom sendto 上。 : 请问pollsys 一般被谁调用,什么情况下被调用,是周期性的调,信号中断调,事件激 : 发?如果 用 select() 就可以避免 pollsys? : 我没找到相关文档,只知道pollsys is normally used : for checking whether there is any data that can be read from or write to a : file descriptor.
|
h**o 发帖数: 548 | 3 Thanks.
timeout of what? Do you mean the timeout of select()?
In order to trace who called pollsys, I use
truss -t pollsys -T polsys -p PID, and then
pstack PID.
Here is the result. It seems pollsys is called by select().
From Beej's tutorial on socket programming, I learned that CPU exhaustion
due to polling can be avoided by using select() mode. Why select() also call
poll()? |
h**o 发帖数: 548 | 4 Yes, Solaris 10
timeout
【在 T*******i 的大作中提到】 : on Solaris? : If so, it should be the same as poll. You'd better check if how much timeout : is set. : : 上。
|