TMPFS: A memory-based file system

Source: Internet
Author: User

TMPFS is a memory-based file system that

Tmpfs sometimes use RM (physical memory), sometimes swap (a piece of disk area). Allocate according to the actual situation.

RM: Physical memory. A short name for real memery? Real memory is the memory bar on the computer motherboard, called real memory is not too.

Swap: swap partition. is an area on the hard drive.

TMPFS the maximum size to use is why Rm+swap.

Swap is the virtual memory partition under Linux, which is used to virtualize disk space (that is, the swap partition) into memory after the physical memory is exhausted. It acts like a swap file for Windows systems, but it is a contiguous disk space and is not visible to users.

Wonder: What is the difference between the virtual memory often called by the window OS and the Swap partition (swap) in the Linux operating system?

Once I heard that, virtual memory, I often know the meaning of. Because using window at school, we can set the size of the virtual memory ourselves. Can be adjusted at any time. In fact, virtual memory is one such file under the Window System, as follows:

Every time I see the swap partition, I don't know anything at the moment.

Now, tidy up.

In fact, it is called virtual memory on the window system. The concept of Linux operating system is called swap partition. Essentially the same, it's all virtual memory.

Later, the data said that two operating systems for when to use virtual memory, is different. Obviously, Linux has better performance.

Windows usually uses virtual memory. And Linux only uses virtual memory when it's running out of memory?

The principle is basically the same as the difference is that Windows even when the physical memory is not exhausted will be used to virtual memory and Linux is not the same.

? Linux only uses virtual memory (that is, the swap partition) when the physical memory runs out, which is the difference between the two ...

The virtual memory of Windows is automatically set by the computer

The swap partition of Linux is the area where we put the system in place and the size is fixed (no wonder it's called the swap area, and it's considered a partitioning concept)

Look at the different design ideas:

Linux is simply a swap file designed to be partitioned, and Linux can be used with files. The difference between them is the way they are implemented.
The Windows virtual memory file benefits are dynamically variable size, which is managed by the system itself.

The virtual memory settings for Windows appear to be dynamically allocated on the C drive as if it were in 50%-100%. Linux does not have this automatic design, but when partitioned, the installer automatically partitions a suitable size SWAP partition according to custom.

The disadvantages of Windows virtual memory swap files are mixed in the system partition, file fragmentation issues and capacity change issues will affect the efficiency of the swap file, Linux because it is a separate partition, so there is no problem of file fragmentation and capacity changes.

Windows can also borrow the Linux swap concept, separate partitions, only to put Windows virtual memory Exchange files.

Summary: Virtual memory and swap partitions, essentially the same thing, is to solve the memory is not enough time to use the hard disk when memory. How to use a mechanism, window and Linux are slightly different.

Another major benefit of TMPFS is its lightning speed. Because a typical TMPFS file system resides completely in RAM, read-write can be almost instantaneous. Even with some swap partitions, performance is still excellent, and when more free VM resources are available, this part of the Tmpfs file system is moved to RAM. Having the VM subsystem automatically move part of the Tmpfs file system to the swap partition is actually good for performance, because doing so allows the VM subsystem to free up space for processes that require RAM. This, along with its ability to dynamically resize, allows the operating system to have much better overall performance and flexibility than choosing to use a traditional RAM disk.

I can understand it this way: TMPFS is a file system that is special in that it sometimes uses RAM, sometimes using VMS(virtual memory, swap partitions on disk)

Mount-t file Type-o option which device hangs a node

Mount-t Tmpfs-o size=20m tmpfs/mnt/tmp

Device: Which device is attached to a Linux directory. Here is the TMPFS device attached to the/mnt/tmp.

This operation of the/mnt/tmp directory is actually the operation of the TMPFS device.

Why has TMPFS become a device?

The VM subsystem does the management work. Virtual memory.

Attach a reference disc file to deepen your understanding:

Mount (Mount) of the disc image file
#mkdir/mnt/vcdrom
Note: Create a directory to use as a Mount Point

#mount-O loop-t iso9660/home/sunky/mydisk.iso/mnt/vcdrom
Note: You can access all the files in the disk image file Mydisk.iso using/mnt/vcdrom.

You can understand the Hang node here: A directory on Linux, which is a hanging node, to attach a device to the hanging node.

TMPFS: A memory-based file system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.