Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
OS partially in RAM?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
mansniks
Apprentice
Apprentice


Joined: 19 Nov 2007
Posts: 290

PostPosted: Mon Aug 25, 2008 6:35 pm    Post subject: OS partially in RAM? Reply with quote

Is there some good way to put some most often used files in memory, so they don't need to be read from disk and it can be suspended (while OS is still functional)?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54313
Location: 56N 3W

PostPosted: Mon Aug 25, 2008 7:28 pm    Post subject: Reply with quote

mansniks,

Linux does this for you. When a file is read (any file) its buffered in RAM in case its needed again.
Eventually, when there is almost no RAM free, the kernel begins to reallocate memory. However before this happens, memory that has been allocated by rarely used processes (e.g. things needed only at startup and shut down) are moved to swap.

In short, you need do nothing special.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
mansniks
Apprentice
Apprentice


Joined: 19 Nov 2007
Posts: 290

PostPosted: Mon Aug 25, 2008 9:51 pm    Post subject: Reply with quote

Well, if that could be all, I'd be happy...
Complete, indeterminately long disk suspend is necessary in case when no non-OS files are accessed for some time.
I tried similar thing with my laptop and now plan building my very custom file server, that should be able to do that. The thing is: I couldn't make my laptop stop turning disk on time after time with gentoo... Even if in black console only.
Back to top
View user's profile Send private message
notHerbert
Advocate
Advocate


Joined: 11 Mar 2008
Posts: 2228
Location: 45N 73W

PostPosted: Mon Aug 25, 2008 11:10 pm    Post subject: Reply with quote

Check this out, maybe it can help......http://gentoo-wiki.com/FAQ_Linux_Memory_Management
Back to top
View user's profile Send private message
zixnub
n00b
n00b


Joined: 27 Dec 2007
Posts: 67
Location: Brasschaat, Belgium

PostPosted: Mon Aug 25, 2008 11:43 pm    Post subject: Reply with quote

NeddySeagoon wrote:
mansniks,

Linux does this for you. When a file is read (any file) its buffered in RAM in case its needed again.
Eventually, when there is almost no RAM free, the kernel begins to reallocate memory. However before this happens, memory that has been allocated by rarely used processes (e.g. things needed only at startup and shut down) are moved to swap.

In short, you need do nothing special.


Yes but isn't this only after data has been read for the first time? I believe there are daemons that preload often used program into ram, this makes the system start up slower but makes often used programs launch faster.
_________________
https://github.com/udevbe/greenfield
https://github.com/udevbe/westfield
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54313
Location: 56N 3W

PostPosted: Tue Aug 26, 2008 10:33 am    Post subject: Reply with quote

zixnub,

You can move things into tmpfs, which is in RAM to begin with. It may get moved to swap if RAM is needed, which defeats the use of tmpfs in the first place, since you will wait for your tmpfs to load at startup, then wait for things it contains to be loaded from swap.

You may make a permanent filesystem in RAM too. This is the same as making your RAM smaller as you now have two copies of things it contains. One in use, the other in the RAM filesystem. You get more swapping as a result, including RAM to RAM swapping, which is done by PIO, as the PC has no RAM to RAM DMA. This PIO flushes the CPU cache too, which is another bad thing.

The last think you can try to speed up load times is prelinking, which was new and broken when I played with it last several years ago. Things are still loaded into RAM on first use but some dynamic linker steps are removed, so its faster than normal dynamic link loading.

In short, memory management is a compromise. Speed ups in one area result in slowdowns and waste in another.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
notHerbert
Advocate
Advocate


Joined: 11 Mar 2008
Posts: 2228
Location: 45N 73W

PostPosted: Tue Aug 26, 2008 12:10 pm    Post subject: Reply with quote

Here's another cool idea if you have lots of ram https://forums.gentoo.org/viewtopic-t-296892-highlight-preload.html 8)
Back to top
View user's profile Send private message
mansniks
Apprentice
Apprentice


Joined: 19 Nov 2007
Posts: 290

PostPosted: Tue Aug 26, 2008 12:13 pm    Post subject: Reply with quote

>In short, memory management is a compromise. Speed ups in one area result in slowdowns and waste in another.

I hardly doubt it could be worse to copy things RAM>RAM than HDD>RAM.

So how could I keep kernel logs and binaries (/bin, /sbin, /usr/bin ...) in RAM? What is really done in distros like DSL and Alpine?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54313
Location: 56N 3W

PostPosted: Tue Aug 26, 2008 2:49 pm    Post subject: Reply with quote

mansniks,

Well, ram to ram copies tie up your CPU 100% and flush the CPU cache, so when the CPU goes back to doing something useful, everyting has to be fetched from your much lower (than CPU cache) main RAM.

HDD to RAM is slower overall but the CPU involvement is writing a few words to the DMA engine, then getting on with something else while it waits on the disk transfer to complete. The CPU cache is not poisoned either.

You are thinking single threaded operation. The kernel memory manager tries to provide the best service it can to all threads and resolve conflicts with minimum impact to all threads.

DSL and its like can run entirely from RAM as they are so small. Tin Hat Linux is a secure 4GB+ Gentoo based system that is entirely RAM based. Its intended for servers. The Gentoo Linux minimal CD can do this too. Its intended to allow the CDROM to be unmounted so the install can continue using other CDs.

You can move /var/log and and directory you like to tmpfs but its all gone if you lose power. That not good for logs.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
mansniks
Apprentice
Apprentice


Joined: 19 Nov 2007
Posts: 290

PostPosted: Tue Aug 26, 2008 5:07 pm    Post subject: Reply with quote

NeddySeagoon,
may I ask about TinHat: why it doesn't experience (I guess) difficulties with RAM>RAM? Some other, new technology you mentioned above?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54313
Location: 56N 3W

PostPosted: Tue Aug 26, 2008 5:20 pm    Post subject: Reply with quote

mansniks,

I don't know TIn Hat very well. You load a huge RAM image and of it goes.
I'm not sure if it even starts from a real everything on a filesystem and goes through an init process or not or if its a suspend to disk image that you load and resume. Here are the detials
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum