Spl (Unix)
Template:Short description Template:Lowercase spl (short for set priority level, after the PDP-11 assembler instruction of the same name<ref name="smp">Template:Citation</ref>) is the name for a collection of Unix kernel routines or macros used to change the interrupt priority level.<ref name="man page">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref name="lions p.43">Template:Cite book</ref> This was historically needed to synchronize critical sections of kernel code that should not be interrupted.<ref>Template:Cite book</ref> Newer Unix variants which support symmetric multiprocessing now mostly use mutexes for this purpose, which is a more general solution, so multiple processors can execute kernel code at the same time.<ref>Template:Cite book</ref><ref name="smp" />
On older PDP-11 versions of Unix, there were eight of these routines, ranging from spl0
to spl7
, each corresponding to one PDP-11 interrupt priority level,<ref name="lions p.43" /> in addition to splx
, which restores a previous priority level (returned by one of the other routines).<ref name="man page" /> On BSD Unix and its derivatives, these are called splhigh
, splserial
, splsched
, splclock
, splstatclock
, splvm
, spltty
, splsofttty
, splnet
, splbio
, splsoftnet
, splsoftclock
, spllowersoftclock
, spl0
, and splx
.<ref name="man page" />
Template:As of, the spl family of primitives is still heavily used in OpenBSD<ref name="o/net/if"/> and NetBSD,<ref name="n/net/if"/> which is evidenced by the plentiful calls to splnet()
within the networking code;<ref name="o/net/if"/><ref name="n/net/if"/> whereas FreeBSD and DragonFly BSD use more modern concepts; for example, in DragonFly, LWKT tokens may be used in place of spl.