Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986
Rep:
What is the purpose of a Ramdisk.
Why is Ram treated like a hard drive? Most data must be in RAM so why would the RAM need a file system when the data was put in by what ever is controlling RAM anyways. Is this some sort of a short cut to just import a file along with it's file system so the same file can be used for two different things?
A "RAM Disk" is used in place of a standard disk drive because it is many times faster, and data held in RAM is not retained after a reboot. This makes RAM drives perfect for things like /tmp, where you want fast access but don't necessarily want to keep the data around.
It has nothing to do with data actually going into and out of RAM and the CPU, that is a much lower-level concept.
When you boot up, the initd file is loaded to into a cache file system in ram. The partitions aren't mounted yet, so the entire Linux filesystem exists in RAM.
The eeePC uses a unionfs which layers a cache ram file system on top of the file system on the SSD. This reduces the number of writes to the SSD drive, extending its life.
Without a cache layer, calls to write to a device would hang until the device signalled success. For some programs, this may be for each byte of data.
A pen drive or SD card operates on a section of data at once. First the entire section is read, then changes are made, then the section is written back. It is desirable to cache changes so the section can be modified in one operation.
A cache allows speed increases transparently, without coding writes to ram.
A program that explicitly uses a ram disk may be doing so to allow rapid modifications to the data, and may also be using the memory as a form of communication with a subprocess or another program. Access control would use file permissions. Imagine a program that uses plugins. You don't know what the plugin might be when writing the program. You write your data to file and leave it up to the plugin to read the data and do what it needs to do.
Back in the 80's I used an Amiga. It was standard practice to use the RAM disk in scripts. The first Amigas used floppies, so you can imagine the speedup obtained writing to a ramdisk instead of the floppy.
RAMDISK is used to guarantee the filesystem is always in RAM (once loaded). It is not subject to page-out or page stealing.
Consequently of course it also reduces the amount of RAM available to the rest of the system.
Data in ram is not useable by programs that didn't put it there. There is no way to place and retrive data there easily. Ram is ram, but ram is not a hard drive.
A ram disk is a hard drive to the OS but since it is basically the original ssd one can expect way faster access to data. Every program knows how to access and use a hard drive.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.