Light Weight Kernel Threads

From Wikipedia, the free encyclopedia

Light Weight Kernel Threads (LWKT) is a computer science term and from DragonFly BSD 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.

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 (Service Request Block).

SRB's represent requests to execute a system service routine. SRB's 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.

In UNIX, "kernel threads" have two threads, one is the core thread, one is the user thread.

See also[edit]

Sources[edit]

  • Matt Dillon's post about the LWKT scheduler
  • Kerner, Sean Michael (2006-01-10), "New DragonFly Released For BSD Users", InternetNews, retrieved 2011-11-20
  • Biancuzzi, Federico (2004-07-08), "Behind DragonFly BSD", O'Reilly Media, archived from the original on 2014-04-09, retrieved 2011-11-20
  • Loli-Queru, Eugenia (2004-03-13), "Interview with Matthew Dillon of DragonFly BSD", OSNews
  • Luciani, Robert (2009-05-24), M:N threading in DragonflyBSD (PDF), BSDCon, archived from the original (PDF) on 2010-12-23
  • Andrews, Jeremy (2007-08-06), "Interview: Matthew Dillon", KernelTrap, archived from the original on 2011-05-15, retrieved 2011-11-20
  • Vervloesem, Koen (2010-04-21), "DragonFly BSD 2.6: towards a free clustering operating system", LWN.net, retrieved 2011-11-19
  • Kerner, Sean Michael (2006-07-25), "DragonFly BSD 1.6 Cuts the Cord", InternetNews, retrieved 2011-11-20
  • Townsend, Trent (2006-01-18), "A Quick Review of DragonFly BSD 1.4", OSNews, retrieved 2011-11-16
  • Interjú Matthew Dillionnal a DragonFly BSD alapítójával, 2003-10-10, retrieved 2011-11-20