diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-25 19:59:05 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-25 19:59:05 -0400 |
| commit | 1f19f33e45791ea59aed048796fc68672c6723a5 (patch) | |
| tree | 54625fba89e91d1c2177801ec635e8528bba937f /static/freebsd/man9/mi_switch.9 3.html | |
| parent | ac5e55f5f2af5b92794c2aded46c6bae85b5f5ed (diff) | |
docs: Removed Precompiled HTML
Diffstat (limited to 'static/freebsd/man9/mi_switch.9 3.html')
| -rw-r--r-- | static/freebsd/man9/mi_switch.9 3.html | 134 |
1 files changed, 0 insertions, 134 deletions
diff --git a/static/freebsd/man9/mi_switch.9 3.html b/static/freebsd/man9/mi_switch.9 3.html deleted file mode 100644 index bbd5d65c..00000000 --- a/static/freebsd/man9/mi_switch.9 3.html +++ /dev/null @@ -1,134 +0,0 @@ -<table class="head"> - <tr> - <td class="head-ltitle">MI_SWITCH(9)</td> - <td class="head-vol">Kernel Developer's Manual</td> - <td class="head-rtitle">MI_SWITCH(9)</td> - </tr> -</table> -<div class="manual-text"> -<section class="Sh"> -<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> -<p class="Pp"><code class="Nm">mi_switch</code> — <span class="Nd">switch - to another thread context</span></p> -</section> -<section class="Sh"> -<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> -<p class="Pp"><code class="In">#include - <<a class="In">sys/param.h</a>></code> - <br/> - <code class="In">#include <<a class="In">sys/proc.h</a>></code></p> -<p class="Pp"><var class="Ft">void</var> - <br/> - <code class="Fn">mi_switch</code>(<var class="Fa" style="white-space: nowrap;">int - flags</var>);</p> -</section> -<section class="Sh"> -<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> -<p class="Pp">The - <a class="permalink" href="#mi_switch"><code class="Fn" id="mi_switch">mi_switch</code></a>() - function implements the machine-independent prelude to a thread context - switch. It is the single entry point for every context switch and is called - from only a few distinguished places in the kernel. The context switch is, - by necessity, always performed by the switched thread, even when the switch - is initiated from elsewhere; e.g. preemption requested via Inter-Processor - Interrupt (IPI).</p> -<p class="Pp" id="mi_switch~2">The various major uses of - <a class="permalink" href="#mi_switch~2"><code class="Fn">mi_switch</code></a>() - can be enumerated as follows:</p> -<ol class="Bl-enum Bd-indent"> - <li id="turnstile_wait">From within a function such as - <a class="Xr">sleepq_wait(9)</a> or - <a class="permalink" href="#turnstile_wait"><code class="Fn">turnstile_wait</code></a>() - when the current thread voluntarily relinquishes the CPU to wait for some - resource or lock to become available.</li> - <li>Involuntary preemption due to arrival of a higher-priority thread.</li> - <li>At the tail end of <a class="Xr">critical_exit(9)</a>, if preemption was - deferred due to the critical section.</li> - <li id="sched_clock">Within the TDA_SCHED AST handler, when rescheduling - before the return to usermode was requested. There are several reasons for - this, a notable one coming from - <a class="permalink" href="#sched_clock"><code class="Fn">sched_clock</code></a>() - when the running thread has exceeded its time slice.</li> - <li>In the signal handling code (see <a class="Xr">issignal(9)</a>) if a - signal is delivered that causes a process to stop.</li> - <li id="thread_suspend_check">In - <a class="permalink" href="#thread_suspend_check"><code class="Fn">thread_suspend_check</code></a>() - where a thread needs to stop execution due to the suspension state of the - process as a whole.</li> - <li>In <a class="Xr">kern_yield(9)</a> when a thread wants to voluntarily - relinquish the processor.</li> -</ol> -<p class="Pp" id="mi_switch~3">The <var class="Va">flags</var> argument to - <a class="permalink" href="#mi_switch~3"><code class="Fn">mi_switch</code></a>() - indicates the context switch type. One of the following must be passed:</p> -<div class="Bd-indent"> -<dl class="Bl-tag"> - <dt id="SWT_OWEPREEMPT"><a class="permalink" href="#SWT_OWEPREEMPT"><code class="Dv">SWT_OWEPREEMPT</code></a></dt> - <dd>Switch due to delayed preemption after exiting a critical section.</dd> - <dt id="SWT_TURNSTILE"><a class="permalink" href="#SWT_TURNSTILE"><code class="Dv">SWT_TURNSTILE</code></a></dt> - <dd>Switch after propagating scheduling priority to the owner of a - resource.</dd> - <dt id="SWT_SLEEPQ"><a class="permalink" href="#SWT_SLEEPQ"><code class="Dv">SWT_SLEEPQ</code></a></dt> - <dd>Begin waiting on a <a class="Xr">sleepqueue(9)</a>.</dd> - <dt id="SWT_RELINQUISH"><a class="permalink" href="#SWT_RELINQUISH"><code class="Dv">SWT_RELINQUISH</code></a></dt> - <dd>Yield call.</dd> - <dt id="SWT_NEEDRESCHED"><a class="permalink" href="#SWT_NEEDRESCHED"><code class="Dv">SWT_NEEDRESCHED</code></a></dt> - <dd>Rescheduling was requested.</dd> - <dt id="SWT_IDLE"><a class="permalink" href="#SWT_IDLE"><code class="Dv">SWT_IDLE</code></a></dt> - <dd>Switch from the idle thread.</dd> - <dt id="SWT_IWAIT"><a class="permalink" href="#SWT_IWAIT"><code class="Dv">SWT_IWAIT</code></a></dt> - <dd>A kernel thread which handles interrupts has finished work and must wait - for interrupts to schedule additional work.</dd> - <dt id="SWT_SUSPEND"><a class="permalink" href="#SWT_SUSPEND"><code class="Dv">SWT_SUSPEND</code></a></dt> - <dd>Thread suspended.</dd> - <dt id="SWT_REMOTEPREEMPT"><a class="permalink" href="#SWT_REMOTEPREEMPT"><code class="Dv">SWT_REMOTEPREEMPT</code></a></dt> - <dd>Preemption by a higher-priority thread, initiated by a remote - processor.</dd> - <dt id="SWT_REMOTEWAKEIDLE"><a class="permalink" href="#SWT_REMOTEWAKEIDLE"><code class="Dv">SWT_REMOTEWAKEIDLE</code></a></dt> - <dd>Idle thread preempted, initiated by a remote processor.</dd> - <dt id="SWT_BIND"><a class="permalink" href="#SWT_BIND"><code class="Dv">SWT_BIND</code></a></dt> - <dd>The running thread has been bound to another processor and must be - switched out.</dd> -</dl> -</div> -<p class="Pp">In addition to the switch type, callers must specify the nature of - the switch by performing a bitwise OR with one of the - <code class="Dv">SW_VOL</code> or <code class="Dv">SW_INVOL</code> flags, - but not both. Respectively, these flags denote whether the context switch is - voluntary or involuntary on the part of the current thread. For an - involuntary context switch in which the running thread is being preempted, - the caller should also pass the <code class="Dv">SW_PREEMPT</code> flag.</p> -<p class="Pp" id="mi_switch~4">Upon entry to - <a class="permalink" href="#mi_switch~4"><code class="Fn">mi_switch</code></a>(), - the current thread must be holding its assigned thread lock. It may be - unlocked as part of the context switch. After they have been rescheduled and - execution resumes, threads will exit <code class="Fn">mi_switch</code>() - with their thread lock unlocked.</p> -<p class="Pp" id="mi_switch~5"><a class="permalink" href="#mi_switch~5"><code class="Fn">mi_switch</code></a>() - records the amount of time the current thread has been running before - handing control over to the scheduler, via - <a class="permalink" href="#sched_switch"><code class="Fn" id="sched_switch">sched_switch</code></a>(). - After selecting a new thread to run, the scheduler will call - <code class="Fn">cpu_switch</code>() to perform the low-level context - switch.</p> -<p class="Pp" id="cpu_switch"><a class="permalink" href="#cpu_switch"><code class="Fn">cpu_switch</code></a>() - is the machine-dependent function that performs the actual switch from the - running thread <var class="Fa">oldtd</var> to the chosen thread - <var class="Fa">newtd</var>.</p> -</section> -<section class="Sh"> -<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE - ALSO</a></h1> -<p class="Pp"><a class="Xr">cpu_switch(9)</a>, <a class="Xr">cpu_throw(9)</a>, - <a class="Xr">critical_exit(9)</a>, <a class="Xr">issignal(9)</a>, - <a class="Xr">kern_yield(9)</a>, <a class="Xr">mutex(9)</a>, - <a class="Xr">pmap(9)</a>, <a class="Xr">sleepqueue(9)</a>, - <a class="Xr">thread_exit(9)</a></p> -</section> -</div> -<table class="foot"> - <tr> - <td class="foot-date">January 7, 2025</td> - <td class="foot-os">FreeBSD 15.0</td> - </tr> -</table> |
