LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 11-04-2010, 05:05 PM   #1
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986

Rep: Reputation: 53
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?

Thanks in advance!
 
Old 11-04-2010, 05:07 PM   #2
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
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.
 
1 members found this post helpful.
Old 11-04-2010, 05:35 PM   #3
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986

Original Poster
Rep: Reputation: 53
So.... RAM is RAM.

Either way the data would be in RAM so why the purpose of a RAMdisk? The CPU never gets data directly from the hard drive does it?
 
Old 11-04-2010, 06:46 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.
 
1 members found this post helpful.
Old 11-04-2010, 07:30 PM   #5
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986

Original Poster
Rep: Reputation: 53
Thanks for the Reply!

I can't use it though unless it is paraphrased.
 
Old 11-04-2010, 07:59 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,137

Rep: Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122
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.
 
1 members found this post helpful.
Old 11-04-2010, 08:18 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,996

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
In VERY simple terms.

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.

Last edited by jefro; 11-04-2010 at 08:21 PM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RAMDISK: couldn't find valid ramdisk image starting at 0. iotc247 Slackware 10 12-10-2010 03:08 PM
what is the purpose pradeepjeevan Linux - Newbie 7 02-10-2010 05:18 PM
Purpose? kienjakenobi LinuxQuestions.org Member Intro 3 03-18-2008 05:49 PM
Purpose of IDE JMJ_coder Programming 8 03-12-2007 03:10 PM
creating a ramdisk runtime from another ramdisk code123 Linux From Scratch 0 10-11-2004 08:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration