Kernel events notification framework - kqueue. kqueue(2) provides a stateful and efficient event notification framework. Currently supported events include socket, file, directory, fifo, pipe, tty and device changes, and monitoring of processes and signals. kqueue is supported by all writable filesystems in the NetBSD tree (with the exception of Coda) and all device drivers supporting poll(2).
今まで、socketでしか使えなかったテクニックが、他の機構でも
使えるようになった感じです。
で、kqueueのマニュアルにはこう書いてあります。
EVFILT_READ
Takes a descriptor as the identifier, and returns whenever
there is data available to read. The behavior of the filter is slightly different depending on the descriptor
type.
Sockets
Sockets which have previously been passed to listen()
return when there is an incoming connection pending.
data contains the size of the listen backlog (i.e.,
the number of connections ready to be accepted with
accept(2).)
Vnodes
Returns when the file pointer is not at the end of
file. data contains the offset from current position
to end of file, and may be negative.
Fifos, Pipes
Returns when the there is data to read; data contains
the number of bytes available.
SMP対応 (スコア:1)
1.6系...2個のCPUを効率良く使うことができない
2.0系...2個のCPUをガッツリ使うことができる
という認識でいいのでしょうか?
いつか「もちろんNetBSDですよ」といってみたい...
TxT
Re:SMP対応 (スコア:1)
自分で調べるしかないかッ
調べてみよう暇なとき。
「カーネル内部事象の通知機構であるkqueue」っていうのは
例えば、あるディレクトリに変更があったときにそれをカーネルが
教えてくれるのだろうか?プログラムにそう書いておけば。
それを捕まえたときに、処理を発動させることができるのかなぁ
シグナルが発行されるのかッ
TxT
kqueue (スコア:2, 参考になる)
で、kqueueのマニュアルにはこう書いてあります。
ディレクトリの変更でイベントが発生するかはちょっと不明ですが、 ファイルに書きこみがあったことは通知してくれるように見えます。