RAM disk

from Wikipedia, the free encyclopedia

A RAM disk , also RAM drive (Germanized roughly RAM drive ) or English memory disk , is a virtual and temporary data carrier in the main memory (RAM) of a computer . It is mainly used in live systems , e.g. B. while a computer is being restarted, or when other physical storage media are too slow for a particular purpose.

When it is created, a defined part of the main memory is mostly statically reserved for the RAM disk (“branched”) and addressed like a hard disk or generally like an extra drive , formatted with a file system and finally attached .

A RAM disk is generated and managed in software - the implementation therefore depends to a large extent on this software . B. the firmware of the computer such as UEFI , the operating system itself and device drivers or third-party programs .

technology

Random access memory , English random-access memory or short- RAM is a computer normally mainly as physical memory used. In some systems that are designed for little memory but have built in far more RAM than necessary, the RAM disk was developed as a virtual drive in the 1980s in order to be able to use this otherwise unused and usually relatively fast memory as additional data storage . A device driver accesses the access routines in the operating system and creates an access path that enables access to the part reserved in the main memory for the RAM disk and makes this memory area accessible in the operating system like another regular drive. The size of the RAM disk had to be fixed at the start of the initialization; RAM disks with variable storage capacities were only developed later .

In some variants, the content of the RAM disk is fully integrated into the virtual memory management of the operating system and can therefore also be swapped out. This happens automatically when the operating memory is required by the operating system for other programs. However, this type of RAM disk contradicts the concept of keeping the data in memory at all times.

Older and simpler RAM disks only create the virtual drive; in order to be able to use this, it must first be formatted , whereby one of the file systems supported by the operating system must be used. Modern programs and drivers for creating a RAM disk usually do this automatically when it is created, but with older and simpler implementations this step has to be done manually by the user.

Better RAM disk programs can also save the contents of the virtual drive to a file on the hard drive before releasing the integration ( e.g. when shutting down , or when safely removing or ejecting the virtual disk) and when creating the RAM again. Recover disc automatically.

use

RAM disks are primarily used in live media . It is often from a storage medium starts , which can only be read ( z. B. from CD-ROM ). However, modern operating systems require an area in which temporary files can be stored - this is provided by the RAM disk in a live operating system.

Live systems that use a RAM disk, are u. a. most Linux distributions and Windows PE from Microsoft . Many modern operating systems use a RAM disk when installing the operating system .

Common operating systems also provide drivers for creating a RAM disk. For common operating systems such as DOS , Mac OS ( Classic and macOS ) or Windows , there were or are numerous third-party software offerings that provide a RAM disk and add useful functions, thereby setting themselves apart from the functions integrated in the operating system. For example, the contents of the RAM disk can be saved to a hard disk during shutdown or every minute, and flexible RAM disk sizes ( storage capacity ) can often be set.

distribution

In PC DOS 3.0 from 1984 the device driver from IBM called VDISK.SYS(for Virtual Disk ) was included for the first time , which could provide a RAM disk under PC-compatible DOS . The source code was also VDISK.ASMincluded in PC DOS 3.3 . Microsoft also integrated a RAM disk into MS-DOS 3.2 in 1986 RAMDRIVE.SYS. Also Digital Research provided in DR-DOS 3.31 from 1988 its own version of VDISK.SYSwith. In the Caldera DR-DOS 7.03 user manual , the RAM disk is referred to as the English memory disk .

The operating system of the Amiga from Commodore was with Workbench 1.2 in September 1986, a RAM disk (as English recoverable RAM disc inserted). From version 1.3 from 1988 onwards there are two different RAM disks in AmigaOS : One uses an amount of main memory to be determined at start, while the other dynamically requests or releases main memory and thus adapts to the memory requirements. The former has the advantage that its content survives a computer restart ( warm start ) as long as the memory area has not been overwritten by an uncontrolled crashing computer program.

Under Unix operating systems , the RAM disk can be through the directory /dev/shm( shm for English shared memory , shared memory) to use. Under Linux , the tmpfs file system is used for this , which automatically creates a RAM disk - in addition /dev/shmto other directories, including /dev( devtmpfs) and /run.

Under classic Mac OS on Macintosh Computer? By Apple it was from System 7 available from 1991 to activate a RAM disk. The operating system automatically formats them with a file system ( HFS ) and saves the content during a regular shutdown so that the data can be restored at the next start. The RAM disk can be set up in the "Memory" control panel.

