Jump to content
4 minutes ago, Defective_Soul said:

Is it possible to run lunux (let's assume arch with CLI only) w/o any actual ram, just by using swap only ? Ye it will be slow if it gonna works, but maby if use some sick ssd raid it will be preety fancy to see it working.

No.

Main: AMD Ryzen 7 5800X3D, Nvidia GTX 1080 Ti, 16 GB 4400 MHz DDR4 Linux - Fedora

Link to post
Share on other sites

You need ram to boot the system at all

i don’t think you can even get anything to load directly into swap, it has to go from drive to memory back to swapfike

I could use some help with this!

please, pm me if you would like to contribute to my gpu bios database (includes overclocking bios, stock bios, and upgrades to gpus via modding)

Bios database

My beautiful, but not that powerful, main PC:

prior build:

Spoiler

 

 

Link to post
Share on other sites

7 minutes ago, Defective_Soul said:

But if take in account that linux is opensource and i theoreeticaly can edit kernel and make it use spaw , is it possible ? Maby at least in theory ?

Still need mem to load the bios to even get close to booting kinux

I could use some help with this!

please, pm me if you would like to contribute to my gpu bios database (includes overclocking bios, stock bios, and upgrades to gpus via modding)

Bios database

My beautiful, but not that powerful, main PC:

prior build:

Spoiler

 

 

Link to post
Share on other sites

20 minutes ago, Defective_Soul said:

Is it possible to run lunux (let's assume arch with CLI only) w/o any actual ram, just by using swap only ? Ye it will be slow if it gonna works, but maby if use some sick ssd raid it will be preety fancy to see it working.

In theory you could boot a system without ram, but depends in stuff way "bellow" the OS.

 

You'd need to have a proper motherboard firmware that didn't care about RAM (ignoring it during POST), and initialized the CPU and configured the cache as a sort of ram (maybe as writeback?). You'd also need to configure your OS to work this way, and that's also cheating since you're using the cache as ram after all.

 

Linux itself may not be doable given the size of the kernel, you're better off building your own basic OS, getting a PC that's able to run coreboot and building your own mobo firmware to set those things up.

 

That's only taking x86 into consideration, there are many other systems (such as embedded ones) that don't have proper "ram", but use some other sort of memory to act as a place to read instructions from (usually microcontrollers, which are harvard-based computers).

 

However, since x86 have an specific address mapped when powering up, which points to the mobo's firmware, you could try just building your own OS there (given that you can fit it entirely in that space), since that happens even before the memory controller is initialized.

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to post
Share on other sites

4 hours ago, Defective_Soul said:

Because why not to try some ******** ? We now able to compile KDE for free bsd, now it sime for new sick challenge

Challenges are always fun, but i think this one might be a little crazy. Others have already mentioned the technical details

Link to post
Share on other sites

5 hours ago, Defective_Soul said:

But if take in account that linux is opensource and i theoreeticaly can edit kernel and make it use spaw , is it possible ? Maby at least in theory ?

No, mounting your drive as swap requires RAM. As @igormpmentioned you could technically avoid using RAM sticks by using the cache on the CPU but that's still sort-of RAM.

 

You can, however, get it to work with very little RAM and a bunch of swap space. I don't know why you'd want that but it's possible.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to post
Share on other sites

There's a good reason why PCs of old shipped with 640K of onboard RAM. At the most basic level the BIOS itself needs memory to function at all, no memory means no BIOS which means no PC.

 

Even to this day I'm pretty sure the first 640k of RAM (0x00000000 to 0x0000ffff iirc) is hardware reserved for BIOS operations

Main Rig:-

Ryzen 7 3800X | Asus ROG Strix X570-F Gaming | 16GB Team Group Dark Pro 3600Mhz | Corsair MP600 1TB PCIe Gen 4 | Sapphire 5700 XT Pulse | Corsair H115i Platinum | WD Black 1TB | WD Green 4TB | EVGA SuperNOVA G3 650W | Asus TUF GT501 | Samsung C27HG70 1440p 144hz HDR FreeSync 2 | Ubuntu 20.04.2 LTS |

 

Server:-

Intel NUC running Server 2019 + Synology DSM218+ with 2 x 4TB Toshiba NAS Ready HDDs (RAID0)

Link to post
Share on other sites

4 hours ago, Master Disaster said:

At the most basic level the BIOS itself needs memory to function at all, no memory means no BIOS which means no PC.

It technically doesn't! The reset vector in x86 points to the ROM in your bios, so you can execute instructions straight out of it (that's how some mobos throw memory problem messages), meaning that you could replaced that rom with your own code and do whatever you please without ram.

 

However, is it feasible? I don't know, and I'm surely as heck not the one who's going to try that lol

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to post
Share on other sites

11 hours ago, Defective_Soul said:

But if take in account that linux is opensource and i theoreeticaly can edit kernel and make it use spaw , is it possible ? Maby at least in theory ?

11 hours ago, Defective_Soul said:

Is it possible to run lunux (let's assume arch with CLI only) w/o any actual ram, just by using swap only

I think you're making a little misunderstanding in what SWAP is and how it works. Although the SWAP space is kind of a part of of your memory footprint in a way, it's not used directly.

 

Think of your RAM as your hands, SWAP as your pockets. Things in your hands are the things you're actually able to use and manipulate. If your hands start filling up, you might start putting things into your pocket and kind of swapping items between your hands and your pockets based on what you need to use at a given moment. The key thing here is that things in your pocket cannot be manipulated directly, they must be moved into your hands first. So it goes for SWAP; functions and data in SWAP must be paged in before they can be used.

 

To the specific formulation if your question, the answer is no. While RAM works just fine without SWAP and pants work just fine without pockets, the reverse is not true.

 

But the vibe of your question is more: "Could I just tell my OS to use these 8GB of my harddrive as if it's RAM?" There's a great German word "jein" which is the real answer here. It means both yes (ja) and no (nein) at once.

 

You could maybe write your own OS from scratch that for some reason does this SSD as RAM thing, but it would be really difficult and once you're done it wouldn't be Linux. It would be "Defective Soul's Weird New OS" and it would be unbearably slow.

 

If you want to do it with Linux, you need to write your own hypervisor which would pretend to your Linux distro that it has completely normal RAM available, when it reality it would only be reading/writing to some place on the hard drive. But even this might require some custom hardware, I am not sure if a normal motherboard/CPU would actually let you completely bypass RAM for a specific process. I suspect that even this option would require some custom hardware.

 

So, can you run a theoretical custom Linux distro which uses an SSD as RAM? Jein.

Link to post
Share on other sites

On 12/10/2021 at 3:07 AM, Defective_Soul said:

But if take in account that linux is opensource and i theoreeticaly can edit kernel and make it use spaw , is it possible ? Maby at least in theory ?

Yes it in principle possible but it would be not about "hacking Linux", but writing a new BIOS, likely changing CPU microcode.  The assembly everyone learns allows read to and from memory. Early BIOS however uses CPU cache (particularly at early stages when RAM is not yet available). The question is can disks be accessed at all in that state? So some sort of DMA that writes data to the CPU cache would be handy. This is not normally used, I am not sure if it exists. Assuming one can rewrite CPU microcode perhaps it can be enabled, but I have my doubts. 

 

In the end it may turn out that although memory controlled is in the CPU, the "wiring" doesn't allow this.

 

 

 

Link to post
Share on other sites

On 12/10/2021 at 2:59 AM, Defective_Soul said:

I (let's assume arch with CLI only)

As for the above, the CLI only doesn't really simplify much.  CLI-only by a serial port would already by a hardcore challenge 🙂 As for "arch" - distros in general don't matter much, especially in first few miliseconds of the OS boot sequence - this is where the answer to this question is decided. 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×