Share to: share facebook share twitter share wa share telegram print page

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:

Upper reaches near Sugözü Dragon Creek, also called Kocaçay or Anamur Creek, is a creek in Anamur district of Mersin Province, southern Turkey. Geography The short creek is in Anamur district of Mersin Province. Its main source is an underground river, which rises to the surface around Sugözü village about 35 km (22 mi) to the Mediterranean Sea coast.[1] The creek has three tributaries and flows into the Mediterranean Sea at 36°04′27″N 32°52′48″E / &#x...

EksjönInsjöLand SverigeLänÖstergötlands länKommunLinköpings kommunLandskapÖstergötlandSockenUlrika sockenKoordinater   WGS 8458°09′45″N 15°27′51″Ö / 58.16240°N 15.46424°Ö / 58.16240; 15.46424 (Eksjön (Ulrika socken, Östergötland))  SWEREF 99 TM6446885, 527317 Eksjön Topografiska kartan över Eksjön. MåttAreal0,232 km² [1]Höjd170,3 m ö.h. [2]Strandlinje3,18 km [2]FlödenHuvudavrinnings­...

PesanggaranKecamatanKantor Camat PesanggaranPeta lokasi Kecamatan PesanggaranNegara IndonesiaProvinsiJawa TimurKabupatenBanyuwangiPemerintahan • CamatDRS. R. AGUS MULYONO, M. Si.Populasi • Total48,050[1] jiwaKode Kemendagri35.10.01 Kode BPS3510010 Desa/kelurahan5[1] Pesanggaran adalah sebuah kecamatan di barat daya Kabupaten Banyuwangi, Provinsi Jawa Timur, Indonesia. Pemerintahan Pusat pemerintahan Kecamatan Pesanggaran berada di Kantor Camat Pesa...

Matty Cash Datos personalesNombre completo Matthew Stuart CashNacimiento Slough, Reino Unido7 de agosto de 1997 (26 años)Nacionalidad(es) Británica y polaca[1]​Altura 1,85 m (6′ 1″)[2]​Carrera deportivaDeporte FútbolClub profesionalDebut deportivo 2016(Dagenham & Redbridge F. C.)Club Aston Villa F. C.Liga Premier LeaguePosición Defensa[3]​Dorsal(es) 2Goles en clubes 23Selección nacionalSelección POL PoloniaDebut 12 de noviembre de 2021Part. ...

De Oude Schelde te Weert. Kaart van de Oude Schelde (klein gedeelte ontbreekt links onder). De Oude Schelde is een 6 km lange zijarm van de Schelde met een oppervlakte van 115 ha. In de 13e eeuw werd dit deel afgesloten omdat de bedding van de Schelde zich verplaatste. De Oude Schelde ligt in de gemeente Bornem en is vooral bekend bij de bezoekers aan de deelgemeente Weert. Tot 1950 werd de Oude Schelde nog bevaren door kleine schepen. Het Sas van Bornem is een afwateringssluis tussen de...

آلة لورينز للتعمية أو لورينز إس زِد40 أو اختصاراً إس زِد42 أو إس زِد42 ب هي آلة تعمية ألمانية بتدفق دوار، استخدمها الجيش الألماني في الحرب العالمية الثانية. طورها سي لورينز إي جي في برلين. اشتُق اسم الطراز (إس زِد) من (ارتباط الشفرات) في اللغة الألمانية. نفّذت الأدوات شفرة نظام في

AQP2Struktur yang tersediaPDBPencarian Ortolog: PDBe RCSB Daftar kode id PDB4OJ2, 4NEFPengidentifikasiAliasAQP2, AQP-CD, WCH-CD, aquaporin 2, NDI2ID eksternalOMIM: 107777 MGI: 1096865 HomoloGene: 20137 GeneCards: AQP2 Lokasi gen (Tikus)Kr.Kromosom 15 (tikus)[1]Pita15 F1|15 56.13 cMAwal99,476,936 bp[1]Akhir99,482,428 bp[1]Pola ekspresi RNAReferensi data ekspresi selengkapnyaOntologi genFungsi molekuler• aktivitas transporter• aktivitas transporter transmem...

1915 film DestructionPosterDirected byWill S. DavisWritten byWill S. DavisÉmile Zola (novel)Produced byWilliam FoxStarringTheda BaraJ. Herbert FrankDistributed byFox Film CorporationRelease date December 26, 1915 (1915-12-26) Running time50 minutesCountryUnited StatesLanguageSilent with English intertitles Destruction is a 1915 American silent drama film directed by Will S. Davis and starring Theda Bara. The film is now considered to be lost.[1] Destruction was probabl...

Indian financial services company This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages) The topic of this article may not meet Wikipedia's notability guidelines for companies and organizations. Please help to demonstrate the notability of the topic by citing reliable secondary sources that are independent of the topic and provide significant coverage of it beyond a mere trivial mention. If nota...

Competition mostly based on physical attributes Beauty contest and Beauty queen redirect here. For other uses, see Beauty contest (disambiguation) and Beauty queen (disambiguation). The winners of the International Pageant of Pulchritude 1930 competition A beauty pageant is a competition that has traditionally focused on judging and ranking the physical attributes of the contestants. Pageants have now evolved to include inner beauty, with criteria covering judging of personality, intelligence...

