I recently found out that Android’s kernel is VERY different from any Apple implementation. Never really crossed my mind that there are different types of kernels.

This made me wonder - if the microkernel is so much better, at the cost of being complicated to develop an OS for, would Android be better on microkernel?

Please enlighten me. I’m only trying to learn more.

Also, do interact, Lemmy needs good conversation.

  • Ramenator@lemmy.world
    link
    fedilink
    English
    arrow-up
    16
    ·
    10 months ago

    Microkernels aren’t better per se than monolithic kernels. Their main advantage is increased security. Only a small portion of the Kernel actually runs in Ring 0, the most privileged level where the code has full access to the computer. Drivers and the like then technically run as separate, less privileged programs that interact with the kernels via messages. This greatly reduces the attack surface on the kernel and prevents crashes or memory access from a faulty driver.
    This comes at a cost though. While microkernels are generally more secure, they are also less performant. Each message means overhead and a context switch you don’t have in a monolithic kernel.
    The discussion between the two kernel types has been going on for the last thirty years and was famously the source for a long argument between Linus Torvalds, founder of the Linux Kernel and Andrew S Tannenbaum, creator of the Minix kernel.
    In the end the XNU kernel isn’t even a full microkernel, but a hybrid kernel, trying to take the best of both world by originally taking the Mach microkernel and then implementing the 4.3BSD monolithic kernel on top of it. There are even project to do the same with Linux, like L4Linux

    Overall the choice of kernel doesn’t hold Android back in comparison, Linux is an extremely capable piece of software that runs on anything from small microcontrollers to all of the world’s largest supercomputers. Though Google’s newest OS project, Fuchsia, actually uses a microkernel for increased security. And it doesn’t use Linux because of licensing, but that’s a whole other can of worms

  • RiderExMachina@lemmy.ml
    link
    fedilink
    English
    arrow-up
    8
    arrow-down
    1
    ·
    edit-2
    10 months ago

    This is my opinion as a random person on the internet: no. The kernel only affects what hardware it can be ran on. Everything else that would make a difference to end users is basically done in userspace.

    The thing holding Android back is its JVM layer between the kernel and the userspace. This adds overhead, meaning your phone needs more RAM or it will have performance issues. You also need slower default animations to cover up the increased loading times from this overhead, which make the system seem slow, especially when compared to iPhones.

    • Ramenator@lemmy.world
      link
      fedilink
      English
      arrow-up
      7
      ·
      edit-2
      10 months ago

      I agree with the Runtime being slower. These days Android doesn’t technically use the JVM anymore but the Android Runtime, ART for short, that actually performs ahead of time compilation to native code for the byte code for increased performance. Still, the Java Runtime it implements is very heavy and comes with it’s own overhead, so native Android code written in Java/Kotlin is generally slower than native iOS code written in Objective C/Swift.

      The kernel architecture does influence more than just the hardware it can run on though. Microkernels for example are generally more secure but slower than monolithic kernels

      • RiderExMachina@lemmy.ml
        link
        fedilink
        English
        arrow-up
        2
        ·
        10 months ago

        It’s possible to change anything, the main question is the cost of doing so.

        Google has already created something called Fuchsia which is reportedly very fast and potentially more secure than Android. But Google already has nearly 20 years of an existing ecosystem in Android that they would effectively be giving up because app manufacturers would have to make new apps for the new system.

        They’ve probably ran the numbers to see how much it would cost to perform the new roll-out vs how much income it would bring, and I would guess that making such a massive change just wouldn’t be worth it.

  • Atemu@lemmy.ml
    link
    fedilink
    English
    arrow-up
    6
    arrow-down
    1
    ·
    10 months ago

    This isn’t really fit for the Android community because “Android’s kernel” is the Linux kernel. Android is more about everything beyond the kernel; the userspace APIs and components that make an Android phone actually work. The kernel is rather unimportant here. Android uses Linux because it’s the most mature operating system out there.

    Monolith vs. microkernel has been a hot debate in operating systems ever since the concepts emerged.

    I personally really like the basic idea behind microkernels (separating mechanism and policy) but can also appreciate that, in reality, the best kernel in existence for general purpose computing is purposefully a monolith while the best a true microkernel (Minix) has achieved is to run CPU firmware.

    Do note, over the past decade or so, that Linux has sorta been stealthily laying out the basics to turn itself into something of a microkernel. See https://en.wikipedia.org/wiki/EBPF

    Android uses Linux’ eBPF for its firewall implementation for instance.

    I don’t have much experience with Apple’s XNU kernel but AFAIK it’s not a true microkernel but a lot more of a microkernel than Linux is.