<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://tech-pubs.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Kernel%3A_Poll_and_Select</id>
	<title>Kernel: Poll and Select - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://tech-pubs.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Kernel%3A_Poll_and_Select"/>
	<link rel="alternate" type="text/html" href="https://tech-pubs.net/wiki/index.php?title=Kernel:_Poll_and_Select&amp;action=history"/>
	<updated>2026-04-20T10:33:25Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://tech-pubs.net/wiki/index.php?title=Kernel:_Poll_and_Select&amp;diff=477&amp;oldid=prev</id>
		<title>Raion at 23:57, 9 January 2026</title>
		<link rel="alternate" type="text/html" href="https://tech-pubs.net/wiki/index.php?title=Kernel:_Poll_and_Select&amp;diff=477&amp;oldid=prev"/>
		<updated>2026-01-09T23:57:52Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:57, 9 January 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l194&quot;&gt;Line 194:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 194:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This behavior is intentional, consistent, and relied upon by real software.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This behavior is intentional, consistent, and relied upon by real software.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category: Kernel Documentation]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Raion</name></author>
	</entry>
	<entry>
		<id>https://tech-pubs.net/wiki/index.php?title=Kernel:_Poll_and_Select&amp;diff=437&amp;oldid=prev</id>
		<title>Raion: Created page with &quot;This section describes the behavior of IRIX’s 6.5 Kernel &lt;code&gt;poll(2)&lt;/code&gt; and &lt;code&gt;select(2)&lt;/code&gt; system calls as observed from kernel behavior and historical design goals.  It intentionally avoids implementation details and code structure, focusing instead on externally visible semantics, internal contracts, and compatibility considerations.  == 1. Design philosophy == IRIX treats &lt;code&gt;poll(2)&lt;/code&gt; as the fundamental readiness-notificat...&quot;</title>
		<link rel="alternate" type="text/html" href="https://tech-pubs.net/wiki/index.php?title=Kernel:_Poll_and_Select&amp;diff=437&amp;oldid=prev"/>
		<updated>2025-12-27T04:31:23Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This section describes the behavior of IRIX’s &lt;a href=&quot;/wiki/index.php?title=Kernel:6.5_Kernel&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Kernel:6.5 Kernel (page does not exist)&quot;&gt;6.5 Kernel&lt;/a&gt; &amp;lt;code&amp;gt;poll(2)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;select(2)&amp;lt;/code&amp;gt; system calls as observed from kernel behavior and historical design goals.  It intentionally avoids implementation details and code structure, focusing instead on externally visible semantics, internal contracts, and compatibility considerations.  == 1. Design philosophy == IRIX treats &amp;lt;code&amp;gt;poll(2)&amp;lt;/code&amp;gt; as the fundamental readiness-notificat...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This section describes the behavior of IRIX’s [[Kernel:6.5 Kernel|6.5 Kernel]] &amp;lt;code&amp;gt;poll(2)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;select(2)&amp;lt;/code&amp;gt; system calls as observed from kernel behavior and historical design goals.&lt;br /&gt;
