- DragonFly BSD
-
"DragonFly" redirects here. For other uses, see Dragonfly (disambiguation).
DragonFly Company / developer Matthew Dillon OS family Unix-like Working state Current Source model Open source Latest stable release 2.10.1 / April 26, 2011 Latest unstable release 2.11.0 / ongoing Supported platforms IA-32, x86-64 Kernel type Hybrid Userland BSD Default user interface tcsh (root) / sh (users) License BSD Official website http://www.dragonflybsd.org DragonFly BSD is a free Unix-like operating system created as a fork of FreeBSD 4.8. Matthew Dillon, an Amiga developer in the late 1980s and early 1990s and a FreeBSD developer between 1994 and 2003, began work on DragonFly BSD in June 2003 and announced it on the FreeBSD mailing lists on July 16, 2003.[1]
Dillon started DragonFly in the belief that the methods and techniques being adopted for threading and symmetric multiprocessing in FreeBSD 5[2] would lead to poor system performance and would cause maintenance difficulties. He sought to correct these suspected problems within the FreeBSD project.[3] Due to ongoing conflicts with other FreeBSD developers over the implementation of his ideas,[4] and other reasons, his ability to directly change the FreeBSD code was eventually revoked. Despite this, the DragonFly BSD and FreeBSD projects still work together contributing bug fixes, driver updates and other system improvements to each other.
Intended to be the logical continuation of the FreeBSD 4.x series, DragonFly's development has diverged significantly from FreeBSD's, including a new Light Weight Kernel Threads implementation (LWKT) and a light weight ports/messaging system.[5] Many concepts planned for DragonFly were inspired by AmigaOS.[6]
Contents
System design
Kernel
Like most modern kernels, DragonFly is a hybrid, containing features of both monolithic and microkernels, such as the message passing capability of microkernels enabling larger portions of the OS to benefit from protected memory, as well as retaining the speed of monolithic kernels for certain critical tasks. The messaging subsystem being developed is similar to those found in microkernels such as 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.[7]
There is progress being made to provide both device input/output (I/O) and virtual file system (VFS) messaging capabilities that will allow the remainder of the project goals to be met. The new infrastructure will allow many parts of the kernel to be migrated out into userland, whereby 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. The migration of select kernel code into userspace has the additional benefit of making the system more robust; if a userspace driver crashes, it will not crash the kernel.
System calls are being split into userland and kernel versions, as well as 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, as well as help maintain forwards and backwards compatibility between DragonFly versions. Linux and other Unix-like OS compatibility code is being migrated out similarly. Multiple instances of the native userland compatibility layer created in jails could give DragonFly functionality similar to that found in UML.[6] Unlike UML (which is essentially a port of Linux to itself as if the host kernel was a different hardware platform), DragonFly's virtualization doesn't require special drivers to communicate with the real hardware on the computer.
CPU localization
In DragonFly, threads are locked to CPUs by design, and each processor has its own LWKT scheduler. Threads are never preemptively switched from one processor to another; they are only migrated by the passing of an 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 caches in SMP systems 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.[6]
The LWKT subsystem is being employed to partition work among multiple kernel threads (for example in the networking code; one thread per protocol per processor), reducing contention by removing the need to share certain resources among various kernel tasks. This thread partitioning implementation of CPU localization algorithms is arguably the key differentiating feature of DragonFly's design.
In order to run safely on multiprocessor machines, access to shared resources (files, data structures etc.) must be 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 sections, and serializing tokens to prevent concurrent access. Whereas both Linux and FreeBSD 5 employ fine-grained mutex models to achieve higher performance on multiprocessor systems, DragonFly does not. Until recently, DragonFly also employed SPLs, 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, and operate on a per-CPU basis. Critical sections are used to protect against local interrupts and operate on a per-CPU basis, guaranteeing that a thread currently being executed will not be preempted.
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 deadlocks and priority inversions 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.
Threading
As support for multiple processor architectures complicates SMP support,[4] DragonFly BSD limits its supported platforms to x86 and x86-64, with both single processor and SMP models.[8][9] Since version 1.10, DragonFly supports 1:1 userland threading (one kernel thread for every userland thread),[10][11] which is seen as a relatively simple and easy to maintain solution.[6] Inherited from FreeBSD, DragonFly also supports SMP multi-threading imported.[12]
Virtual kernel
Since release 1.8 DragonFly has a new virtualization mechanism similar to UML,[13] allowing to run another kernel in the userland. The virtual kernel is run in completely isolated environment with emulated network and storage interfaces, thus simplifying testing the drivers, kernel subsystems and clustering features.[14][6]
Memory management
Early on in its development, DragonFly acquired a slab allocator, which replaced the aging FreeBSD 4 kernel memory allocator.[15] The new slab allocator requires neither mutexes nor blocking operations for memory assignment tasks and, unlike the code it replaced, is multiprocessor safe. It was eventually ported to be utilized outside the kernel in a replacement to the old userland malloc implementation.[16]
DragonFly uses SFBUFs (Super-Fast BUFfers) and MSFBUFs (Multi-SFBUFs). A SFBUF is used to manage ephemeral single-page mappings and cache them when appropriate. They are used for retrieving a reference to data that is held by a single VM page. This simple, yet powerful, abstraction gives a broad number of abilities, such as zero-copy achieved in the sendfile(2) system call.
SFBUFs are used in numerous parts of the kernel, such as the Vnode Object Pager and the PIPE subsystems (indirectly via XIOs) for supporting high-bandwidth transfers. An SFBUF can only be used for a single VM page; MSFBUFs are used for managing ephemeral mappings of multiple-pages.
The SFBUF concept was devised by David Greenman of the FreeBSD Project when he wrote the sendfile(2) system call; it was later revised by Dr. Alan L. Cox and Matthew Dillon. MSFBUFs were designed by Hiten Pandya and Matthew Dillon.
Package management
DragonFly previously used FreeBSD's Ports system for third party software, but since the 1.4 release, NetBSD's pkgsrc is the official package management system. With
pkgsrc
, the DragonFly developers are largely freed of having to maintain a large number of third party programs while still having access to up to date applications.[17] The pkgsrc developers also benefit from this arrangement as it helps to ensure the portability of the code.[3]Still
pkgsrc
is seen as a temporary solution. One of the project stated goals is an advanced VFS-based package management system capable of dealing with multiple packages versions.[10]CARP support
The initial implementation of Common Address Redundancy Protocol (commonly referred as CARP) to was finished in March 2007[18]. As of 2011, CARP support is integrated into DragonFly BSD.[19]
HAMMER file system
Main article: HAMMERAlongside with Unix File System, which is typically the default file system on BSDs, DragonFly BSD supports HAMMER file system. It was developed specifically for DragonFly BSD to provide a feature-rich yet better designed analogue of then increasingly popular ZFS.[14][20][6]
HAMMER supports configurable file system history, snapshots, checksumming, data deduplication and other features typical for file systems of its kind.[13] Though its performance is currently beyond the similar file systems like ZFS or btrfs, it is recognised as an interesting and perspective option.[21]
devfs
In 2007 DragonFly BSD received a new device file system, which dynamically adds and removed device nodes, allows accessing devices by connection paths, recognises drives by serial numbers and removes the need for pre-populated
/dev
file system hierarchy. It was implemented as a Google Summer of Code'2009 project.[22]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 prelinking 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 with many shared libraries will benefit the most from this support.[23]
Development and distribution
DragonFly forked from FreeBSD 4.8 and imports features and bug fixes from FreeBSD 4 and 5 where appropriate, such as ACPI and a new ATA driver framework from FreeBSD 4. As the number of DragonFly developers is currently small, with most of them focused on implementing basic functionality, device drivers are being kept mostly in sync with FreeBSD 5.x, the branch of FreeBSD where all new drivers are being written. The DragonFly developers are slowly moving toward using the "busdma" APIs, which will help to make the system easier to port to new architectures, but it is not a major focus at this time.
As with FreeBSD and OpenBSD, the developers of DragonFly BSD are slowly replacing K&R style C code with more modern, ANSI equivalents. Similar to other operating systems, DragonFly's version of the GNU Compiler Collection has an enhancement called the Stack-Smashing Protector (ProPolice) enabled by default, providing some additional protection against buffer overflow based attacks. It should be noted that as of 23 July 2005[update], the kernel is no longer built with this protection by default.[23]
Being a derivative of FreeBSD, DragonFly has inherited an easy-to-use integrated build system that can rebuild the entire base system from source with only a few commands. The DragonFly developers use the Git version control system to manage changes to the DragonFly source code. Unlike its parent FreeBSD, DragonFly has both stable and unstable releases in a single source tree, due to a smaller developer base.[4]
Like the other BSD kernels (and those of most modern operating systems), DragonFly employs a built-in kernel debugger to help the developers find kernel bugs. Furthermore, as of October 2004[update], a debug kernel, which makes bug reports more useful for tracking down kernel-related problems, is installed by default, at the expense of a relatively small quantity of disk space. When a new kernel is installed, the backup copy of the previous kernel and its modules are stripped of their debugging symbols to further minimize disk space usage.
Distribution media
The operating system is distributed as a Live CD and Live USB (full X11 flavour available) that boots into a complete DragonFly system.[13][22] It includes the base system and a complete set of manual pages, and may include source code and useful packages in future versions. The advantage of this is that with a single CD you can install the software onto a computer, use a full set of tools to repair a damaged installation, or demonstrate the capabilities of the system without installing it. Daily snapshots for both i386 and x86-64 architectures are available from the master site for those who want to install the most recent versions of DragonFly without building from source.
Like the other free open source BSDs, DragonFly is distributed under the terms of the modern version of the BSD license.
Release history
Version Date[24] Changes 1.0 July 12, 2004 - technology showcase
- new BSD Installer
- LWKT subsystem and lightweight ports/messaging system
- mostly MP safe networking stack
- lockless memory allocator
- variant symlinks
- application checkpointing support.[4]
1.2 April 8, 2005 - TCP SACK
- TCP Performance tuning
- ALTQ and PF
- thread-local storage
- Console over IEEE 1394
- Namecache infrastructure rewritten
- X11 support
pkgsrc
support
1.4 January 7, 2006 1.6 July 24, 2006 - new random number generator
- IEEE 802.11 framework refactored
- major giant lock, clustering and userland VFS improvements
- major stability improvements[25]
1.8 January 30, 2007 - virtual kernel implementation (similar to User-mode Linux or KVM)
1.10 August 6, 2007 - userland threading system
- Advanced Host Controller Interface support
- GUID Partition Table support
1.12 February 26, 2008 2.0 July 20, 2008 - major HAMMER improvements
2.2 February 17, 2009 2.4 September 16, 2009 - devfs
- New AHCI driver
- Network File System improvements
- full x86-64 support
2.6 April 6, 2010 - swapcache
- tmpfs ported from NetBSD
- HAMMER and general I/O improvements
2.8 October 30, 2010 - Wi-Fi stack ported from FreeBSD
- Logical volume management
- dm-crypt
- new disk scheduler
- reduced giant lock usage
2.10 April 26, 2011 - Giant lock removed from every area except the virtual memory subsystem
- HAMMER deduplication
- GCC 4.4
- bridging system rewritten
- significant performance improvements
Future directions
Userland VFS with journaling
Userland VFS - the ability to migrate filesystem drivers into userspace, will take a lot of work to accomplish. Some of this work is already complete, though there is still much to do.[14] The namecache code has been extracted from and made independent of the VFS code, and converting the VFS code to DragonFly's threaded messaging interface is Matt's next major focus. This will be more difficult than converting the device I/O and system calls was, due to the fact that the VFS system inherited from FreeBSD uses a massively reentrant model.[10]
The userland VFS system is a prerequisite of a number of desired features to be incorporated into DragonFly. Dillon envisions a new package management system based at least in part, on VFS environments which give the packages the environment they expect to be in, independent of the larger filesystem environment and its quirks.[10] In addition to system call message filtering, VFS environments are also to play a role in future security mechanisms, by restricting users or processes to their own isolated environments.[5][27]
A new journaling layer is being developed for DragonFly for the purpose of transparently backing up entire filesystems in real-time, securely over a network.[28][29] What remains to be done is the ability to restore a filesystem to a previous state, as well as general stability enhancements.[29] This differs from traditional meta-data journaling filesystems in two ways: (1) it will work with all supported filesystems, as it is implemented in the VFS layer instead of in the individual filesystem drivers, and (2) it will back up all of the data contained on a disk or partition, instead of just meta-data, allowing for the recovery of even the most damaged of installations.[28]
While working on the journaling code, Dillon realized that the userland VFS he envisioned may be closer than he initially thought, though it is still some ways off.[30]
SSI clustering
Ultimately, Dillon wants DragonFly to natively enable secure anonymous system clustering over the Internet,[13] and the light weight ports/messaging system will help to provide this capability.[14][5] Security settings aside, there is technically no difference between messages created locally or on another computer over a network. Achieving this single-system image[10] capability transparently will be a big job, and will take quite some time to properly implement, even with the new foundation fully in place.[6] While some of the short term goals of the project will be completed in months, other features may take years to complete.[4] SSI clustering will have applications in scientific computing.
See also
References
- ^ Dillon, Matthew (2003-07-16). "Announcing DragonFly BSD!". freebsd-current mailing list. http://lists.freebsd.org/pipermail/freebsd-current/2003-July/006889.html. Retrieved 2007-07-26.
- ^ Lehey, Greg (2001) (pdf), Improving the FreeBSD SMP implementation, USENIX, http://www.lemis.com/~grog/SMPng/USENIX/paper.pdf
- ^ a b Kerner, Sean Michael (2006-01-10), "New DragonFly Released For BSD Users", InternetNews, http://www.internetnews.com/dev-news/article.php/3576426, retrieved 2011-11-20
- ^ a b c d e Biancuzzi, Federico (2004-07-08), "Behind DragonFly BSD", O'Reilly Media, http://www.onlamp.com/pub/a/bsd/2004/07/08/dragonfly_bsd_interview.html, retrieved 2011-11-20
- ^ a b c Loli-Queru, Eugenia (2004-03-13), "Interview with Matthew Dillon of DragonFly BSD", OSNews, http://www.osnews.com/story.php?news_id=6338
- ^ a b c d e f g Chisnall, David (2007-06-15), "DragonFly BSD: UNIX for Clusters?", InformIT, http://www.informit.com/articles/article.aspx?p=766375, retrieved 2011-11-22
- ^ Hsu, Jeffery M. (pdf), The DragonFly BSD Operating System, http://people.freebsd.org/~hsu/papers/dragonflybsd.asiabsdcon04.pdf, retrieved 2011-11-20
- ^ "DragonFly BSD MP Performance Significantly Improved", OSNews, 2011-11-16, http://www.osnews.com/story/25334/DragonFly_BSD_MP_Performance_Significantly_Improved, retrieved 2011-11-19
- ^ Supported Hardware, http://www.dragonflybsd.org/docs/supportedhardware/, retrieved 2011-11-19
- ^ a b c d e DragonFly Design Goals, http://www.dragonflybsd.org/goals/, retrieved 2011-11-19
- ^ Luciani, Robert (2009-05-24) (pdf), M:N threading in DragonflyBSD, BSDCon, archived from the original on 2010-12-23, http://web.archive.org/web/20101223004617/http://www.dcbsdcon.org/speakers/slides/luciani_dcbsdcon2009.pdf
- ^ Sherrill, Justin (2004-01-11), Paying off already, http://www.shiningsilence.com/dbsdlog/2004/01/11/194.html, retrieved 2011-11-20
- ^ a b c d e Vervloesem, Koen (2010-04-21), "DragonFly BSD 2.6: towards a free clustering operating system", LWN.net, http://lwn.net/Articles/384200/, retrieved 2011-11-19
- ^ a b c d Andrews, Jeremy (2007-08-06), "Interview: Matthew Dillon", KernelTrap, http://www.kerneltrap.org/node/14116, retrieved 2011-11-20
- ^ Bonwick, Jeff; Adams, Jonathan (2002-01-03), Magazines and Vmem: Extending the Slab Allocator to Many CPUs and Arbitrary Resources, USENIX, http://www.usenix.org/event/usenix01/bonwick.html, retrieved 2011-11-20
- ^ Dillon, Matthew (2009-04-23). "New libc malloc committed". kernel mailing list. http://leaf.dragonflybsd.org/mailarchive/kernel/2009-04/msg00021.html. Retrieved 2011-08-08.
- ^ Weinem, Mark (2007), Joerg Sonnenberger about pkgsrc on DragonFly BSD and his pkgsrc development projects., "10 years of pkgsrc", NetBSD, http://www.netbsd.org/gallery/10years.html#sonnenberger, retrieved 2011-11-22
- ^ Buschmann, Jonathan (2007-03-14). "First Patch to get CARP on Dfly". kernel mailing list. http://leaf.dragonflybsd.org/mailarchive/kernel/2007-03/msg00033.html. Retrieved 2011-11-20.
- ^ "CARP(4) manual page", DragonFly On-Line Manual Pages, http://leaf.dragonflybsd.org/cgi/web-man?command=carp§ion=4, retrieved 2011-11-20
- ^ Dillon, Matthew (2007-10-10). "Re: HAMMER filesystem update - design document". kernel mailing list. http://leaf.dragonflybsd.org/mailarchive/kernel/2007-10/msg00008.html. Retrieved 2011-11-20.
- ^ Larabel, Michael (2011-01-07), "Can DragonFlyBSD's HAMMER Compete With Btrfs, ZFS?", Phoronix, http://www.phoronix.com/scan.php?page=article&item=dragonfly_hammer, retrieved 2011-11-20, "HAMMER does appear to be a very interesting BSD file-system. It is though not quite as fast as the ZFS file-system on BSD, but this is also an original file-system to the DragonFlyBSD project rather than being a port from OpenSolaris. Not only is HAMMER generally faster than the common UFS file-system, but it also has a much greater feature-set."
- ^ a b Mr (2010-01-07), "bsdtalk184 - DragonFlyBSD with Matthew Dillon" (ogg), bsdtalk, http://cisx1.uma.maine.edu/~wbackman/bsdtalk/bsdtalk184.ogg, retrieved 2011-11-20
- ^ a b DragonFly BSD diary, 2006-01-07, http://www.dragonflybsd.org/diary/, retrieved 2011-11-19
- ^ DragonFly: Releases, http://www.dragonflybsd.org/releases/, retrieved 2011-11-22
- ^ a b Kerner, Sean Michael (2006-07-25), "DragonFly BSD 1.6 Cuts the Cord", InternetNews, http://www.internetnews.com/dev-news/article.php/3622406, retrieved 2011-11-20
- ^ Townsend, Trent (2006-01-18), "A Quick Review of DragonFly BSD 1.4", OSNews, http://www.osnews.com/story/13352/A_Quick_Review_of_DragonFly_BSD_1_4, retrieved 2011-11-16
- ^ Interjú Matthew Dillionnal a DragonFly BSD alapítójával, 2003-10-10, http://hup.hu/node/4512, retrieved 2011-11-20
- ^ a b Dillon, Matthew (2004-12-28). "Description of the Journaling topology". kernel mailing list. http://leaf.dragonflybsd.org/mailarchive/kernel/2004-12/msg00105.html. Retrieved 2011-11-20.
- ^ a b Dillon, Matthew (2008-07-28). "Re: Regarding Filesystems". kernel mailing list. http://leaf.dragonflybsd.org/mailarchive/kernel/2008-07/msg00145.html. Retrieved 2011-11-20.
- ^ Dillon, Matthew (2005-07-15). "Re: VFS journaling... similar technology". kernel mailing list. http://leaf.dragonflybsd.org/mailarchive/kernel/2005-07/msg00045.html. Retrieved 2011-11-20.
Unix and Unix-like operating systems AmigaOS Amiga technologies AmigaBASIC • AmigaDOS • Amigaguide • ARexx • Blitter object • Exec/WarpOS • Guru Meditation • Hunk • Intuition • Kickstart • RAM disk • WorkbenchAmiga GUIs File systems OS versions 68k-based: 1.0, 1.1, 1.2, 1.3, 1.4 (beta) • 2.0, 2.04, 2.05, 2.1 • 3.0, 3.1, 3.5, 3.9
PowerPC-based: 4.0, 4.1Software packs Amiga Forever • AmiKitOther software Influenced Categories:- Free software operating systems
- DragonFly BSD
- Software forks
Wikimedia Foundation. 2010.