(Click the public account above to quickly follow)
Compiled by: Open Source China
www.oschina.net/news/84807/is-linux-kerne-design-outdated
The achievements of Linux over the years are undeniable. However, recently, a topic was raised on Reddit asking whether the design of the Linux kernel is outdated, which garnered some interesting responses.
The user Ronis_BR posed the question as follows:
Linux was initiated in 1992, and some features have not changed to this day. I suspect that the latest operating system kernel design technologies (if they exist…) should have made significant advancements compared to the past. So, is the Linux kernel outdated?
In comparison to the designs of Windows, macOS, and FreeBSD kernels, are there any aspects where the Linux kernel’s design is more advanced? (Note that the focus is on the advancement of design, not which one is better).
This topic sparked nearly 400 replies, with many sharing their views on kernel design. Here are some excerpts of differing opinions:
ExoticMandibles:
“Outdated? Not at all. The Linux kernel is actually very aware of modern kernel design, it just chooses to maintain traditional forms.
The core of kernel design lies in the relationship between ‘security/stability’ and ‘performance’. Microkernels sacrifice performance for security. If you have a very small microkernel, it will have a relatively small API surface, making it difficult to attack. Moreover, when you have a faulty file, the driver can crash without occupying the kernel, allowing for a lossless reboot. Superior stability! Superior security! Everything is great.
However, the downside of this approach is that all IPC (Inter-Process Communication) incurs inevitable overhead. If your program wants to load data from a file, it must access the filesystem driver, which means IPC has to handle process context switches and two ring transitions. Then, the filesystem driver requires the kernel to communicate with the hardware, which also means two ring transitions. After that, the filesystem driver sends its reply, which means another round of two transitions, plus another context switch. Total overhead: two context switches, two IPC calls, and six ring transitions. Very expensive!
Monolithic kernels group all device drivers into the kernel. So when a faulty graphics driver occurs, it can occupy the kernel, or if it has a security vulnerability, it can be exploited to compromise the system. However, if your program needs to load something from the disk, it will call the kernel, perform ring transitions, communicate with the hardware, compute the result, and return the result, performing another ring transition. Total overhead: two ring transitions. Much cheaper and faster!
In short, microkernels are: ‘sacrifice performance to enhance security and stability’; monolithic kernels are: ‘maintain performance as long as security and stability issues are fixed’. Currently, people are more willing to accept the latter.
Scandalousmambo:
Developing a system identical to the Linux kernel essentially determines that once it is designed, it will be ‘outdated’.
KugelKurt:
Although most of the discussion here revolves around the relationship between microkernels and monolithic kernels, recent research has also involved programming languages. If you were to start a brand new kernel today, you might not write it in C.
Microsoft’s Singularity and Midori projects explored the feasibility of a managed code kernel using C#.
Daemonpenguin:
There are some concepts that theoretically could provide better kernel designs. For instance, microkernels theoretically have some very good design choices that make them portable, reliable, and potentially self-correcting.
However, no matter how good the theory is, people always design based on practical situations. The Linux kernel has so much hardware support and so many companies backing its development that other kernels (no matter how cool their designs are) are unlikely to catch up.
For example, MINIX has good design and some great features, but it has very little hardware support, and almost no one develops for that platform.
Everyone is welcome to share their views on this matter below.
Did you gain something from reading this article? Please share it with more people.
Follow ‘Linux Enthusiasts’ to enhance your Linux skills