当我使用 USB 串行端口运行程序时,为什么我的计算机不断暂停?
我编写了一个使用三个串行端口的程序(两个串行端口位于一个 USB -> 串行连接器上,另一个串行端口位于其自己的 USB -> 串行连接器上)。当我运行该程序时,每隔 5 秒左右,我的计算机就会停止响应,就好像内核正忙于做某事一样。我没有写入任何文件,所以它没有刷新到磁盘,并且我没有耗尽内存,所以它没有交换。还能是什么?它可以刷新串行端口还是其他什么?这很奇怪,因为在向串行端口写入下一位数据之前,我会等待串行端口的响应。
如果我不使用最后一个串行端口(它自己的 USB 端口上的串行端口),这种情况就会减少。
更多信息:
- debian lenny(也尝试过squeeze)
- linux 2.6.26-2-686(也尝试过2.6.32-5-686)
- 不使用ftdi_sio,使用libftd2xx1.0.2(也尝试过1.0.4)
I've written a program that uses three serial ports (two serial ports are on one USB -> serial connector, the other serial port is on its own USB -> serial connector). When I'm running the program, every 5 seconds or so, my computer stops responding, as if the kernel is busy doing something. I'm not writing any files, so it's not flushing to disk, and I'm not running out of memory, so it's not swapping. What else could it be? could it be flushing the serial port or something? That would be weird, because I wait for a response from the serial ports before I write the next bit of data to them.
It happens less if I don't use the last serial port (the one on it's own USB port).
More info:
- debian lenny (also tried squeeze)
- linux 2.6.26-2-686 (also tried 2.6.32-5-686)
- not using ftdi_sio, using libftd2xx1.0.2 (also tried 1.0.4)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
libftd2xx 似乎是问题所在。它改变了线程的优先级,并且似乎在忙等待或者似乎接管了系统。授予用户对 /proc/bus/usb 中 USB 设备的访问权限并以普通用户身份运行程序似乎工作正常,所以我不确定为什么 libftd2xx 会更改线程优先级。
libftd2xx seems to be the problem. It changes its thread's priority and seems to busy wait or something that seems to take over the system. Giving user's access to the usb devices in /proc/bus/usb and running the program as a normal user seems to work fine, so I'm not sure why libftd2xx is changing thread priorities.