Memory swap space (swap)

Source: Internet
Author: User
Tags memory usage

Installing Linux requires two partitions, one is the root directory, and the other is swap (memory swap space). The function of swap is the function of memory expansion record due to insufficient physical memory. In general, if the hardware is adequately equipped, then swap should not be used by our system.

The data that the CPU reads comes from memory, when the memory is not enough, in order to let the subsequent program can run smoothly, so the program and data that is temporarily not used in memory will be moved to swap. The memory is now empty to load the program that needs to be executed. Swap uses a hard disk to temporarily place the information in memory.

The current host memory is very large, so in personal use, do not set swap is not a big problem. However, the server can be different, hesitate does not know when there will be a large number of requests from the network, so it is best to reserve some swap to buffer the system's memory usage.

  

How to create a new swap partition:

1, Partition: First use FDISK to separate a partition on the disk for the system as swap. Because the Linux fdisk defaults to set the partition's ID to the Linux file system, you may have to set the system ID.

2, Format: Using the new swap format "Mkswap device file name" to be able to format the partition into swap format.

3, use: Finally the swap device is started, the method is "Swapon device file name."

4, view: Finally through the free This command to check the memory usage.


(the basic Study (third edition) of "Brother Bird's Linux private cuisine") 8.5 reading notes)

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.