亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2118 | 回復(fù): 0
打印 上一主題 下一主題

introduction of kqueue/kevent [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2007-05-03 00:05 |只看該作者 |倒序瀏覽

                Here is a brief introduction about kqueue/kevent mechanism in FreeBSD. It is just my note. The Operating System I use during this note.
[amd64box:~]$uname -a
FreeBSD amd64box 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Mon Apr 23 21:42:50 CST 2007     root@:/usr/src/sys/amd64/compile/AMD64MP  amd64
A kqueue is a container of state for kevent calls.
     int     kevent(int kq, const struct kevent *changelist, int nchanges,
/* register these kevents on this kqueue */         struct kevent *eventlist, int nevents,
/* get ready kevents from this kqueue */         const struct timespec *timeout);
A kqueue dispatches those kevents in changelist to files they point to, and he knows which ones have been dispatched or not. Every file will report to this kqueue if its status changed (if this kqueue is interested in it). The kqueue will keep these reports and send them to user via kevent when requested.
kqueue_register     tell the kqueue to dispatch this kevent (called knote in kernel) to corresponding file, and kqueue will keep this kevent in a private list, so that there are at most one (ident, filter) in one kqueue for any ident and/or filter.
kqueue_scan         scan the pending kevents on a kqueue if any and msleep on it if there are no kevents pending on the kqueue
KNOTE_ACTIVATE      a kevent is triggered. Insert the kevent into its kqueue's list and tell any monitor that the kqueue is OK. to avoid deadlock, use taskqueue to activate kevents on si_note asynchronously.
This is a common scene.
A registers kevents kev0, kev1 on a kqueue kq1, kq1 dispatches these kevents to files f0, f1, and A msleeps on kq1. B triggers kev0, puts kev0 on the active list of kq1 and wakeups A from kq1 asynchronously. A finds that kev0 is triggered and returns to user mode.
Locks
KQ_LOCK     protects the kqueue and knotes on it.
kq_global    acquired if we need lock multiple kqueues
KN_INFLUX    protects a knote when its kqueue is unlocked
               
               
               
               
               

本文來自ChinaUnix博客,如果查看原文請點:http://blog.chinaunix.net/u/10543/showart_290779.html
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP