Software:DragonFly BSD

From HandWiki
Short description: Free and open-source Unix-like operating system
DragonFly BSD
DragonFly BSD Logo.svg
DragonFly BSD 6.2.1 boot loader screenshot.png
DragonFly BSD 6.2.1 UEFI boot loader
DeveloperMatthew Dillon
OS familyUnix-like (BSD)
Working stateCurrent
Source modelOpen source
Initial release1.0 / 12 July 2004; 20 years ago (2004-07-12)
|Final release|Latest release}}6.4.0 / 30 December 2022; 18 months ago (2022-12-30)[1]
Available inEnglish
Package managerpkg
Platformsx86-64
Kernel typeHybrid[2]
UserlandBSD
Default user interfaceUnix shell
LicenseBSD[3]
Official websitewww.dragonflybsd.org

DragonFly BSD is a free and open-source Unix-like operating system forked from FreeBSD 4.8. Matthew Dillon, an Amiga developer in the late 1980s and early 1990s and FreeBSD developer between 1994 and 2003, began working on DragonFly BSD in June 2003 and announced it on the FreeBSD mailing lists on 16 July 2003.[4]

Dillon started DragonFly in the belief that the techniques adopted for threading and symmetric multiprocessing in FreeBSD 5[5] would lead to poor performance and maintenance problems. He sought to correct these anticipated problems within the FreeBSD project.[6] Due to conflicts with other FreeBSD developers over the implementation of his ideas,[7] his ability to directly change the codebase was eventually revoked. Despite this, the DragonFly BSD and FreeBSD projects still work together, sharing bug fixes, driver updates, and other improvements.

Intended as the logical continuation of the FreeBSD 4.x series, DragonFly has diverged significantly from FreeBSD, implementing lightweight kernel threads (LWKT), an in-kernel message passing system, and the HAMMER file system.[8] Many design concepts were influenced by AmigaOS.[9]

System design

Kernel

The kernel 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.[10]

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.[11]

System calls 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.[9]

Threading

As support for multiple instruction set architectures complicates symmetric multiprocessing (SMP) support,[7] DragonFly BSD now limits its support to the x86-64 platform.[12] 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),[13] which is regarded as a relatively simple solution that is also easy to maintain.[9] Inherited from FreeBSD, DragonFly also supports multi-threading.[14]

In DragonFly, each 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 caches in symmetric multiprocessor 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.[9]

The 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.[7]

Shared resources protection

In order to run safely on multiprocessor machines, access to shared resources (like files, data structures) 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. While both Linux and FreeBSD 5 employ fine-grained mutex models to achieve higher performance on multiprocessor systems, DragonFly does not.[7] 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, 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.[13]

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.[15]

DragonFly switched to multiprocessor safe slab allocator, which requires neither mutexes nor blocking operations for memory assignment tasks.[16] It was eventually ported into standard C library in the userland, where it replaced FreeBSD's malloc implementation.[17]

Virtual kernel

Since release 1.8 DragonFly has a virtualization mechanism similar to User-mode Linux,[18] 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.[9][11]

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.[19]

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 tap interface.[20]

Package management

Third-party software is available on DragonFly as binary packages via pkgng or from a native ports collectionDPorts.[21]

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.[6][22] Eventually, maintaining compatibility with pkgsrc proved to require more effort than was initially anticipated, so the project created DPorts, an overlay on top of the FreeBSD Ports collection.[23][24]

CARP support

The initial implementation of Common Address Redundancy Protocol (commonly referred to as CARP) was finished in March 2007.[25] As of 2011, CARP support is integrated into DragonFly BSD.[26]

HAMMER file systems

Alongside the Unix File System, which is typically the default file system on BSDs, DragonFly BSD supports the 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.[9][11][27] HAMMER supports configurable file system history, snapshots, checksumming, data deduplication and other features typical for file systems of its kind.[18][28]

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.[29] 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.[30] 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 numbers and removes the need for pre-populated /dev file system hierarchy. It was implemented as a Google Summer of Code 2009 project.[31]

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 Software Compilation with many shared libraries will benefit the most from this support.[32]

Development and distribution

DragonFly BSD 6.2.1 with Lumina desktop environment

As with FreeBSD and OpenBSD, the developers of DragonFly BSD are slowly replacing pre-function prototype-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. (As of July 2005), the kernel is no longer built with this protection by default.[32]

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.[7]

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), 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 that boots into a complete DragonFly system.[18][31] 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 users 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 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 and open-source BSDs, DragonFly is distributed under the terms of the modern version of the BSD license.

Release history

Version Date[33] Changes
6.4 2022
6.2.1 2022
  • NVMM ported to DragonFly
  • Added support for growfs to changing the size of an existing HAMMER2 volume.
  • Added xdisk. Remote HAMMER2 disks can be mounted (experimental feature)
  • Imported amdgpu driver, matches Linux 4.19 support.
  • Updated DRM
6.0 2021
  • Improved work of 'dsynth' - tool that allow to maintain local DPort repository
  • Removed support of MAP_VPAGETABLE mmap(), as result no 'vkernel' in this release able to work
5.8 2020
5.6 2019
  • Improved virtual memory system
  • Updates to radeon and ttm
  • Performance improvements for HAMMER2
5.4 2018
  • Updated drivers for network, virtual machines & display
  • GCC 8.0 with the previous GCC releases
  • Hammer with more issue fixes
5.2 2018
5.0 2017
  • New HAMMER2 filesystem
  • Can now support over 900,000 processes on a single machine
  • Improved i915 support
  • IPFW better performance
4.8 2017
  • Initial AMD Ryzen support
  • Improved i915 support
  • Improved kernel performance
  • eMMC boot support
  • LibreSSL replaced OpenSSL in base
  • GCC 5.4.1
  • LTO support
  • Initial Clang framework
  • UEFI install support
4.6 2016
  • Improved i915 and Radeon support
  • NVM Express support
  • Improved SMP performance
  • Improved network performance
  • Preliminary support for UEFI booting
  • autofs imported from FreeBSD, amd removed
4.4 2015
  • GCC 5.2
  • gold now the default linker
  • Improved i915 and Radeon support
  • Complete overhaul of the locale system
  • Collation support for named locales
  • Regex library replaced with TRE
  • Symbol versioning support in libc
  • Numerous HAMMER cleanups and fixes
4.2 2015
  • GCC 5.1.1
  • Improved i915 and Radeon support
  • Improved sound support
  • Improved support for memory controller and temperature sensors
  • Path MTU Discovery enabled by default
  • SCTP support removed
  • Sendmail replaced by DMA
  • GNU Info pages removed
4.0 2014
  • Non-locking, multi-threading PF
  • Related networking better-threaded for improved throughput
  • Procctl security feature in kernel
  • Support for up to 256 CPUs
  • Improved wireless networking support
  • Rust and Free Pascal now supported
  • i915 support greatly improved
  • GCC 4.7.4
3.8 2014
  • Dynamic root and PAM support
  • USB4BSD now default
  • Native C-State support for Intel CPUs
  • TCP port token split for better TCP connect(2) performance
  • GCC 4.7.3
  • HAMMER2 in system ( not ready for production use )
  • Final 32-bit release
3.6 2013
  • SMP contention reduction
  • Kernel modesetting for Intel and AMD GPUs
  • Hardware acceleration for Intel GPUs up to Ivy Bridge[34]
3.4 2013
  • New package manager, DPorts, introduced
  • GCC 4.7
  • Improved CPU usage and tmpfs performance under extreme load
3.2 2012
  • Multiprocessor-capable kernel became mandatory.
  • Performance improvements in the scheduler.
  • USB4BSD imported from FreeBSD.
  • PUFFS imported from NetBSD.
3.0 2012
  • Multiprocessor-capable kernel became the default
  • HAMMER performance improvements
  • TrueCrypt-compatible encryption support
  • dm-crypt replaced with a compatible BSD-licensed library
  • Enhanced POSIX compatibility
  • Device driver for ECC memory
  • Major network protocol stack and SMP improvements
  • ACPI-related improvements
2.10 2011
  • Giant lock removed from every area except the virtual memory subsystem
  • HAMMER deduplication
  • GCC 4.4
  • Bridging system rewritten
  • Major performance improvements
2.8 2010
2.6 2010
  • Swapcache
  • tmpfs imported from NetBSD
  • HAMMER and general I/O improvements
2.4 2009
  • devfs
  • New AHCI driver, including full NCQ support[35]
  • NFS improvements
  • Full x86-64 support
2.2 2009
  • HAMMER officially production-ready[18]
  • Major stability improvements
  • New release media: LiveCD and LiveUSB
