spl (Unix)

{{Short description|Unix interrupt priority control commands}}

{{lowercase}}

spl (short for set priority level, after the PDP-11 assembler instruction of the same name{{citation|last1=Lehey|first1=Greg|title=Improving the FreeBSD SMP implementation|url=http://www.lemis.com/grog/SMPng/USENIX/|date=2001|access-date=11 May 2018}}) is the name for a collection of Unix kernel routines or macros used to change the interrupt priority level.{{cite web|title=spl(9) - OpenBSD manual pages|url=https://man.openbsd.org/spl.9|access-date=11 May 2018}}{{cite book|last1=Lions|first1=John|title=Lions' Commentary on UNIX 6th Edition, with Source Code|page=43|date=1976}} This was historically needed to synchronize critical sections of kernel code that should not be interrupted.{{cite book|last1=Lions|first1=John|title=Lions' Commentary on UNIX 6th Edition, with Source Code|page=41|date=1976}} 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.{{cite book|last1=McKusick|first1=Marshall Kirk|collaboration=authors|title=The Design and Implementation of the FreeBSD Operating System|publisher=Addison-Wesley|page=93|date=2004}}

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, in addition to splx, which restores a previous priority level (returned by one of the other routines). 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.

{{As of|2019|03}}, the spl family of primitives is still heavily used in OpenBSD and NetBSD, which is evidenced by the plentiful calls to splnet() within the networking code; whereas FreeBSD and DragonFly BSD use more modern concepts; for example, in DragonFly, LWKT tokens may be used in place of spl.

See also

References

{{reflist

|refs =

{{cite web

|url = http://bxr.su/o/sys/net/if.c

|title = /sys/net/if.c

|website = BSD Cross Reference

|publisher = OpenBSD

|quote = s = splnet();

|date = 2019-03-01

|access-date = 2019-03-05

}}

{{cite web

|url = http://bxr.su/n/sys/net/if.c

|title = /sys/net/if.c

|website = BSD Cross Reference

|publisher = NetBSD

|quote = s = splnet();

|date = 2019-03-01

|access-date = 2019-03-05

}}

}}

{{OpenBSD}}

{{NetBSD}}

Category:Interrupts

Category:Unix

{{Unix-stub}}