Linux sync command Learning

Source: Internet
Author: User

First, let's take a look at buffer and cache:
Buffer, to solve the disk write efficiency;
Cache to improve Disk Read efficiency.

In Linux, data is first placed in a buffer to improve the efficiency of disk reading and writing.
Writing data to a disk is not immediately written to the disk, but to the buffer.
If the system is restarted, data may be lost.

The sync command is used to flush the buffer of the file system so that the data is actually written to the disk and the buffer can be released.
Flush is used to clear the buffer.
The sync command forcibly writes data to the disk and releases the buffer corresponding to the data,
Therefore, you often enter the sync command after writing data to the disk to write data to the disk.

If you do not manually enter the sync command to write data to a disk, there will be two disk write times in linux:
1. kflush kernel threads periodically write data to disks;
2. The buffer is full and has to be written.

Questions to be confirmed:
Is there a kflush thread for periodic sync?

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.