zoukankan      html  css  js  c++  java
  • sync Command in Unix

    sync 属于 System Administration Commands,负责系统管理工作的。在 SUN Solaris 2.9 中的 man 信息如下:

    NAME
         sync - update the super block
    SYNOPSIS
         sync
    DESCRIPTION
         sync executes the sync system primitive. If the system is to be  stopped,  sync  must  be  called  to  insure file system integrity. It will flush  all  previously  unwritten  system buffers  out  to disk, thus assuring that all file modifications up to that  point  will  be  saved.  See  sync(2)  for details.

    Unix 内核为了达到最佳的磁盘操作效率,会把需要写入到磁盘的数据先在内存中缓存起来,在合适的时候才真正写入到磁盘,这在绝大多数情况都是没有问题的,Unix 通过缓存机制提高了系统的效率。

    但是如果系统出现宕机、断电等不可抗力的事情,那么缓存中的数据就存在不被更新的危险。为了避免发生这种情况,Unix 系统提供重启时自动把缓冲区的内容同步到磁盘中。同时我们也可以手工去执行sync命令,强制将内存中的文件缓冲内容写到磁盘,正如上文红色部分所说的。

  • 相关阅读:
    清北学堂(2019 5 3) part 6
    清北学堂(2019 5 2) part 5
    清北学堂(2019 5 1) part 4
    dijkstra
    清北学堂(2019 4 30 ) part 3
    2020/5/1
    2020/4/30
    2020/4/29
    HSV模型
    2020/4/28
  • 原文地址:https://www.cnblogs.com/orientsun/p/2585747.html
Copyright © 2011-2022 走看看