Kqueue

Kqueue is a scalable event notification interface introduced in FreeBSD 4.1 in July 2000,[1][2] also supported in NetBSD, OpenBSD, DragonFly BSD, and macOS. Kqueue was originally authored in 2000 by Jonathan Lemon,[1][2] then involved with the FreeBSD Core Team. Kqueue makes it possible for software like nginx to solve the c10k problem.[3][4] The term "kqueue" refers to its function as a "kernel event queue"[1][2]

Kqueue provides efficient input and output event pipelines between the kernel and userland. Thus, it is possible to modify event filters as well as receive pending events while using only a single system call to kevent(2) per main event loop iteration. This contrasts with older traditional polling system calls such as poll(2) and select(2) which are less efficient, especially when polling for events on numerous file descriptors.

Kqueue not only handles file descriptor events but is also used for various other notifications such as file modification monitoring, signals, asynchronous I/O events (AIO), child process state change monitoring, and timers which support nanosecond resolution, furthermore kqueue provides a way to use user-defined events in addition to the ones provided by the kernel.

Some other operating systems which traditionally only supported select(2) and poll(2) also currently provide more efficient polling alternatives, such as epoll on Linux and I/O completion ports on Windows and Solaris.

libkqueue is a user space implementation of kqueue(2), which translates calls to an operating system's native backend event mechanism.[5]

API

The function prototypes and types are found in sys/event.h.[6]

int kqueue(void);

Creates a new kernel event queue and returns a descriptor.

int kevent(int kq, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout);

Used to register events with the queue, then wait for and return any pending events to the user. In contrast to epoll, kqueue uses the same function to register and wait for events, and multiple event sources may be registered and modified using a single call. The changelist array can be used to pass modifications (changing the type of events to wait for, register new event sources, etc.) to the event queue, which are applied before waiting for events begins. nevents is the size of the user supplied eventlist array that is used to receive events from the event queue.

EV_SET(kev, ident, filter, flags, fflags, data, udata);

A macro that is used for convenient initialization of a struct kevent object.

See also

OS-independent libraries with support for kqueue:

Kqueue equivalent for other platforms:

  • on Solaris, Windows and AIX: I/O completion ports. Note that completion ports notify when a requested operation has completed, whereas kqueue can also notify when a file descriptor is ready to perform an I/O operation.
  • on Linux:
    • epoll system call has similar but not identical semantics.
    • inotify is a Linux kernel subsystem that notices changes to the filesystem and reports those to applications.

References

  1. ^ a b c Jonathan Lemon (2000). "kqueue, kevent — kernel event notification mechanism". BSD Cross Reference. FreeBSD, OpenBSD, NetBSD, DragonFly BSD.
  2. ^ a b c Jonathan Lemon (2001-05-01). Kqueue: A generic and scalable event notification facility (PDF). Proceedings of the FREENIX Track: 2001 USENIX Annual Technical Conference. USENIX (published June 25–30, 2001).
  3. ^ "Connection processing methods". nginx.org.
  4. ^ Andrew Alexeev (2012). "§14. nginx". In Amy Brown; Greg Wilson (eds.). The Architecture of Open Source Applications, Volume II: Structure, Scale and a Few More Fearless Hacks. Lulu.com. ISBN 9781105571817.
  5. ^ libkqueue on GitHub
  6. ^ kqueue(2) – FreeBSD System Calls Manual

Read other articles:

Hymeniacidon adreissiformis Klasifikasi ilmiah Kerajaan: Animalia Upakerajaan: Parazoa Filum: Porifera Kelas: Demospongiae Ordo: Halichondrida Famili: Halichondriidae Genus: Hymeniacidon Spesies: Hymeniacidon adreissiformis Hymeniacidon adreissiformis adalah spesies spons yang tergolong dalam kelas Demospongiae. Spesies ini juga merupakan bagian dari genus Hymeniacidon dan famili Halichondriidae. Nama ilmiah spesies ini pertama kali diterbitkan pada tahun 1945 oleh Dickinson. Seperti spons p...

 

قرية إدواردز الإحداثيات 44°19′25″N 75°15′11″W / 44.3236°N 75.2531°W / 44.3236; -75.2531  [1] تاريخ التأسيس 1814  تقسيم إداري  البلد الولايات المتحدة[2]  التقسيم الأعلى مقاطعة سانت لورنس  خصائص جغرافية  المساحة 2.490698 كيلومتر مربع2.552305 كيلومتر مربع (1 أبريل 2010)  ا�...

 

