Spl (Unix)

spl (short for set priority level, after the PDP-11 assembler instruction of the same name) is the name for a collection of Unix kernel routines or macros used to change the interrupt priority level. This was historically needed to synchronize critical sections of kernel code that shouldn't be interrupted. 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.
On older PDP-11 versions of Unix, there were eight of these routines, ranging from codice_1 to codice_2, each corresponding to one PDP-11 interrupt priority level, in addition to codice_3, which restores a previous priority level (returned by one of the other routines). On BSD Unix and its derivatives, these are called codice_4, codice_5, codice_6, codice_7, codice_8, codice_9, codice_10, codice_11, codice_12, codice_13, codice_14, codice_15, codice_16, codice_1, and codice_3.
, the spl family of primitives is still heavily used in OpenBSD and NetBSD, which is evidenced by the plentiful of calls to codice_19 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.