The UEFI RAM Disk Protocol was defined in the UEFI specification version 2.6 from 2016 . In this way, a RAM disk can be created before the operating system starts, which can be used by a compatible operating system or by the firmware itself. Among other things, this accelerates firmware development because developments and configurations can be tested independently of other data carriers. UEFI, which exists on the architectures Itanium , x86 , x64 (64-bit x86), and ARM64, has been the successor to the BIOS on IBM-compatible PCs since around 2010 .

Similar concepts

Starting an operating system

Some operating systems start from an initial RAM disk that is removed after startup. In Linux this is e.g. B. by initrd or the more modern initramfs with most Linux distributions the case, the Linux - kernel itself can however also boot without this initial RAM disk.

Overlay with a read-only file system

If a file system on a write-protected medium or a file system that is intentionally used as write-protected is to be used under a modern operating system, read and write access can be made possible by means of overlaying a RAM disk. Only the modified data blocks are saved to the RAM disk using copy-on-write (COW) so that the file system appears as a whole as writable. However, all changes have disappeared after a restart. This is often used in live systems .

Alternatively, a writable data memory ( e.g. hard disk or SSD) or one of the partitions on it can be used as COW memory , whereby the changes are retained for the time being. As a result, on the one hand, several different COW states can be derived from the original state, the write-protected file system, and on the other hand, the original state can also be restored very easily by resetting the COW data carrier.

I / O cache

Since main memory is too expensive and too fast to leave it idle, modern operating systems use an input / output cache, or I / O cache for short, every free block in the RAM (main memory) for temporary storage (buffering) of Reads and writes. As a result, the RAM fills steadily with every read process. If a process needs access to a file again and the data is already in the cache, the operating system saves itself having to read again from the slower storage medium ( e.g. a hard drive), since the data is already in and over fast RAM the I / O cache are immediately available.

However, if another process requires working memory and none is free, parts of the I / O cache are discarded according to a certain logic. A simple logic is the FIFO strategy in which the oldest buffered data is discarded. See cache eviction strategies .

Advantages and disadvantages

The use of a RAM disk is often a matter of taste. Many programs advertise with faster start times for programs and data stored on them (or even installed). However, it should always be noted that there are not only advantages associated with the use of a RAM disk.

Nowadays, modern operating systems usually include cache management in which the operating system independently uses the currently free memory to temporarily store data. Data or programs that are read from hard drives are also stored in this dynamic cache. In the event of a new read access, the system can then read the data directly from the RAM instead of from the external data carrier. Since this cache is managed by the system itself (the system knows what is read particularly frequently), a cache can nowadays be superior to a RAM disk in many situations.

advantages

In contrast to the direct access to the main memory by a computer program , the programmer can use a RAM disk to access the file management- related services of the operating system. The advantage for the user is that a RAM disk enables computer programs to work with data both on data carriers and in the main memory without changes. The advantage of a RAM disk compared to a hard disk is the saving of hard disk access and the associated significantly higher read / write and access speed, which also explains the use in supercomputers and the reduction in wear and tear . For example, the starting procedure frequently used a computer commands stored in memory to ensure that the time it takes to start is reduced. Since less energy is required to access the main memory , the energy-saving effect and the associated extended battery life are also advantageous for mobile computers . Similar to the example given for the start-up process, frequently used files in the main memory are accessed if configured accordingly, which means that the internal hard drive can be put into energy-saving mode more often or for longer - which again increases the battery life.

For write-intensive applications which, however, discard the written files immediately after their use, a RAM disk can have the advantage that it is not written more frequently than absolutely necessary to a medium with limited write access (such as flash memory ). However, the prerequisite is that sufficient memory is available. An example of this is the use of tmpfsfor portagefrom Gentoo Linux - with this Linux distribution , the programs are not installed as binary packages, but the source code of the respective software is compiled on the computer itself . This process is computationally intensive , but it enables optimization for the respective system as well as the selection and control by the user as to which functions should actually be included in the program. If the process of compiling and linking takes place in RAM, on the one hand it is faster, on the other hand the many temporarily created files are not written to the SSD and thus extend the life of this flash-based storage medium.

disadvantage

The disadvantage of the RAM disk is that the memory space in question is no longer available to the free main memory, i.e. the operating system and other programs for intermediate storage. After restarting the system (e.g. after a crash ), the contents of the RAM disk have generally disappeared. Since main memory is a volatile storage medium , if the power supply is interrupted (e.g. when switching off) the RAM disk content disappears along with the main memory. Therefore, no important data should be stored on the RAM disk unless the uninterruptible power supply of the computer is guaranteed. Any files that may still be required should also be backed up before switching off the computer (e.g. automatically using a script). Measured by the price per storage size, this type is one of the more expensive storage methods.

