Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Low-priority I/O in OS X

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?

like image 356
Kornel Avatar asked Aug 12 '10 17:08

Kornel


1 Answers

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.

like image 199
Yuji Avatar answered Oct 31 '22 02:10

Yuji