2.0 2008
1.12 2008
1.10 2007
1.8 2007
  • Virtual kernel implementation
1.6 2006
  • New random number generator
  • IEEE 802.11 framework refactored
  • Major giant lock, clustering, and userland VFS improvements
  • Major stability improvements[36]
1.4 2006
1.2 2005
1.0 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.[7]

See also

References

  1. "DragonFly BSD 6.4". https://www.dragonflybsd.org/release64/. 
  2. Dillon, Matthew (22 August 2006), "Re: How much of microkernel?", kernel mailing list, https://www.dragonflybsd.org/mailarchive/kernel/2006-08/msg00037.html, retrieved 14 September 2011 
  3. "DragonFly BSD License", DragonFly BSD, //www.dragonflybsd.org/docs/developer/DragonFly_BSD_License/, retrieved 17 January 2015 
  4. Dillon, Matthew (16 July 2003), "Announcing DragonFly BSD!", freebsd-current mailing list, http://lists.freebsd.org/pipermail/freebsd-current/2003-July/006889.html, retrieved 26 July 2007 
  5. Lehey, Greg (2001), Improving the FreeBSD SMP implementation, USENIX, http://www.lemis.com/~grog/SMPng/USENIX/paper.pdf, retrieved 22 February 2012 
  6. 6.0 6.1 Kerner, Sean Michael (10 January 2006), "New DragonFly Released For BSD Users", InternetNews, http://www.internetnews.com/dev-news/article.php/3576426, retrieved 20 November 2011 
  7. 7.0 7.1 7.2 7.3 7.4 7.5 Biancuzzi, Federico (8 July 2004), "Behind DragonFly BSD", O'Reilly Media, http://www.onlamp.com/pub/a/bsd/2004/07/08/dragonfly_bsd_interview.html, retrieved 20 November 2011 
  8. Loli-Queru, Eugenia (13 March 2004), "Interview with Matthew Dillon of DragonFly BSD", OSNews, http://www.osnews.com/story.php?news_id=6338, retrieved 22 February 2012 
  9. 9.0 9.1 9.2 9.3 9.4 9.5 Chisnall, David (15 June 2007), "DragonFly BSD: UNIX for Clusters?", InformIT, http://www.informit.com/articles/article.aspx?p=766375, retrieved 22 November 2011 
  10. Hsu, Jeffery M. (2004-03-13). "The DragonFly BSD Operating System". AsiaBSDCon 2004. Taipei, Taiwan. http://people.freebsd.org/~hsu/papers/dragonflybsd.asiabsdcon04.pdf. Retrieved 20 November 2011. 
  11. 11.0 11.1 11.2 Andrews, Jeremy (6 August 2007), "Interview: Matthew Dillon", KernelTrap, http://www.kerneltrap.org/node/14116 
  12. "DragonFly BSD MP Performance Significantly Improved", OSNews, 16 November 2011, http://www.osnews.com/story/25334/DragonFly_BSD_MP_Performance_Significantly_Improved, retrieved 19 November 2011 
  13. 13.0 13.1 Luciani, Robert (24 May 2009), M:N threading in DragonflyBSD, BSDCon, http://www.dcbsdcon.org/speakers/slides/luciani_dcbsdcon2009.pdf 
  14. Sherrill, Justin (11 January 2004), Paying off already, http://www.shiningsilence.com/dbsdlog/2004/01/11/194.html, retrieved 20 November 2011 
  15. Pistritto, Joe; Dillon, Matthew; Sherrill, Justin C. et al. (24 April 2004), "Serializing token", kernel mailing list, http://thread.gmane.org/gmane.os.dragonfly-bsd.kernel/4436, retrieved 20 March 2012 
  16. Bonwick, Jeff; Adams, Jonathan (3 January 2002), Magazines and Vmem: Extending the Slab Allocator to Many CPUs and Arbitrary Resources, USENIX, http://www.usenix.org/event/usenix01/bonwick.html, retrieved 20 November 2011 
  17. Dillon, Matthew (23 April 2009), "New libc malloc committed", kernel mailing list, http://leaf.dragonflybsd.org/mailarchive/kernel/2009-04/msg00021.html, retrieved 8 August 2011 
  18. 18.0 18.1 18.2 18.3 Vervloesem, Koen (21 April 2010), "DragonFly BSD 2.6: towards a free clustering operating system", LWN.net, https://lwn.net/Articles/384200/, retrieved 19 November 2011 
  19. Economopoulos, Aggelos (16 April 2007), "A peek at the DragonFly Virtual Kernel", LWN.net (part 1), https://lwn.net/Articles/228404/, retrieved 8 December 2011 
  20. Economopoulos, Aggelos (16 April 2007), "A peek at the DragonFly Virtual Kernel", LWN.net (part 2), https://lwn.net/Articles/230658/, retrieved 8 December 2011 
  21. "HowTo DPorts", DragonFly BSD, //www.dragonflybsd.org/docs/howtos/HowToDPorts/, retrieved 2 December 2013 
  22. Weinem, Mark (2007). "10 years of pkgsrc". NetBSD. Joerg Sonnenberger about pkgsrc on DragonFly BSD and his pkgsrc development projects. https://netbsd.org/gallery/10years.html#sonnenberger. 
  23. Sherrill, Justin (30 September 2013), "Why dports?", DragonFly BSD Digest, http://www.shiningsilence.com/dbsdlog/2013/09/30/12549.html, retrieved 2 December 2011 
  24. Sherrill, Justin (29 September 2013), "Any new packages?", users mailing list, http://lists.dragonflybsd.org/pipermail/users/2013-September/090165.html, retrieved 2 December 2013 
  25. Buschmann, Jonathan (14 March 2007), "First Patch to get CARP on Dfly", kernel mailing list, http://leaf.dragonflybsd.org/mailarchive/kernel/2007-03/msg00033.html, retrieved 20 November 2011 
  26. "CARP(4) manual page", DragonFly On-Line Manual Pages, http://leaf.dragonflybsd.org/cgi/web-man?command=carp&section=4, retrieved 20 November 2011 
  27. Dillon, Matthew (10 October 2007), "Re: HAMMER filesystem update - design document", kernel mailing list, http://leaf.dragonflybsd.org/mailarchive/kernel/2007-10/msg00008.html, retrieved 20 November 2011 
  28. Larabel, Michael (7 January 2011), "Can DragonFlyBSD's HAMMER Compete With Btrfs, ZFS?", Phoronix, https://www.phoronix.com/scan.php?page=article&item=dragonfly_hammer, retrieved 20 November 2011, "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." 
  29. Dillon, Matthew (8 February 2012), "DESIGN document for HAMMER2 (08-Feb-2012 update)", users, http://leaf.dragonflybsd.org/mailarchive/users/2012-02/msg00020.html, retrieved 22 February 2012 
  30. Dillon, Matthew (18 August 2017), "Next DFly release will have an initial HAMMER2 implementation", users, http://lists.dragonflybsd.org/pipermail/users/2017-August/313558.html, retrieved 3 July 2018 
  31. 31.0 31.1 Mr (7 January 2010), "DragonFlyBSD with Matthew Dillon" (ogg), bsdtalk, http://cisx1.uma.maine.edu/~wbackman/bsdtalk/bsdtalk184.ogg, retrieved 20 November 2011 
  32. 32.0 32.1 "DragonFly BSD diary", DragonFly BSD, 7 January 2006, //www.dragonflybsd.org/diary/, retrieved 19 November 2011 
  33. "DragonFly: Releases", DragonFly BSD, //www.dragonflybsd.org/releases/, retrieved 19 June 2014 
  34. Tigeot, Francois (31 July 2007), "KMS + i915 support now in -master", users mailing list, http://lists.dragonflybsd.org/pipermail/users/2013-July/053643.html, retrieved 2 December 2013 
  35. Matthew Dillon (2009-06-04). ""Re: DragonFly-2.3.1.165.g25822 master sys/dev/disk/ahci Makefile TODO ahci.c ahci.h ahci_attach.c ahci_cam.c ahci_dragonfly.c ahci_dragonfly.h atascsi.h"". http://www.dragonflybsd.org/mailarchive/kernel/2009-06/msg00004.html. 
  36. 36.0 36.1 Kerner, Sean Michael (25 July 2006), "DragonFly BSD 1.6 Cuts the Cord", InternetNews, http://www.internetnews.com/dev-news/article.php/3622406, retrieved 20 November 2011 
  37. Townsend, Trent (18 January 2006), "A Quick Review of DragonFly BSD 1.4", OSNews, http://www.osnews.com/story/13352/A_Quick_Review_of_DragonFly_BSD_1_4, retrieved 16 November 2011 

External links