Demarcation

Some other technologies, which also use RAM as the basis for data storage, have nothing to do with the concept of a RAM disk, despite the similar-sounding name. Similar concepts such as overlaid file systems and the I / O cache do not count towards the term RAM disk.

RAM floppy

RAM floppies are a hardware replacement for a floppy disk drive ( English Floppy Disk Drive , FDD for short), intended for older computer systems. RAM floppies are not tied to the connections for regular drives . B. also be designed as a plug-in card . Even if a part of the main memory is not only branched off by software , but additional hardware is used, such a drive is an ordinary RAM disk.

Remarks

  1. See also solid-state drives in comparison

Individual evidence

  1. IBM DISK OPERATING SYSTEM (DOS) VERSION 3.30. Announcement Letter Number 287-098 dated April 2, 1987. IBM , April 2, 1987, accessed July 29, 2018 : “DOS 3.30 TECHNICAL REFERENCE; … VDISK.ASM is a file containing the Assembler Language source code for Virtual Disk (RAM memory disk) device driver (VDISK.SYS). The assembled object code for VDISK.SYS and instructions for its use are included in the DOS 3.30 package. The VDISK.ASM file is provided on the DOS 3.30 Technical Reference utilities diskette for programmers who want to use it as a model for creating device drivers. "
  2. ^ Matthias Paul: Re: [fd-dev] How to detect a RAM drive (Was: Games + Freedos) (Frontier Elite II). ( Mailing list ) In: freedos-dev. February 19, 2002, accessed July 29, 2018 .
  3. Chapter 4 - Working with Caldera DR-DOS. In: Caldera DR-DOS Quick Start Guide. Caldera, Inc., 1998, accessed July 29, 2018 (English): "[This ...] type of disk, a memory disk, is not a physical disk but part of your computer's memory that the operating system treats as a disk. This is why a memory disk is also referred to as a virtual disk. … A memory disk only stores data temporarily. When you switch off your computer, or reboot, any data stored in a memory disk is lost. "
  4. Workbench 1.2. In: The Amiga Museum. Retrieved on July 19, 2019 (English): "Workbench 1.2 was the first version of Workbench to feature the use of a RAM disk as standard."
  5. Chris Cebelenski: Amiga 1.3. ( Blog ) In: Retrocomputing. April 21, 2010, accessed July 29, 2018 .
  6. Amiga Enhancer V1.3 is a disk-based update. Commodore Amiga, Inc., 1988, accessed on July 29, 2018 (English): "Recoverable RAM Disk: Keeps its contents until the Amiga is turned off"
  7. ^ Adrian Kingsley-Hughes: UEFI Forum announces updated UEFI v2.6 and ACPI v6.1 specifications. The latest updates to UEFI and ACPI help allow PCs to offer enhanced mobility and manageability for customer and enterprise levels. In: Blog “Hardware 2.0”. ZDNet , March 9, 2016, accessed on July 28, 2018 (English): "Added to UEFI Specification v2.6 are ... Formal API definition for RAM Disk Protocol."
  8. MdePkg: Add EFI RAM Disk Protocol definitions. In: tianocore / edk2. GitHub , February 3, 2016, accessed July 28, 2018 .
  9. Dong Wei, Ting Ye: Accelerating Firmware Development With UEFI Advanced Features. (PDF; 2.6 MB) In: IDF 16 presentation. Intel , 2016, p. 17 , accessed on July 28, 2018 .
  10. Christof Windeck: Farewell to the PC BIOS. In: Heise online . June 3, 2011 . Retrieved July 28, 2018.
  11. Christof Windeck: Intel: UEFI-BIOS will lose BIOS compatibility in 2020. In: Heise online . 15th November 2017 . Retrieved July 28, 2018.
  12. Blog vom Karpfenweg: RAM-Disk / RAM-Drive - What it brings and to whom it is useful ( Memento of the original from October 18, 2008 in the Internet Archive ) Info: The archive link was automatically inserted and not yet checked. Please check the original and archive link according to the instructions and then remove this notice. @1@ 2Template: Webachiv / IABot / www.piksa.info
  13. Portage TMPDIR on tmpfs. In: Gentoo Wiki. Retrieved March 21, 2020 .
  14. RETROPORT: RAM-Floppy 256K (Rex 9680) at Archive.org ( Memento from May 2, 2012 in the Internet Archive )
  15. Home computer DDR: RAM floppy RAF2008