Bahasa diAustraliaUtamaBahasa Inggris AustraliaPribumiBahasa-bahasa penduduk asli Australia, Bahasa Tionghoa Baku (2.5%), Bahasa Arab (1.4%), Bahasa Kanton (1.2%), Bahasa Vietnam (1.2%), Bahasa Italia (1.2%)IsyaratBahasa Isyarat AustraliaBahasa Isyarat Yolngu dan bahasa-bahasa isyarat penduduk asli Australia lainnyaTata letak papan tombolQWERTY L • B • PWBantuan penggunaan templat ini Meski tidak ada bahasa resmi di negara Australia, bahasa yang paling banyak dituturkan adalah b...

Questa voce sull'argomento centri abitati della Romania è solo un abbozzo. Contribuisci a migliorarla secondo le convenzioni di Wikipedia. Segui i suggerimenti del progetto di riferimento. Gheorghenicomune Gheorgheni – Veduta LocalizzazioneStato Romania Regione Transilvania Distretto Harghita TerritorioCoordinate46°43′N 25°36′E / 46.716667°N 25.6°E46.716667; 25.6 (Gheorgheni)Coordinate: 46°43′N 25°36′E / 46.716667°N 25.6�...

 

Coloranti sfusi in vendita in un mercato indiano Un colorante è una sostanza in grado di attribuire un particolare colore ad un determinato substrato. L'effetto fisico del colore per queste sostanze è perlopiù dovuto al fenomeno della trasmittanza e dell'assorbimento di determinate lunghezze d'onda della luce visibile. Nella struttura molecolare, i gruppi funzionali responsabili del colore sono detti cromofori. Indice 1 Classificazione 2 Coloranti propriamente detti 2.1 Utilizzi 3 Pigmenti...

 

Untuk penerus klub Persebam Babakan Madang, lihat Depok City FC. PersebamNama lengkapPersatuan Sepak Bola Babakan MadangJulukanMaung BabakanBerdiri2014; 10 tahun lalu (2014)Dibubarkan18 November 2020; 3 tahun lalu (2020-11-18)[1]StadionStadion Persikabo Cibinong, Jawa BaratKetua UmumDelif Subeki (2020)ManajerArio Danu (2020)LigaLiga 3 Persebam (singkatan dari Persatuan Sepakbola Babakan Madang; dikenal juga sebagai Persebam Bogor) adalah klub sepak bola yang berasal dari Kab...

Questa voce sull'argomento calciatori italiani è solo un abbozzo. Contribuisci a migliorarla secondo le convenzioni di Wikipedia. Segui i suggerimenti del progetto di riferimento. Ermando Malinverni Malinverni in Nazionale nel 1947 Nazionalità  Italia Calcio Ruolo Centrocampista Termine carriera 1952 Carriera Giovanili 193? Pro Vercelli[1] Squadre di club1 1936-1941 Biellese114 (37)1941-1943 Modena50 (0)1943-1944 Biellese16 (1)1945-1949 Modena122 ...

 

Richard R. SchrockRichard R. SchrockLahirRichard Royce Schrock04 Januari 1945 (umur 79)Berne, Indiana, Amerika SerikatKebangsaanAmerikaAlmamaterUniversity of California, RiversideHarvard UniversityUniversity of CambridgeDikenal atasKimia organik, reaksi metatesisPenghargaanPenghargaan Nobel Kimia (2005)Karier ilmiahBidangKimiaInstitusiDuPontMassachusetts Institute of TechnologyPembimbing doktoralJ. A. Osborn Richard Royce Schrock (lahir 4 Januari 1945) adalah seorang ilmuwan Amerika Ser...

 

Запрос «Полицентризм» перенаправляется сюда; см. также другие значения. Гипотеза мультирегионального происхождения неоантропа (полицентризм, от поли… и лат. centrum — «центр») — полифилическая[1] гипотеза антропогенеза, согласно которой существовало несколько ц�...

Third World countries which the USSR recognized as adhering to the ideas of socialism Part of a series onMarxism–Leninism Concepts Administrative-command system Anti-imperialism Anti-revisionism Central planning Soviet-type economic planning Collective farming Collective leadership Commanding heights of the economy Democratic centralism Dialectical logic Dialectical materialism Foco Intensification of the class struggleunder socialism Labor aristocracy Marxist–Leninist atheism One-party s...

 

Finnish politician Olavi Oskari Ala-NissiläMember of the Finland Parliamentfor Southwest FinlandIn office2015–2019In office1991–2006Finnish Member of the European Court of AuditorsIn office2006–2012 Personal detailsBornAugust 2, 1949Loimaan kuntaPolitical party FinnishCentre Party EUALDE Olavi Oskari Ala-Nissilä (born August 2, 1949 in Loimaa kunta, Finland) is a Finnish politician. He has been an MP from 1991 to 2006 and was re-elected in 2015. Ala-Nissilä was a member of ...

 