Traditional region of Slovenia This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages) You can help expand this article with text translated from the corresponding article in Hungarian. (March 2022) Click [show] for important translation instructions. View a machine-translated version of the Hungarian article. Machine translation, like DeepL or Google Translate, is a useful starting point fo...

2019 novella by László Krasznahorkai Chasing Homer Book coverAuthorLászló KrasznahorkaiOriginal titleMindig HomérosznakTranslatorJohn BatkiIllustratorMax Neumann [de]CountryHungaryLanguageHungarianPublisherMagvetőPublication date8 October 2019Published in English2 November 2021Pages96ISBN978-963-14-3879-6 Chasing Homer (Hungarian: Mindig Homérosznak) is a 2019 novella by the Hungarian writer László Krasznahorkai. It is about an unnamed man on the run from myste...

Warning symbol on locations or products Danger of death redirects here. For other uses, see Near-death (disambiguation). Skull and crossbones, a common symbol for poison and other sources of lethal danger (GHS hazard pictograms) Hazard symbols or warning symbols are recognisable symbols designed to warn about hazardous or dangerous materials, locations, or objects, including electromagnetic fields, electric currents; harsh, toxic or unstable chemicals (acids, poisons, explosives); and radioac...

Defunct Singaporean regional airline (1989—2021) Not to be confused with Silk Way Airlines or Silk Way West Airlines. SilkAir IATA ICAO Callsign MI SLK SILKAIR Founded1975; 48 years ago (1975) (as Tradewinds Charters)Commenced operations 21 February 1989; 34 years ago (1989-02-21) (as Tradewinds Airlines) 1 April 1992; 31 years ago (1992-04-01) (as SilkAir)[1] Ceased operationsMay 6, 2021 (aircraft acquired by Singapore Airlines,...

1984 single by Michael Martin MurpheyWhat She WantsSingle by Michael Martin Murpheyfrom the album The Best of Michael Martin Murphey B-sideStill Taking ChancesReleasedNovember 19, 1984GenreCountryLength3:30LabelLibertySongwriter(s)Renee Armand, Kerry ChaterProducer(s)Jim Ed NormanMichael Martin Murphey singles chronology Radio Land (1984) What She Wants (1984) Carolina in the Pines (1985) What She Wants is a song written by Renee Armand and Kerry Chater and recorded by American country music ...

Hospital in the East Riding of Yorkshire, England Hospital in East Riding of Yorkshire, EnglandCastle Hill HospitalHull University Teaching Hospitals NHS TrustCastle Hill HospitalShown in the East Riding of YorkshireGeographyLocationCottingham, East Riding of Yorkshire, EnglandCoordinates53°46′37″N 0°26′42″W / 53.777000°N 0.445000°W / 53.777000; -0.445000OrganisationCare systemNHSServicesEmergency departmentNoHistoryOpened1916LinksListsHospitals in England ...

Private institution This article relies excessively on references to primary sources. Please improve this article by adding secondary or tertiary sources. Find sources: Payap University – news · newspapers · books · scholar · JSTOR (September 2017) (Learn how and when to remove this template message) Payap UniversityมหาวิทยาลัยพายัพMottoสัจจะ-บริการMotto in EnglishTruth - ServiceTypePrivateEsta...

Telecommunications company in the Philippines PLDT, Inc.Logo used since June 13, 2016The Ramon Cojuangco Building in Makati, the headquarters of PLDT.FormerlyPhilippine Long Distance Telephone Company (1928–2016)TypePublicTraded asPSE: TEL NYSE: PHIIndustryTelecommunicationsFoundedManila, Philippine Islands(November 28, 1928; 95 years ago (1928-11-28))HeadquartersRamon Cojuangco Building, Makati Avenue corner Dela Rosa Street, Legazpi Village, Makati, Metro Manil...

Film Patrice Leconte, Ridicule, dinominasikan pada 1996. Prancis telah mewakilkan film-film untuk Film Berbahasa Asing Terbaik (Oscar) sejak pembentukan penghargaan tersebut pada 1956. Prancis telah menjadi salah satu negara tersukses di dunia dalam kategori ini, dan lebih dari setengah perwakilan Oscar mereka meraih nominasi Oscar. Pada September 2017, Prancis telah mewakilkan 62 film untuk acara tersebut. Diantara film tersebut, 36 meraih nominasi Oscar dan sembilan memenangkan penghargaan ...

Wangsa AscaniaKelompok etnisJermanDidirikan1036PendiriEsiko, Graf BallenstedtKepala saat iniEduard, Pangeran AnhaltPenguasa terakhirJoachim Ernst, Adipati AnhaltGelar Anhalt Kadipaten Saxony Markgraf Brandenburg Kadipaten Saxe-Lauenburg Kadipaten Saxe-Wittenberg Elektor Sachsen Pangeran Lüneburg Maharani dan Autokrat Seluruh Rusia EstatAnhaltTurun takhta1918 (Kadipaten Anhalt) Wangsa Ascania (Jerman: Askanier) adalah dinasti penguasa di Jerman. Wangsa ini juga dikenal dengan nama Wangsa ...

Kembali kehalaman sebelumnya