OS X 中的低优先级 I/O
launchd
可以选择 以低优先级 I/O 运行进程。它到底是如何运作的? (低到什么程度,它会影响所有操作吗?)
是否有 API 可以在未通过 launchd
启动的应用程序中启用低优先级 I/O?
我需要在后台应用程序中扫描监视的(FSEvents)目录,并且我希望这尽可能温和。
或者,如何检查系统/磁盘是否正忙于执行 I/O?
launchd
has option to run process with low priority I/O. How does it work exactly? (how low is low, does it affect all operations?)
Is there an API that enables low priority I/O in applications not launched via launchd
?
I need to scan watched (FSEvents) directories in background application, and I'd like this to be as gentle as possible.
Alternatively, how can I check if system/disk is busy doing I/O?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Launchd 使用
setiopolicy_np
(手册页),如源代码中所示此处。这个苹果文档足够温和,所以你不必在意。它仅告诉您监视目录中的某些内容已更改这一事实。
如果您确实利用
/dev/fsevents
并获取原始数据,则需要非常小心,不要压垮系统。Launchd uses
setiopolicy_np
(man page), as can be seen in the source code here.The standard
FSEvents
APIs explained in this Apple doc is gentle enough, so you don't have to care. It only tells you the fact that something in a watched directory is changed.If you really tap into
/dev/fsevents
and get raw data, you need to be very careful not to overwhelm the system.