&lt;br /&gt;
It intentionally avoids implementation details and code structure, focusing instead on externally visible semantics, internal contracts, and compatibility considerations.&lt;br /&gt;
&lt;br /&gt;
== 1. Design philosophy ==&lt;br /&gt;
IRIX treats &amp;lt;code&amp;gt;poll(2)&amp;lt;/code&amp;gt; as the fundamental readiness-notification mechanism.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;select(2)&amp;lt;/code&amp;gt; is a compatibility interface layered atop &amp;lt;code&amp;gt;poll&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The IRIX design emphasizes:&lt;br /&gt;
&lt;br /&gt;
* Precise wakeups over broadcast signaling&lt;br /&gt;
* Predictable latency under high fd counts&lt;br /&gt;
* Scalability on large SMP systems&lt;br /&gt;
* Tolerance of imperfect or legacy drivers&lt;br /&gt;
* Compatibility with historical SVR4 semantics&lt;br /&gt;
&lt;br /&gt;
This leads to observable differences from Solaris and BSD-derived systems.&lt;br /&gt;
&lt;br /&gt;
== 2. Core readiness model ==&lt;br /&gt;
&lt;br /&gt;
=== 2.1 Explicit interest registration ===&lt;br /&gt;
When a thread calls &amp;lt;code&amp;gt;poll(2)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;select(2)&amp;lt;/code&amp;gt;, IRIX:&lt;br /&gt;
&lt;br /&gt;
* Actively registers the thread’s interest in each polled object&lt;br /&gt;
* Associates that interest with the object itself&lt;br /&gt;
* Records the specific events the thread is waiting for&lt;br /&gt;
&lt;br /&gt;
This differs from systems that merely re-scan descriptors after wakeup.&lt;br /&gt;
&lt;br /&gt;
Consequence:&lt;br /&gt;
&lt;br /&gt;
Only threads that expressed interest in a specific event are eligible to be woken.&lt;br /&gt;
&lt;br /&gt;
=== 2.2 Object-centric wakeups ===&lt;br /&gt;
Pollable kernel objects (files, sockets, devices) are responsible for:&lt;br /&gt;
&lt;br /&gt;
* Advertising readiness&lt;br /&gt;
* Waking interested threads when state changes&lt;br /&gt;
&lt;br /&gt;
Wakeups originate from the object, not from a global selector.&lt;br /&gt;
&lt;br /&gt;
Consequence:&lt;br /&gt;
&lt;br /&gt;
Wakeups are targeted and efficient, especially when many threads are polling unrelated objects.&lt;br /&gt;
&lt;br /&gt;
== 3. Wakeup precision and filtering ==&lt;br /&gt;
IRIX wakeups are event-filtered:&lt;br /&gt;
&lt;br /&gt;
* A thread is woken only if:&lt;br /&gt;
** The event matches its registered interest, or&lt;br /&gt;
** The event represents a terminal condition (e.g., hangup or error)&lt;br /&gt;
* Objects may request:&lt;br /&gt;
** Waking all interested threads&lt;br /&gt;
** Waking only a single waiting thread&lt;br /&gt;
&lt;br /&gt;
This behavior reduces unnecessary context switches.&lt;br /&gt;
&lt;br /&gt;
=== Comparison to Solaris ===&lt;br /&gt;
Solaris follows a similar object-centric model, but tends to wake broader sets of threads and rely more on post-wakeup filtering.&lt;br /&gt;
&lt;br /&gt;
== 4. Poll ordering and locality (“rotor behavior”) ==&lt;br /&gt;
IRIX introduces a locality optimization that influences how readiness scans resume after sleep:&lt;br /&gt;
&lt;br /&gt;
* When a thread wakes, IRIX records &amp;#039;&amp;#039;which descriptor triggered the wakeup&amp;#039;&amp;#039;&lt;br /&gt;
* Subsequent readiness scans preferentially resume near that descriptor&lt;br /&gt;
* If ambiguity exists (e.g., multiple wakeups or mixed object capabilities), the optimization is disabled&lt;br /&gt;
&lt;br /&gt;
This improves performance for workloads that repeatedly poll the same small subset of descriptors.&lt;br /&gt;
&lt;br /&gt;
=== Observable effects ===&lt;br /&gt;
&lt;br /&gt;
* Reduced latency for hot descriptors&lt;br /&gt;
* Slightly different readiness ordering than Solaris in some cases&lt;br /&gt;
* No effect on correctness or POSIX compliance&lt;br /&gt;
&lt;br /&gt;
== 5. Handling of partially pollable objects ==&lt;br /&gt;
IRIX supports environments where:&lt;br /&gt;
&lt;br /&gt;
* Some objects fully support readiness notification&lt;br /&gt;
* Others cannot actively signal readiness&lt;br /&gt;
&lt;br /&gt;
In such cases:&lt;br /&gt;
&lt;br /&gt;
* The thread may still block&lt;br /&gt;
* Optimizations that rely on precise wakeup hints are conservatively disabled&lt;br /&gt;
* Correctness is preserved at the cost of additional scanning&lt;br /&gt;
&lt;br /&gt;
=== Comparison to Solaris ===&lt;br /&gt;
Solaris generally expects pollable objects to fully participate in readiness signaling and is less tolerant of partial support.&lt;br /&gt;
&lt;br /&gt;
== 6. Race avoidance and readiness consistency ==&lt;br /&gt;
IRIX takes explicit measures to avoid lost wakeups:&lt;br /&gt;
&lt;br /&gt;
* Readiness is checked before sleeping&lt;br /&gt;
* Registration and wakeup are ordered to detect concurrent state changes&lt;br /&gt;
* If readiness changes during registration, the scan is immediately retried&lt;br /&gt;
&lt;br /&gt;
Consequence:&lt;br /&gt;
&lt;br /&gt;
A readiness event that occurs during a &amp;lt;code&amp;gt;poll(2)&amp;lt;/code&amp;gt; call is not silently lost.&lt;br /&gt;
&lt;br /&gt;
Solaris employs similar concepts, but IRIX favors immediate in-kernel recovery rather than deferring detection to later scans.&lt;br /&gt;
&lt;br /&gt;
== 7. Timeout behavior ==&lt;br /&gt;
IRIX timeouts:&lt;br /&gt;
&lt;br /&gt;
* Are internally rounded to system clock resolution&lt;br /&gt;
* Are conservatively extended to avoid early expiration&lt;br /&gt;
* May therefore exceed the requested timeout by a small margin&lt;br /&gt;
&lt;br /&gt;
This behavior prioritizes correctness over precision.&lt;br /&gt;
&lt;br /&gt;
Solaris typically offers finer-grained timeout resolution.&lt;br /&gt;
&lt;br /&gt;
== 8. Interaction with signals ==&lt;br /&gt;
If a polling thread receives a signal:&lt;br /&gt;
&lt;br /&gt;
* The poll is interrupted&lt;br /&gt;
* All readiness registrations made during the call are cleaned up&lt;br /&gt;
* The system call returns with &amp;lt;code&amp;gt;EINTR&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
IRIX guarantees that interrupted polls do not leave stale readiness state behind.&lt;br /&gt;
&lt;br /&gt;
== 9. select(2) compatibility semantics ==&lt;br /&gt;
Although implemented atop &amp;lt;code&amp;gt;poll(2)&amp;lt;/code&amp;gt;, IRIX preserves traditional &amp;lt;code&amp;gt;select(2)&amp;lt;/code&amp;gt; behavior:&lt;br /&gt;
&lt;br /&gt;
* Invalid descriptors cause &amp;lt;code&amp;gt;select(2)&amp;lt;/code&amp;gt; to fail with &amp;lt;code&amp;gt;EBADF&amp;lt;/code&amp;gt;&lt;br /&gt;
* The same condition in &amp;lt;code&amp;gt;poll(2)&amp;lt;/code&amp;gt; results in per-descriptor error reporting&lt;br /&gt;
* Exceptional conditions are reported using historical bitmask semantics&lt;br /&gt;
&lt;br /&gt;
This ensures compatibility with legacy applications.&lt;br /&gt;
&lt;br /&gt;
== 10. Driver expectations ==&lt;br /&gt;
Kernel drivers participating in readiness notification are expected to:&lt;br /&gt;
&lt;br /&gt;
* Advertise readiness consistently&lt;br /&gt;
* Signal state changes when readiness transitions occur&lt;br /&gt;
* Maintain internal state sufficient to avoid missed notifications&lt;br /&gt;
&lt;br /&gt;
IRIX is tolerant of drivers that partially implement these expectations, though reduced performance or warnings may result.&lt;br /&gt;
&lt;br /&gt;
Solaris assumes stricter adherence to the readiness framework.&lt;br /&gt;
&lt;br /&gt;
== 11. Summary of key differences from Solaris ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Area&lt;br /&gt;
!IRIX&lt;br /&gt;
!Solaris&lt;br /&gt;
|-&lt;br /&gt;
|Readiness model&lt;br /&gt;
|Object-centric, targeted&lt;br /&gt;
|Object-centric, broader&lt;br /&gt;
|-&lt;br /&gt;
|Wakeup precision&lt;br /&gt;
|Highly filtered&lt;br /&gt;
|Moderately filtered&lt;br /&gt;
|-&lt;br /&gt;
|Poll ordering&lt;br /&gt;
|Locality-optimized&lt;br /&gt;
|Fairness-oriented&lt;br /&gt;
|-&lt;br /&gt;
|Partial poll support&lt;br /&gt;
|Tolerated&lt;br /&gt;
|Less common&lt;br /&gt;
|-&lt;br /&gt;
|Race recovery&lt;br /&gt;
|Immediate retry&lt;br /&gt;
|Deferred detection&lt;br /&gt;
|-&lt;br /&gt;
|Timeout precision&lt;br /&gt;
|Tick-based, conservative&lt;br /&gt;
|Higher resolution&lt;br /&gt;
|-&lt;br /&gt;
|select compatibility&lt;br /&gt;
|Strong legacy fidelity&lt;br /&gt;
|Version-dependent&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== 12. Guidance for emulation or re-implementation ==&lt;br /&gt;
To mimic IRIX poll/select behavior:&lt;br /&gt;
&lt;br /&gt;
* Use object-centric readiness tracking&lt;br /&gt;
* Avoid broadcast wakeups&lt;br /&gt;
* Preserve per-event filtering&lt;br /&gt;
* Support conservative timeout rounding&lt;br /&gt;
* Clean up readiness state on interruption&lt;br /&gt;
* Preserve historical select(2) error behavior&lt;br /&gt;
&lt;br /&gt;
Attempting to directly transplant Solaris semantics without accounting for these differences will result in observable behavioral drift.&lt;br /&gt;
&lt;br /&gt;
== 13. Final note ==&lt;br /&gt;
IRIX poll/select behavior is best understood not as a variant of Solaris, but as a parallel evolution from the same SVR4 roots, shaped by IRIX’s scalability goals and long hardware lifespan.&lt;br /&gt;
&lt;br /&gt;
This behavior is intentional, consistent, and relied upon by real software.&lt;/div&gt;</summary>
		<author><name>Raion</name></author>
	</entry>
</feed>