I’ve seen people talking about it and experienced it myself with a server, but why does Linux run so well on ARM (especially compared to Windows)?

  • nyan@lemmy.cafe
    link
    fedilink
    English
    arrow-up
    47
    ·
    3 years ago

    Linux, and much of the open-source software that goes with it, has been multi-architecture for a long time. If you take something that already runs pretty decently on x86, x86_64, PA-RISC, Motorola 68000, PowerPC, MIPS, SPARC, and Intel Itanium CPUs, porting it to yet another architecture is, while not trivial, at least mostly a known problem.

    Windows, by contrast, was built for descendants of the Intel 8088, period. It’s unsurprising that porting it is a hard problem and that results aren’t always satisfactory.

    (Apple built on top of a modified BSD kernel, and BSD has also been ported around quite a bit, so they also have a ports-are-a-known-problem advantage.)

    • unfnknblvbl@beehaw.org
      link
      fedilink
      English
      arrow-up
      6
      ·
      3 years ago

      Windows, by contrast, was built for descendants of the Intel 8088, period.

      This is not quite true. Windows NT was built to support multiple architectures from the start.

      • apt_install_coffee@lemmy.ml
        link
        fedilink
        arrow-up
        18
        ·
        3 years ago

        NT is not the majority of windows code though; for windows to be multi architecture, all of windows needs to work with the new architecture; NT, drivers & userspace.

        For Linux, if an existing userspace application doesn’t work in aarch64, somebody somewhere will build a port. For windows, so much of their stuff is proprietary that Microsoft are the only ones able to build that port.

        Not because “windows bad”, just a consequence of such a locked down system which doesn’t have anything open source to inherit.

      • Billegh@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        3 years ago

        Yes, and DEC Alpha too. But all of that ceased with windows 2000. The only porting since then was from x86 32bit to 64bit. I’m willing to bet money I don’t have that Microsoft really only expected a port to 128bit x86 until ARM started gaining steam.

    • DigitalMuffin@sh.itjust.works
      link
      fedilink
      arrow-up
      3
      arrow-down
      1
      ·
      3 years ago

      No. Windows has portable architecture and it’s quite simple for Microsoft to compile it for whatever processor they want. Just change HAL and you’re ready to go.

    • kristoff@infosec.pub
      link
      fedilink
      English
      arrow-up
      2
      ·
      3 years ago

      Hi, Perhaps a stupid question, but what exactly is required to port an OS to a different architecture? OK, there is the boot-process, and low-level language compilers, … but what else?

      How much code has actually to be rewriten, and how much just needs “make” to be recompiled?

      Kr.

      • nyan@lemmy.cafe
        link
        fedilink
        English
        arrow-up
        3
        ·
        3 years ago

        Not my area, but since OSs are really low-level (obviously), they can be affected by details of the host architecture that we don’t often think about. Endianness, for instance.

        I opened up the source package for the kernel I’m currently running (6.1.42) and looked at it. The smallest set of architecture-specific code is the ~2MB for sh (I assume that’s SuperH, a 32-bit RISC architecture from the early 1990s). 32-bit ARM takes up 27MB, although if you check the individual files, a fair amount of that is device trees and the like. So we’re talking about less than 50MB of arch-specific source code for most platforms, and probably less than 10 in many cases, but it depends on the design of the architecture and how many times it’s been extended.

        Looking at individual file names, topics addressed in the kernel’s arch-specific code files appear to include booting, low-level memory access, how to idle the CPU, crypto primitives, interrupts, suspending/hibernating the system and other power management, virtualization facilities if the CPU provides them, crash dumps and stack traces, and, yes, endianness.

        You may also need additional drivers for odd bits of hardware not used by other systems. Or not, but it’s a common sticking point with ARM SOCs and other small-format machines.

        That’s just the kernel. You’ll also need to establish a working cross-compiler before you can get your kernel onto the system. At that point, you can probably bootstrap much of the rest by running make and get to a working command-line system (GUI is going to be more of a crapshoot, requiring additional work on video acceleration and such in order to run well). And there may be odd warts in other pieces of software, each requiring a few lines of code that add up over time.

  • h3ndrik@feddit.de
    link
    fedilink
    arrow-up
    39
    ·
    3 years ago

    I don’t think it’s just Linux. I’ve been told MacOS also works very well on ARM. Maybe it’s just Microsoft doing a bad job.

    • thelastknowngod@lemm.ee
      link
      fedilink
      arrow-up
      5
      ·
      3 years ago

      I have an M1 mbp for work and its honestly unbelievable. It’s one of the nicest machines I’ve owned in years. The chip is a huge part of it.

    • Semi-Hemi-Demigod@kbin.social
      link
      fedilink
      arrow-up
      5
      ·
      3 years ago

      Mac OS was running on RISC processors back in the 90s, and Steve Jobs used them in his NeXT computers which used a variation of BSD, which was the basis for OS X which could run on PowerPC.

      Apple’s had a ton of experience with RISC so it makes sense they’d do it well.

      • LeFantome@programming.dev
        link
        fedilink
        arrow-up
        5
        arrow-down
        1
        ·
        3 years ago

        NeXT computers were based on Motorola 680x0 processors that were actually CISC ( not RISC ). Steve Jobs did run MacOS on RISC in the 90s though as that is what PowerPC was.

        Modern Apple silicon is of course ARM64 so not the same architecture as PowerPC at all.

        • Bene7rddso@feddit.de
          link
          fedilink
          arrow-up
          1
          ·
          3 years ago

          NeXTStep ran on multiple architectures, some oft them RISC. They did some work on a PPC build too

      • .:\dGh/:.@lemmy.ml
        link
        fedilink
        arrow-up
        2
        ·
        3 years ago

        It’s mainly due to PA Semi acquisition. These guys were the ones responsible of making excellent PowerPC processors, which were similar to what ARM has now.

        These guys are probably happier now that they have more resources, target devices and tightly coupled software.

    • Xusontha@ls.buckodr.inkOP
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      3 years ago

      Well MacOS is because of a controlled ecosystem/hardware and a really good emulator, but IDK about Linux

      Also yes Windows on ARM is a steaming pile of garbage

      • h3ndrik@feddit.de
        link
        fedilink
        arrow-up
        2
        ·
        3 years ago

        Yeah. Linux is also optimized to run well. Has a capable community and a few good design choices. Many people use it to run it on servers so I wouldn’t be surprised if it performed well well on servers.

        Also there is a well known fork that is used on millions/billions(?) of ARM phones. So it’d better be a good choice for that use case.

      • Free Palestine 🇵🇸@sh.itjust.works
        link
        fedilink
        arrow-up
        2
        arrow-down
        1
        ·
        3 years ago

        Also yes Windows on ARM is a steaming pile of garbage

        Not just on ARM. Windows is and will always be a proprietary steaming pile of shit, no matter what architecture. That will be the case as long as Microsoft develops it.

  • rikonium@discuss.tchncs.de
    link
    fedilink
    arrow-up
    16
    ·
    3 years ago

    Windows’s achilles heel is arguably its chief benefit - legacy compatibility and being the de facto platform for applications.

    Back when I had a Surface RT, I thought it was awfully neat, ARM-compiled versions of Office, IE, Windows 8.x bits ran well and it was fanless with fine battery life. (although I surely sound weird, I had a Windows Phone back then too and the syncing with IE on both was a nice feature) It’s just they were pushing the Store then and if you jailbroke it, ARM applications were rare.

    Apple is a pro at architecture transitions and can steer the whole ship, MS can put Windows on ARM all they want but OEM’s will be reluctant since it’ll be a relatively big risk to sell a “Windows, buuut…” computer and the popular closed-source applications probably won’t bother with ARM for a while

    • LeFantome@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      3 years ago

      Apple can be much more heavy handed than Apple can. Apple controls their hardware ecosystem. They make everybody buy the architecture they want. They make the OS stop working on older hardware. They set minimum OS requirements for application writers. So, all the software ( from everybody - not just Apple ) gets moved to the new architecture quickly. It does not take long before being on the new architecture is all that makes sense.

      Windows on the other hand does not control the hardware. They are trying. They make their own now so they can at least seed the new ecosystem. However most Windows users buy their Windows hardware from somebody other than Microsoft. It makes sense for most hardware to target the larger application audience and that will be the old architecture. It makes sense for application devs to target the older architecture. For a long, long time, the older arch makes the most sense for almost everybody in the ecosystem. Only early adopters make the switch ( both users and application sellers ). In practice, that means that moving to the new arch means not having native apps in many cases which means the new arch will, in practice, be worse than the old one.

    • BCsven@lemmy.ca
      link
      fedilink
      arrow-up
      7
      ·
      3 years ago

      Raspberry pi works fine with linux, cutiePi also. my iomega nas is an arm board running debian…i don’t see the issue

        • BCsven@lemmy.ca
          link
          fedilink
          arrow-up
          4
          arrow-down
          1
          ·
          3 years ago

          The issue with Arm is they aren’t all one board/chip, you have ARM based design licenced from them and they are built to meet the criteria of what the customer requires. i.e. for my iomega NAS there isn’t firmware boot, you just have to generate an empty section of 00s on the first 32bytes of the drive so the board knows that is the drive to load the kernel from (no grub no uboot) and the board is set to do the rest from the next partition.

            • BCsven@lemmy.ca
              link
              fedilink
              arrow-up
              2
              ·
              3 years ago

              But all x86 instructions are the same right, thus why it doesnt matter what era your chip is from or what manufacturer, arm can be very different

            • Bene7rddso@feddit.de
              link
              fedilink
              arrow-up
              2
              ·
              3 years ago

              Booting isn’t the only problem with ARM. Instead of saving information about builtin devices on the board and exposing it via ACPI, board manufacturers create a devicetree and ship it with the kernel. This means that if you want to run your own kernel you need to build your own devicetree

      • pewpew@feddit.it
        link
        fedilink
        arrow-up
        2
        ·
        3 years ago

        Theese devices support linux out of the box. Try installing a proper linux distro on your phone and good luck finding a graphics driver that is not sotware rendering

        • BCsven@lemmy.ca
          link
          fedilink
          arrow-up
          1
          ·
          3 years ago

          As did microsofts arm device support windows, which is the point zi was replying to with skullgiver. of course windows works if the arm version was built for the hardware it runs on.

  • UFO@programming.dev
    link
    fedilink
    arrow-up
    12
    arrow-down
    2
    ·
    3 years ago

    Windows is LLP64 which is dumb while Linux is LP64.

    Ok. That only impacts C/C++ porting but still it’s a silly choice by windows.

    • jabjoe@feddit.uk
      link
      fedilink
      English
      arrow-up
      4
      ·
      3 years ago

      DeviceTree is a massive improvement compared to no discoverablity AND no DeviceTree. Each device was a custom kernel build, duplicate drivers and other code. It was madness. Linus lost his shit with the ARM kernel devs saying it has to be sorted. DeviceTree was the solution.

      In the end, ARM will have discoverablity. Buses like I2C and SPI will have some standard to discover what the hell is on them. But today it’s chaos and DeviceTree is the only source or order.

      • Bene7rddso@feddit.de
        link
        fedilink
        arrow-up
        1
        ·
        3 years ago

        You still need a way to know which memory addresses your I²C or SPI interface has. While DeviceTree is better than nothing, it’s way worse than the “It just works” of ACPI

        • jabjoe@feddit.uk
          link
          fedilink
          English
          arrow-up
          3
          ·
          3 years ago

          Completely agree that discoverablity is better. But that needs hardware. It’s crazy this isn’t solved. It means ARM devices are basically made to be e-waste. Make phones and other ARM devices like PCs. Google could mandate that hardware must be discoverable and be able to run a generic stock, to carry the Android brand.

    • jollyrogue@lemmy.ml
      link
      fedilink
      arrow-up
      2
      ·
      3 years ago

      Since the OP specified server hardware, probably not. RH said RHEL wasn’t going to support anything which didn’t use UEFI to boot, and Arm specified UEFI in their ServerReady hardware certification.

      • conciselyverbose@kbin.social
        link
        fedilink
        arrow-up
        12
        ·
        3 years ago

        Because it’s open source and most of the applications for it are open source. That means you can compile it and the applications specifically for the hardware you have.

        Windows does kind of support ARM on its specific hardware, but it can’t be adjusted for other hardware and they have to translate most applications to work. Apple has done much of that work for their hardware to work well, as well as very good translation for x86, and because they leaned hard into the transition, developers were mostly forced to compile for ARM going forward. Microsoft hasn’t done the same, and ARM is a tiny target, so it doesn’t happen with any regularity there.

      • bamboo@lemm.ee
        link
        fedilink
        arrow-up
        4
        ·
        3 years ago

        Because people have been doing so for a long time and have ironed out most of the quirks. The software is also generally quite simple, meaning there are just fewer quirks that need to be ironed out. And the ecosystem is largely open source, meaning everything can be recompiled to target the relevant architecture, so while translation layers are still useful, they’re not the essential tool they are in proprietary ecosystems. The main headaches that plague windows on arm mostly just don’t exist on the Linux side.

      • Free Palestine 🇵🇸@sh.itjust.works
        link
        fedilink
        arrow-up
        5
        arrow-down
        2
        ·
        3 years ago

        Because it’s not developed by some corporate fuckers whose only goal it is to make as much money as possible, it’s developed by individual skilled people in their free time, because they’re passionate. They don’t want to sell some garbage, they genuinely want to make a good operating system for themselves and everyone else to freely use without any restrictions. FOSS is not about the money, it’s about actually creating something good.

      • gens@programming.dev
        link
        fedilink
        arrow-up
        2
        ·
        3 years ago

        Because you can try compile it on arm, and if something doesn’t work you can report it or fix it yourself. That said windows worked fine on arm years ago. Many gps, medical, and such devices used to use windows ce on arm, mips. (Windows phone too, arm)

      • PuppyOSAndCoffee@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        3 years ago

        ARM the company as well as industry partners contribute code & resources to the linux kernel…so that would be one reason why linux on ARM runs well.

        Unsure how we are tracking Microsoft ARM as worse than Linux arm, what benchmarks did we see?

          • PuppyOSAndCoffee@lemmy.ml
            link
            fedilink
            arrow-up
            3
            ·
            3 years ago

            Honestly MSFT does a pretty good job at getting things to work and keeping them working.

            You can open a windows laptop and trust it will start. You can close it, and trust it will sleep. You can open it and … there it is, as it was!

            You even have sound and networking. And that widget some contractor built 20 years ago in vb.whatever? It still runs OOTB.

            Yes, they have some backwards shit because of this but for a lot of people, these ticks are the high watermark of computation.

            Not saying I agree it should be that way, or that any should be satisfied. Just be aware these are things that Microsoft excels at … and Linux is still getting there.

            But:

            VBA why are you still a thing? WHY? Why is MS Access still not treated as the virus that it really is?

            Why does InfoPath still exist?

            Many grievances.

  • Bob Smith@sopuli.xyz
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    3 years ago

    I’ve run Linux on a Rockchip Chromebook, several Pi boards, and an M1 Macbook Pro, all with good results. I think that it helps that Linux comes from a long lineage of highly portable operating systems. One of the early victories of Unix was its ease of portability to new types of processor, due (at least in part) to being programmed in C. The BSDs and Linux have always had developers who took joy in getting the operating system up and running on more than one type of architecture. Debian, for instance, has run on one sort of ARM chip or another since around 2000. Windows has a core business that thrives on X86-based chip designs and they have had very little pressure to branch out over the years. Computer companies build around their operating system, rather than the other way around.

    • DM294@lemm.ee
      link
      fedilink
      arrow-up
      0
      ·
      3 years ago

      Even I am interested in running linux in M1 macbook pro. Which distro have you used for that?

        • DM294@lemm.ee
          link
          fedilink
          arrow-up
          0
          ·
          3 years ago

          I have tried that but it has quite some missing thingsmaking it hard to use it as a daily driver. I may be wrong tho

          • colmear@discuss.tchncs.de
            link
            fedilink
            arrow-up
            1
            ·
            3 years ago

            Definitely. It is still in alpha, so nowhere near a stable release. I believe that in the next year or so most of the things will get ironed out

    • Xusontha@ls.buckodr.inkOP
      link
      fedilink
      arrow-up
      0
      ·
      3 years ago

      Just in general, Linux on ARM more often than not just… works. Compared to Windows on ARM, that’s an anomaly (yes I know part of the reason is Microsoft is just bad at making it, but there’s got to be more to the Linux side for it to be that good)

      • Muddybulldog@mylemmy.win
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        3 years ago

        A key factor is LINUX has been available for ARM since nearly “the beginning”. Unlike Windows, which was basically Intel only for well over a decade, LINUX has had strong support for multiple architectures throughout its lifecycle. As a result, software that grew up within that ecosystem tended to be more agnostic in design which helps porting efforts.