Honestly, Linux distros ( CatchyOS in my case) are getting so good at managing ram that now i’m just curious to know if i could use that extra free ram to remove some work load from my old pc cpu.

  • thomas308@lemmy.zip
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 days ago

    urgs, it’s not how it works you know, they serve different purpose.

    CPU in for processing, and RAM is for storing. And Ram is at the receiving end of the chain as well, so unless you ram is consistently full, don’t think abt it.

  • Fierro@piefed.social
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 days ago

    IIRC, when I started to use w10 I was surprised about the ram usage, and learned that windows tried to protectively use up free ram to hold stuff you might need, which is essentially what you’re asking for.

    I did ask myself if there was a way to implement that on linux, but never really cared enough to look it up, if you find something do share.

  • highball@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    7 days ago

    You could set your swappiness to something very low like 10 so the kernel is waiting as long as possible before moving the data to swap. This way, you CPU is bottle-necked less by your HDD or SSD. Or, you could setup ZRAM, then set your swappiness to something crazy large like 180. This way your kernel will swap unused data in ram to a compressed space in ram early, like before your CPU hits a heavy load, causing a bottle-neck. With ZRAM, depending on the compression algorithm you choose, you could essentially triple your ram. As long as your ZRAM ram more than enough ram for everything you do, you could probably disable any disc or file swap you have and reclaim the space. If the ZRAM ram is not enough, then you might try ZSWAP. The ultimate goal is to keep as much of your RAM full without ever having to go to disc which is what would slow down your CPU.

    • TootSweet@lemmy.world
      link
      fedilink
      English
      arrow-up
      12
      arrow-down
      1
      ·
      11 days ago

      If I was less lazy, I’d make one of those “I consent, I consent, isn’t there someone you forgot to ask” memes with a guy putting a stick of RAM into their computer and the guy and the computer both say “I consent” and Sam Altman in the background says “I don’t”.

  • Ignotum@lemmy.world
    link
    fedilink
    English
    arrow-up
    19
    arrow-down
    1
    ·
    12 days ago

    In what way were you thinking? RAM can’t execute instructions and stuff like that, you can use spare RAM capacity to cache files and stuff so the cpu doesn’t have to wait for it to be read from disk, but linux already does that, what else is there?

    • abbadon420@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      15
      ·
      11 days ago

      You could rent it out to Sam Altman, inflate the market value of RAM, revalue your company according to the new prices, sleep with a chinese spy, tank your stock prices, get the company “under water” and cause the ai bubble to burst. In that order.

  • artyom@piefed.social
    link
    fedilink
    English
    arrow-up
    12
    arrow-down
    1
    ·
    11 days ago

    CatchyOS

    It’s really weird that so many people are hallucinating a t in this name. It’s Cachy. Like cache.

  • frongt@lemmy.zip
    link
    fedilink
    English
    arrow-up
    9
    arrow-down
    1
    ·
    12 days ago

    Yes. Merely by having it free, that means more data can be cached in ram and not have to be loaded from elsewhere, which takes (a very small amount of) CPU time.

  • ilinamorato@lemmy.world
    link
    fedilink
    English
    arrow-up
    7
    ·
    12 days ago

    Think of it like this: you’re a student in a high school trigonometry class, and you’re taking a test. You have a scratch pad for jotting stuff down temporarily while you work, you have a test sheet to put your answers on, and you have a calculator for doing sines, cosines, and tangents. Could you use the scratch pad to lessen the workload for the calculator?

    To some extent, yes; you can break down the calculations into smaller workloads and write them down on your scratch pad, then type them into the calculator one-by-one and put them back together at the end. You could also maybe remember the answer to a problem you’ve already solved earlier and write it down here. But no matter how big and nice your scratch pad is, no matter how well you write the problems down on it, the scratch pad will never solve those problems for you.

    In computing, the test-taker is the operating system, the screen is the test paper, the calculator is the CPU, and the scratch pad is the RAM. So you could break down the calculations into smaller workloads and put them into RAM, then run them piece-by-piece and put them back together at the end; but every OS already does that. You could remember the answer to previous calculations and output it from RAM; but that’s called caching, which is something else that every OS already does (and something that CachyOS in particular focuses on).

    These are on by default already; the only way you can really help it is by minimizing open applications, which increases the amount of RAM that the CPU has available to write to.

    But, no matter how much RAM you have, no matter how well you write the workload to it, the RAM is just a scratch pad. It can’t process anything for you.

    • neatchee@piefed.social
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 days ago

      I’ve always preferred the analogy where the disk is a file cabinet, the RAM is your desk, and you are the CPU.

      • ilinamorato@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        2 days ago

        It’s a good one, but “can you use the desk to reduce the workload on your brain?” is a bit harder to conceptualize. Because you know that functionally, your brain does all of those jobs, so you can use both of those other things to reduce some kind of load on your brain.

        The calculator, by contrast, doesn’t visibly do the job of RAM or disk (and doesn’t do much of it behind the scenes at all). The link is clearer.

        ETA: also, as an aside, in my entire career I’ve never used a file cabinet at any desk I’ve ever had for its intended purpose. Mostly I’d just put my lunch or tchotchkes in it. I honestly don’t think I’ve even had a desk with filing cabinets at all in…a decade or more? There were some elsewhere on my floor, I think, but they weren’t something I regularly interacted with. I went remote after the pandemic and have stayed that way, so maybe they’ve had a resurgence, but I’d find that surprising.

        • neatchee@piefed.social
          link
          fedilink
          English
          arrow-up
          1
          ·
          2 days ago

          Haha I was thinking of the tall file cabinets you have multiple of in a lawyers office or doctor’s office.

          I think the analogy is great actually: the CPU does have very small amounts of operating memory, but to actually work with any meaningful amount of information you need retrieve it from the file cabinet (disk) to lay it out on the desk (RAM) and process what’s there using the logical operations that you know (CPU).

          I guess it’s less “your brain” and more “the operational capacity of a person”.

          It’s not a perfect analogy, for sure, but I think people intuitively understand the idea of “store stuff long term, bring it out into an operational space, then a smart thing does stuff in that workspace”

          • ilinamorato@lemmy.world
            link
            fedilink
            English
            arrow-up
            1
            ·
            2 days ago

            True, from a technical level. But for someone asking a question with this little apparent understanding, I didn’t think that getting into L2 caches and hit rates was really going to help the conversation much. It’s a good analogy, but I guess I just didn’t think it fit most closely in this case.

  • palordrolap@fedia.io
    link
    fedilink
    arrow-up
    3
    ·
    11 days ago

    Pre-calculation or calculation caching is about the best save you’re going to get, but each and every piece of software would need to be rewritten with that idea in mind - assuming it wasn’t already written that way in the first place - rather than it being something the system can impose.

    It’s plausible that someone could write or modify an OS that specifies to each program what they’re supposed to do, be that optimise for time, optimise for CPU, optimise for RAM, etc. etc., but the program itself still needs to provide the ability to do each and every one of those, which is time and effort that program writers may not be willing to put in.

    For a more concrete example, although still something of a toy, there’s a program in the bsdgames package called primes that’s ~80k in size.

    Clearly, at that size, it does not contain all prime numbers but it sure can generate more than 80k of them quickly. It is highly optimised code, if my efforts at beating it are anything to go by.

    If you, as a hypothetical prime number aficionado, wanted even less work on your CPU, you could store your database of prime numbers in RAM (or disk) and not generate them over and over with primes. primes does not do this. It is not written to do this. It could be, but then it would be a larger program to account for extra modes of operation, which is more work for the maintainers.

  • Guiorgy@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    10 days ago

    As others noted, the only way to improve CPU performance is either by making the CPU/RAM actually faster (higher clock speed, better/newer CPU, faster RAM so the CPU wastes less time waiting for the data read) or by wasting less of the CPU resources on useless/needless work. Caching helps in the later case, like waiting less time for reads that are cached in memory, or avoiding recomputing something you already computed before. However, Linux already has the page cache that uses free RAM to cache disk reads, and using more memory to cache computation results is a compromise that has to be decided by the software developers before it’s even shipped to you, so not much you can do there.

  • JTskulk@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    10 days ago

    If you have spare ram, consider setting up and using a ramdisk. A ramdisk is just what it sounds like: a filesystem made of ram. You can store anything on it whether it be something small and temporary or large and less temporary. You can also use it to enhance the startup of things, but ssds are so fast these days anyway :)