Light Weight Kernel Threads

Light Weight Kernel Threads or LWKT is a term from computer science in general and in DragonFlyBSD in particular. LWKTs differ from normal kernel threads in that they can preempt normal kernel threads. According to Matt Dillon, DragonFlyBSD creator:

The LWKT scheduler is responsible for actually running a thread. It uses a fixed priority scheme but ... the fixed priorities are differentiating major subsystems, not user processes. "For example, hardware interrupt threads have the highest priority, followed by software interrupts, kernel-only threads, then finally user threads. A user thread either runs at user-kernel priority (when it is actually running in the kernel, e.g. running a syscall on behalf of userland), or a user thread runs at user priority vimAL.

DragonFly does preempt... it just does it very carefully and only under particular circumstances. An LWKT interrupt thread can preempt most other threads, for example. This mimics what FreeBSD-4.x already did with its spl/run-interrupt-in-context-of-current-process mechanism. What DragonFly does *NOT* do is allow a non-interrupt kernel thread to preempt another non-interrupt kernel thread.

The mainframe z/OS Operating system supports a similar mechanism, called SRB (System Request Block).

SRBs represent requests to execute a system service routine. SRBs are typically created when one address space detects an event that affects a different address space; they provide one of several mechanisms for asynchronous inter-address space communication for programs running on z/OS.

An SRB is similar to a Process Control Block (PCB), in that it identifies a unit of work to the system. Unlike a PCB, an SRB cannot "own" storage areas. In a multiprocessor environment, the SRB routine, after being scheduled, can be dispatched on another processor and can run concurrently with the scheduling program. The scheduling program can continue to do other processing in parallel with the SRB routine. Only programs running in kernel mode can create an SRB.

The Windows operating system knows a similar light weight thread mechanism named "fibers". Fibers are scheduled by an application program. The port of the CICS Transaction Server to the Windows platform uses fibers, somewhat analogous to the use of "enclaves" under z/OS.

Famous quotes containing the words light, weight, kernel and/or threads:

    Let me give light, but let me not be light,
    For a light wife doth make a heavy husband.
    William Shakespeare (1564–1616)

    The merit of those who fill a space in the world’s history, who are borne forward, as it were, by the weight of thousands whom they lead, shed a perfume less sweet than do the sacrifices of private virtue.
    Ralph Waldo Emerson (1803–1882)

    We should never stand upon ceremony with sincerity. We should never cheat and insult and banish one another by our meanness, if there were present the kernel of worth and friendliness. We should not meet thus in haste.
    Henry David Thoreau (1817–1862)

    Illusion, Temperament, Succession, Surface, Surprise, Reality, Subjectiveness,—these are the threads on the loom of time, these are the lords of life.
    Ralph Waldo Emerson (1803–1882)