FreeBSD Loading Accelerated with Replacement Sorting Algorithm in Sysinit

FreeBSD Implements New Sorting Algorithm in Sysinit

FreeBSD has recently made a significant change to its core operating system. The previously used bubble sorting algorithm in the nucleus (SYSINIT) has been replaced with a more efficient sorting algorithm called “Sorting by the merger” [1]. This change was accepted by the FreeBSD community, recognizing the need for improved performance [2].

The bubble sorting method, although useful for educational purposes, is not suitable for large arrays due to its complexity of O(N^2) [3]. In the case of Sysinit, more than a thousand bubble sorting operations accounted for about 7% of the total loading time of the FreeBSD nucleus [3].

To address this issue, the use of sorting by the merger algorithm was implemented in Sysinit. The merge sorting algorithm not only solves the sorting problem significantly faster but also optimizes memory usage in the nucleus [4]. This optimization is achieved by merging sorted lists instead of re-sorting each supplemented list [4].

With this change, FreeBSD has not only reduced the loading time in virtual machines using FireCracker but has also improved the overall performance and efficiency of the operating system [4].

References:

  1. Sorting by the merger
  2. Change announcement
  3. Bubble Sorting
/Reports, release notes, official announcements.