Name

sync - commit buffer cache to disk

Library

libc.lib

Synopsis

  #include <unistd.h>
  void sync (void);

Detailed description

The sync system call forces a write of dirty (modified) buffers in the block buffer cache out to disk. The kernel keeps this information in core to reduce the number of disk I/O transfers required by the system. As information in the cache is lost after a system crash, a sync system call is issued frequently by the user process syncer (about every 30 seconds).

The fsync system call may be used to synchronize individual file descriptor attributes.


Examples

/**
 * This sample code demonstrates usage of sync system call
 *
**/
#include <unistd.h>
#include <stdio.h>
int main()
{
  sync()  ;
  printf("sync system call flused all dirty buffers 0) ;
  return 0 ;
}


Output

sync system call flused all dirty buffers


See also

fsync, syncer, sync

Bugs

The sync system call may return before the buffers are completely flushed.

Feedback

For additional information or queries on this page send feedback

© 2008 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user.

Top