Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
DragonFly BSD
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== System design == === Kernel === The [[kernel (operating system)|kernel]] messaging subsystem being developed is similar to those found in microkernels such as [[Mach (kernel)|Mach]], though it is less complex by design. DragonFly's messaging subsystem has the ability to act in either a synchronous or asynchronous fashion, and attempts to use this capability to achieve the best performance possible in any given situation.<ref name="dfbsd-os-wp" /> According to developer [[Matthew Dillon]], progress is being made to provide both device [[input/output]] (I/O) and [[virtual file system]] (VFS) messaging capabilities that will enable the remainder of the project goals to be met. The new infrastructure will allow many parts of the kernel to be migrated out into userspace; here they will be more easily debugged as they will be smaller, isolated programs, instead of being small parts entwined in a larger chunk of code. Additionally, the migration of select kernel code into userspace has the benefit of making the system more robust; if a userspace driver crashes, it will not crash the kernel.<ref name="kt-interview" /> [[System call]]s are being split into userland and kernel versions and being encapsulated into messages. This will help reduce the size and complexity of the kernel by moving variants of standard system calls into a userland [[compatibility layer]], and help maintain forwards and backwards compatibility between DragonFly versions. [[Linux]] and other [[Unix-like]] OS compatibility code is being migrated out similarly.<ref name="unix-for-clusters" /> ==== Threading ==== As support for multiple [[instruction set architecture]]s complicates [[symmetric multiprocessing]] (SMP) support,<ref name="behind-dfbsd" /> DragonFly BSD now limits its support to the [[x86-64]] platform.<ref name="osnews-mp-improved" /> DragonFly originally ran on the [[x86]] architecture, however as of version 4.0 it is no longer supported. Since version 1.10, DragonFly supports 1:1 userland threading (one kernel thread per userland thread),<ref name="luciani_dcbsdcon2009" /> which is regarded as a relatively simple solution that is also easy to maintain.<ref name="unix-for-clusters" /> Inherited from FreeBSD, DragonFly also supports multi-threading.<ref name="paying-off-already" /> In DragonFly, each [[Central processing unit|CPU]] has its own thread scheduler. Upon creation, threads are assigned to processors and are never preemptively switched from one processor to another; they are only migrated by the passing of an [[inter-processor interrupt]] (IPI) message between the CPUs involved. Inter-processor thread scheduling is also accomplished by sending asynchronous IPI messages. One advantage to this clean compartmentalization of the threading subsystem is that the processors' on-board [[CPU cache|caches]] in [[symmetric multiprocessor system]]s do not contain duplicated data, allowing for higher performance by giving each processor in the system the ability to use its own cache to store different things to work on.<ref name="unix-for-clusters" /> The [[Light Weight Kernel Threads|''LWKT'']] subsystem is being employed to partition work among multiple kernel threads (for example in the networking code there is one thread per protocol per processor), reducing competition by removing the need to share certain resources among various kernel tasks.<ref name="behind-dfbsd" /> ==== Shared resources protection ==== In order to run safely on multiprocessor machines, access to shared resources (like files, data structures) must be [[serialization|serialized]] so that threads or processes do not attempt to modify the same resource at the same time. In order to prevent multiple threads from accessing or modifying a shared resource simultaneously, DragonFly employs [[critical section]]s, and serializing tokens to prevent concurrent access. While both Linux and FreeBSD 5 employ fine-grained [[Lock (computer science)|mutex]] models to achieve higher performance on [[multiprocessor]] systems, DragonFly does not.<ref name="behind-dfbsd" /> Until recently, DragonFly also employed [[spl (Unix)|spl]]s, but these were replaced with critical sections. Much of the system's core, including the ''LWKT'' subsystem, the IPI messaging subsystem and the new kernel memory allocator, are lockless, meaning that they work without using mutexes, with each process operating on a single CPU. Critical sections are used to protect against local interrupts, individually for each CPU, guaranteeing that a thread currently being executed will not be preempted.<ref name="luciani_dcbsdcon2009" /> [[Serializing tokens]] are used to prevent concurrent accesses from other CPUs and may be held simultaneously by multiple threads, ensuring that only one of those threads is running at any given time. Blocked or sleeping threads therefore do not prevent other threads from accessing the shared resource unlike a thread that is holding a mutex. Among other things, the use of serializing tokens prevents many of the situations that could result in [[deadlock (computer science)|deadlock]]s and [[priority inversion]]s when using mutexes, as well as greatly simplifying the design and implementation of a many-step procedure that would require a resource to be shared among multiple threads. The serializing token code is evolving into something quite similar to the "[[Read-copy-update]]" feature now available in Linux. Unlike Linux's current RCU implementation, DragonFly's is being implemented such that only processors competing for the same token are affected rather than all processors in the computer.<ref name="serializing token" /> DragonFly switched to multiprocessor safe [[slab allocator]], which requires neither mutexes nor blocking operations for memory assignment tasks.<ref name="slab-allocator-fbsd" /> It was eventually ported into standard C library in the userland, where it replaced FreeBSD's malloc implementation.<ref name="new-libc-malloc" /> ==== Virtual kernel ==== {{Main article|Virtual Kernel}} Since release 1.8 DragonFly has a virtualization mechanism similar to [[User-mode Linux]],<ref name="towards-free-clustering" /> allowing a user to run another kernel in the userland. The virtual kernel (''vkernel'') is run in completely isolated environment with emulated network and storage interfaces, thus simplifying testing kernel subsystems and clustering features.<ref name="unix-for-clusters" /><ref name="kt-interview" /> The vkernel has two important differences from the real kernel: it lacks many routines for dealing with the low-level hardware management and it uses [[C standard library]] (libc) functions in place of in-kernel implementations wherever possible. As both real and virtual kernel are compiled from the same code base, this effectively means that platform-dependent routines and re-implementations of libc functions are clearly separated in a source tree.<ref name="peek-vkernel-1" /> The vkernel runs on top of hardware abstractions provided by the real kernel. These include the [[kqueue]]-based timer, the console (mapped to the [[virtual terminal]] where vkernel is executed), the disk image and virtual kernel Ethernet device (''VKE''), tunneling all packets to the host's [[TUN/TAP|tap]] interface.<ref name="peek-vkernel-2" /> === Package management === Third-party software is available on DragonFly as binary packages via <code>pkgng</code> or from a native [[ports collection]] β [[FreeBSD Ports#DPorts|DPorts]].<ref name="howto-dports" /> DragonFly originally used the [[FreeBSD Ports]] collection as its official [[package management system]], but starting with the 1.4 release switched to [[NetBSD]]'s [[pkgsrc]] system, which was perceived as a way of lessening the amount of work needed for third-party software availability.<ref name="df-released-for-users" /><ref name="10-years-of-pkgsrc" /> Eventually, maintaining compatibility with <code>pkgsrc</code> proved to require more effort than was initially anticipated, so the project created DPorts, an overlay on top of the [[FreeBSD Ports]] collection.<ref name="why-dports" /><ref name="any-new-packages" /> === CARP support === The initial implementation of [[Common Address Redundancy Protocol]] (commonly referred to as ''CARP'') was finished in March 2007.<ref name="carp-first-patch" /> As of 2011, CARP support is integrated into DragonFly BSD.<ref name="man-carp" /> === HAMMER file systems === {{Main article|HAMMER (file system)|HAMMER2}} Alongside the [[Unix File System]], which is typically the default [[file system]] on BSDs, DragonFly BSD supports the [[HAMMER (file system)|HAMMER]] and [[HAMMER2]] file systems. HAMMER2 is the default file system as of version 5.2.0. HAMMER was developed specifically for DragonFly BSD to provide a feature-rich yet better designed analogue of the increasingly popular [[ZFS]].<ref name="unix-for-clusters" /><ref name="kt-interview" /><ref name="hammer-design-document" /> HAMMER supports configurable file system history, [[snapshot (computer storage)|snapshot]]s, [[checksum]]ming, [[data deduplication]] and other features typical for file systems of its kind.<ref name="towards-free-clustering" /><ref name="can-hammer-compete" /> HAMMER2, the successor of the HAMMER file system, is now considered stable, used by default, and the focus of further development. Plans for its development were initially shared in 2012.<ref name="hammer2-design" /> In 2017, Dillon announced that the next DragonFly BSD version (5.0.0) would include a usable, though still experimental, version of HAMMER2, and described features of the design.<ref name="hammer2-release" /> With the release after 5.0.0, version 5.2.0, HAMMER2 became the new default file system. === devfs === In 2007 DragonFly BSD received a new [[device file system]] (devfs), which dynamically adds and removes device nodes, allows accessing devices by connection paths, recognises drives by [[serial number]]s and removes the need for pre-populated <code>/dev</code> file system hierarchy. It was implemented as a [[Google Summer of Code]] 2009 project.<ref name="bsdtalk184" /> === Application snapshots === DragonFly BSD supports [[Amiga]]-style ''resident applications'' feature: it takes a snapshot of a large, dynamically linked program's [[virtual memory]] space after loading, allowing future instances of the program to start much more quickly than it otherwise would have. This replaces the [[prelink]]ing capability that was being worked on earlier in the project's history, as the resident support is much more efficient. Large programs like those found in [[KDE Software Compilation]] with many [[Library (computer science)|shared libraries]] will benefit the most from this support.<ref name="dfbsd-diary" />
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)