mi_switch man page on NetBSD

Man page or keyword search:  
man Server   9087 pages
apropos Keyword Search (all sections)
Output format
NetBSD logo
[printable version]

MI_SWITCH(9)		 BSD Kernel Developer's Manual		  MI_SWITCH(9)

NAME
     mi_switch — machine independent context switch prelude

SYNOPSIS
     int
     mi_switch(struct lwp *l);

DESCRIPTION
     The mi_switch() function implements the machine-independent prelude to an
     LWP context switch.  It is called from only a few distinguished places in
     the kernel code as a result of the principle of non-preemptable kernel
     mode execution.  The three major uses of mi_switch() can be enumerated as
     follows:

	   1.	From within cv_wait(9) and associated methods when the current
		LWP voluntarily relinquishes the CPU to wait for some resource
		to become available.

	   2.	From within preempt(9) when the current LWP voluntarily relin‐
		quishes the CPU or when the kernel prepares a return to user-
		mode execution.

	   3.	In the signal handling code if a signal is delivered that
		causes an LWP to stop (see issignal(9)).

     mi_switch() records the amount of time the current LWP has been running
     in the LWP structure and checks this value against the CPU time limits
     allocated to the LWP (see getrlimit(2)).  Exceeding the soft limit
     results in a SIGXCPU signal to be posted to the LWP, while exceeding the
     hard limit will cause a SIGKILL.

     Unless l->l_switchto is not NULL, mi_switch() will call sched_nextlwp()
     to select a new LWP from the scheduler's runqueue structures.  If no
     runnable LWP is found, the idle LWP is used.  If the new LWP is not equal
     to the current one, mi_switch() will hand over control to the machine-
     dependent function cpu_switchto(9) to switch to the new LWP.

     mi_switch() has to be called with the LWP lock held (through calling
     lwp_lock() first) and at the splsched(9) interrupt protection level.  It
     returns with the LWP lock released.

RETURN VALUES
     mi_switch() returns 1 if a context switch was performed to a different
     LWP, 0 otherwise.

SEE ALSO
     condvar(9), cpu_switchto(9), csf(9), pmap(9), ras(9), sched_4bsd(9),
     splsched(9)

BSD				 July 21, 2007				   BSD
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server NetBSD

List of man pages available for NetBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net