I'm using a quad-core ARM CPU and I'm wondering if it is possible to get 3 cores running in Linux, and one core running without Linux?

  • 2
    I'm a little unconvinced that this is a duplicate. This question has two parts 1) disabling Linux from using one core 2) using one core to do something non-linux related. The "duplicate" only addresses the first point. Yaya, if you feel the duplicate flag was inappropriate you maybe need to ask a new question and include some information on what you would like to do with the "non-linux" core. – Philip Couling Apr 8 at 10:29
  • You can use cpuset to limit the cores that your Linux-based system will use. I have no idea how you would go about scheduling something entirely different on the remaining core, though. – roaima Apr 8 at 21:34

You can't just take two operating systems and run one on one core and another on another core. (“No OS” is a special case where whatever code you run effectively includes its own OS merged into the application code.) It's possible to run multiple OSes that way, but they need to be aware of each other and to be written carefully to avoid treading on each other.

Even if you assign one OS to one core and one OS to another core, a computer is more than the processor. The operating systems will compete for memory and peripherals. It may be possible to tell the Linux kernel to keep entirely off one core (and I'm not sure if that's possible: it's not enough to tell it not to schedule any process there, which is easy, you also need to ensure that the kernel won't try to make that core receive any interrupt), but that's only the most obvious problem. If you want to use that core that Linux stays away from, you need to ensure that Linux won't power it down as part of its power management mechanism.

And then there's memory. It's easy to tell Linux to stay off some region of physical memory. But there's only one MMU for all the cores, and Linux needs it. To make Linux cohabit with another operating system, you'd need to make significant changes to its MMU management code so that it allows the other operating system to own part of the MMU data, and the two OSes need to agree on how they use the MMU. It's technically possible to have an OS run without the MMU, but at least with arm CPUs no MMU means not only no virtual memory (obviously) but also no cache, which is extremely slow.

And then there's peripherals. If you run multiple operating systems, practically speaking, each peripheral has to be owned by a single OS, and the other one must stay off. It may even be impossible for the two OSes to use the same bus conjointly, so all the peripherals on the same bus would have to be owned by the same OS.

If you want to run multiple operating systems, cores aren't how to split them. You need to virtualize all these shared resources — physical memory, virtual memory, peripherals, and you might as well virtualize the CPU itself. This is done with virtual machines: each operating system runs in one virtual machine, with access to a virtual CPU, a virtual MMU, virtual interrupts, etc., and there's one operating system that is the host of all these virtual machines and has access to the actual hardware. When the host is dedicates to running VMs and nothing else, it's called a hypervisor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.