If I set the value of swappiness to 100 and try to boot ubuntu installed harddrive in my friend's computer that does not have RAM, can I boot the computer without Ram at all?


2 Answers 2


No. The CPU can't execute code from the swap. Swapping works by moving RAM contents to the disk and other disk contents to RAM, but execution is always from RAM.

And no, there is no way to transfer code or data from the disk directly to the CPU caches. You can't bypass the RAM.

Even microcontroller architectures that can execute code directly from NOR flash need RAM for the stack, at least some built-in SRAM as some controllers have.

  • 1
    @LưuVĩnhPhúc You are right. I'm still used to calling those SoCs with ARM Cortex-A cores "microcontrollers", although this may be misleading. Those have an MMU, can run Linux and typically also have that internal SRAM (needed for the boot code), but I don't think those can execute code directly from flash. Well, the OP seems to think of an ordinary PC anyhow.
    – Philippos
    Jun 23, 2017 at 7:56
  • 1
    I think S390 Linux can execute code directly from HDD. The feature was added because the S390 is a 31 bit architecture, and making every byte available for data instead of code is a win. I could be misremembering, though, but the patch set was memorable, because it had the unique distinction of being valuable for both mainframes and microcontrollers (i.e. the two extreme ends of Linux scaling) but of no interest to anything in between. Jun 23, 2017 at 8:40
  • 2
    Ah, found it, it is the XIP feature (eXecute In Place). Obviously, you still need RAM for data. It is only about code. Jun 23, 2017 at 8:44
  • 1
    @rackandboneman As an embedded developer, I did everything from naked assembler on 8 bit controllers over RTOS to embedded Linux. The least memory I met was an ATtiny with memory for a three return address stack. Without that, you couldn't even have interrupts! Now please don't argue whether this stack memory is ram or registers ... (-:
    – Philippos
    Jun 23, 2017 at 19:23
  • 1
    @Philippos why would I argue - WE are talking the same thing. Jun 23, 2017 at 20:40

https://electronics.stackexchange.com/a/311839/111920 contains the link http://www.drdobbs.com/parallel/booting-an-intel-architecture-system-par/232300699?pgno=2 which describes the boot process of a modern Intel CPU in excruciating detail.

TL;DR: No. There indeed is a phase during boot where the RAM chips are not used, and the processor is running with only its internal cache functioning as makeshift RAM. But this is very early in the BIOS load process and one of the first things the BIOS does is initialize the RAM, to be able to use it. The machine code running there is very specialized, very hand-crafted.

After that very early stage, RAM is needed for everything. This means that you won't even be able to go into BIOS, get a video signal, or much less boot from any medium, without RAM.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .