Why does Linux run so well on ARM - eviltoast

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)?

  • orangeboats@lemmy.world
    link
    fedilink
    arrow-up
    7
    ·
    1 year ago

    Rosetta certainly does emulate* x86. It can dynamically recompile x86 instructions to ARM instructions, otherwise applications that include an x86 JIT wouldn’t work at all on ARM Macs.

    * I know people will be pedantic about this… but other emulators (Dolphin, PCSX2 etc) have included a recompiler for ages and no one seemed to have a problem calling them emulators.

    • pivot_root@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      1 year ago

      As far as people hypothetically being pedantic about it being an emulator, it does meet the dictionary definition of “hardware or software that permits programs written for one computer to be run on another computer.” Personally, I don’t see as one, though. It’s more like WINE with a binary translator slapped onto it.

      Dynamic recompilation is a part of modern emulators, but it’s only a tiny piece. Software like Dolphin or Yuzu don’t just provide a way to run non-native instruction sets, but provide a full environment mimicking the guest hardware. Things like low-level emulation of hardware components, high-level emulation (shims) of guest operating system APIs, and a virtual memory space for the programs to operate in.

      The only significant thing Rosetta does is recompile the instructions of the guest program. All the APIs and abstractions the amd64-compiled program uses are available natively. If I recall correctly there are shims for bridging between the calling convention of the host and the recompiled-amd64 functions, but they don’t do much more work than that.

      Another one of my reasons for not considering it to be an emulator is because it primarily goes for ahead-of-time cached recompilation. It definitely does JIT translation as you mentioned, but as a way to support amd64 JIT-generated code. In contrast, Dolphin and other emulators* rely on cached JIT recompiling or interpreting for everything related to executing the guest instructions.

      * Notable exceptions are Cxbx (Xbox -> Windows) and vita2hos (PS Vita -> Switch), which are emulators for platforms with compatible instructions sets. They work like WINE instead of JIT-recompiling or interpreting code, which is pretty cool.