views:

51

answers:

1

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?

+2  A: 

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.

Yuji
I use FSEvents. It does say when directory changes, but then I have to scan that directory, sometimes recursively (when FSEvents coalesces or drops events). `setiopolicy_np` looks perfect!
porneL