This article relies excessively on references to primary sources. Please improve this article by adding secondary or tertiary sources. Find sources: Wilbur-Ellis Co. v. Kuther – news · newspapers · books · scholar · JSTOR (November 2019) (Learn how and when to remove this message) 1964 United States Supreme Court caseWilbur-Ellis Co. v. KutherSupreme Court of the United StatesArgued February 20, 1964Decided June 8, 1964Full case nameWilbur-Ellis Co., ...

Марсохід «ESA Seeker» під час випробувань в горах Паранал. Автономні роботи — це роботи, які здатні виконувати потрібні завдання без постійного людського нагляду. Багато видів роботів мають певний ступінь автономності. Різні роботи можуть бути автономними у певні способ�...

 

Board game in the mancala family For the village in Iran, see Kalah, Iran. For other uses, see Kala (disambiguation). KalahRanksTwoSowingSingle lapRegionUnited States, United Kingdom Kalah is a modern variation in the ancient Mancala family of games. The Kalah board was first patented and sold in the United States by William Julius Champion, Jr. in the 1950s.[1][2] This game is sometimes also called Kalahari, possibly by false etymology from the Kalahari desert in Namibia.[...

 

Slavophone Greek chieftain of the Macedonian Struggle Gonos YiotasGonos Yiotas c. 1900sNative nameΓκόνος ΓιώταςГоно ЙотовBirth nameGeorgios YiotasΓεώργιος ΓιώταςГеорги ЙотовNickname(s)The Ghost of the Lakeτο Στοιχείο της ΛίμνηςThe Wild Beast of the Swampτο Θεριό του ΒάλτουBornc. 1880Plugar, Salonika Vilayet, Ottoman Empire (now Loudias, Greece)Died12 February 1911Giannitsa Lake, Salonika Vilayet, Ottoman Empire (...

Railway station on the Ellesmere Port branch of the Wirral line in England Little SuttonGeneral informationLocationLittle Sutton, Cheshire, Cheshire West and ChesterEnglandCoordinates53°17′07″N 2°56′36″W / 53.2854°N 2.9433°W / 53.2854; -2.9433Grid referenceSJ372769Managed byMerseyrailTransit authorityMerseytravelPlatforms2Other informationStation codeLTTFare zoneG1ClassificationDfT category F2Passengers2018/19 0.117 million2019/20 0.123 million2020/21 50,68...

 

Uralic languages spoken in northern Russia SamoyedicSamoyedGeographicdistributionNorthern EurasiaLinguistic classificationUralicSamoyedicProto-languageProto-SamoyedicSubdivisions Nganasan Mator † Core Samoyedic ISO 639-5sydGlottologsamo1298Samoyedic languages at the beginning of the 20th centuryCurrent geographic distribution of Samoyedic languages in Russia The Samoyedic (/ˌsæməˈjɛdɪk, -mɔɪ-/)[1] or Samoyed languages (/ˈsæməˌjɛd, -mɔɪ-/)[2][3] are spo...

 

1793–1857 American coin worth 0.5 cents Half cent redirects here. For the English equivalent, see Half penny (disambiguation). For the Dutch coin, see Half-cent coin (Netherlands). Half centUnited StatesValue0.5 cents or 0.005 US dollarsDiameter23.5 mmThickness2 mmEdge lettered (1793, 1797) plain (1794–1857) gripped (1797) Composition100% copperYears of minting1793–1857ObverseDesignLady Liberty with braided hairDesignerChristian GobrechtDesign date1840ReverseDesignDenomination...

Radio station in Delaware, United StatesWDSDDover, DelawareUnited StatesBroadcast areaDover, DelawareFrequency94.7 MHz (HD Radio)Branding94-7 WDSDProgrammingFormatCountrySubchannelsHD2: Simulcast of WILM (talk)AffiliationsDelaware Fightin' Blue HensMotor Racing NetworkOwnershipOwneriHeartMedia, Inc.(iHM Licenses, LLC)Sister stationsWILM (AM), WDOV, WRDX, WWTXHistoryFirst air date1956; 68 years ago (1956)Former call signsWDOV-FM (1956–1970)WDSD (1970–1997)WRDX (1...

 

NguyễnĐại Việt大越國 (1802–1804)Việt Nam越南國 (1804–1839, 1945)Đại Nam大南國 (1839–1945)1802–1945 Bendera (1802–1885)(atas) Bendera tahun 1945 (bawah) Lambang (1846–1945) Lagu kebangsaan: Đăng dàn cung Dinasti Nguyễn tahun 1829StatusNegara upeti Tiongkok (1803–1885)Protektorat Prancis (1885–1945)Ibu kotaHuếBahasa yang umum digunakanVietnam, Prancis (setelah 1887)Agama Neo-Konfusianisme, Buddhisme, Katolik Roma, dsbPemerintahanMonarkiKaisa...