16kqueue and FSEvents

Several of the technologies you have seen so far date back to Unix’s earlier days. Some of the APIs are awkward and difficult to use correctly, such as signal handling, and some are awkward and do not scale well, such as select() and poll().

In 2000, the FreeBSD project created Kernel Queues, abbreviated as kqueues, to address the shortcomings in the older APIs. Apple adopted kqueues in Mac OS X 10.3 and extended them in 10.6. kqueues are a unified notification mechanism used by the kernel that can inform your program about interesting events.

Inside the kernel are a number of filters, as shown in Figure 16.1. As the kernel does its work, it tells the filters what’s going on. There is a filter for process handling, another ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.