this post was submitted on 15 Jun 2023
99 points (100.0% liked)
Games
16690 readers
993 users here now
Video game news oriented community. No NanoUFO is not a bot :)
Posts.
- News oriented content (general reviews, previews or retrospectives allowed).
- Broad discussion posts (preferably not only about a specific game).
- No humor/memes etc..
- No affiliate links
- No advertising.
- No clickbait, editorialized, sensational titles. State the game in question in the title. No all caps.
- No self promotion.
- No duplicate posts, newer post will be deleted unless there is more discussion in one of the posts.
- No politics.
Comments.
- No personal attacks.
- Obey instance rules.
- No low effort comments(one or two words, emoji etc..)
- Please use spoiler tags for spoilers.
My goal is just to have a community where people can go and see what new game news is out for the day and comment on it.
Other communities:
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Not really, you can get all the same benefits with adding extra memory without having to deal with setting up and managing a massive RAM drive.
When a program or the OS itself needs to read data from the disk, it does a disk read operation. Before reading the data directly from the disk, the OS checks if the requested data is already present in its cache. If the data is found in the cache (a cache hit), the OS can retrieve it quickly from the RAM, avoiding the slower disk access. If the data is not present in the cache (a cache miss), the OS reads it from the disk and also stores a copy in the cache for future use. If the cache is already full, the OS needs to make space for newly read data. There are various strategies for what data to evict, but something will be bumped out of the disk cache, it’s fast, but not free. The data stays in disk cache until it gets evicted to make space for something else. If you have enough memory, nothing needs to be evicted so even if the game unloads assets, the files on disk are still cached and can be accessed without loading from the physical disk.
So point being, if you have enough memory, after the data is read once, it’s going to stick around in memory and be access just as fast, and maybe a little faster than a RAM drive. Why maybe a little faster? A RAM disk is effectively double caching the data, once in the RAM disk and once in the disk cache so you need twice as much memory to not have cache misses. Imagine a game that has 10 GB of data on disk, lets ignore the memory it takes to run the game, os, etc, just think about that 10 GB of game data, disk cache, and RAM drive.
Say you have 16 GB of memory. 10 GB of that will need to be made into a RAM drive, so we have 6 GB left for disk cache. When you’re playing the game, it’s going to try and access that 10 GB of game data, it’s first going to look in the disk cache. The cache is only 6 GB, so the game can’t fit entirely, sometimes the data will be cached, sometimes it’s not. When it’s not, it’s going to go through a few extra steps to remove something and fetch the requested data from the RAM drive. The data eventually gets loaded from RAM, but with a few extra steps. Now without the RAM drive, there would be 16 GB of disk cache, the game will fit entirely. Once it’s all loaded, no more disk access, it’s all in memory.
If I recall correctly, the current Linux RAM disk implementation uses the paging/caching backend anyway. Just doesn't let it be purged from memory.
Yeah. I use Tempfs for compiling because it gives me a lot more IO.
It'd take some pretty simple scripting to create a tempfs and copy game files into it prior to launching the game. You'd have to dig a bit into each game to ensure that you're not loading any directories or files that store permanent data but it wouldn't be too hard.
Good to know.