View Single Post
MCQ
Veteran Member
 
Join Date: May 2004
Location: NY
Send a message via MSN to MCQ  
2004-11-08, 00:51

Quote:
Originally Posted by Brad
I'm alread familiar with the rc command from some limited experience with Linux. Basically, rc starts items at boot time. It's like out StartupItems folder but on the *nix site of things.

It makes sense that update would start at boot time. I just wonder why it thinks it needs to keep flushing the filesystem cache (I assume that's what it's doing by the description) constantly even when the filesystem isn't in use.

I'll report back any of my own research findings...
This is all I've seen so far, following the sync command that update calls.

From the man pages for sync:
Quote:
SYNC(2) BSD System Calls Manual SYNC(2)

NAME
sync - synchronize disk block in-core status with that on disk

SYNOPSIS
#include <unistd.h>

void
sync(void);

DESCRIPTION
The sync() function 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() call is
issued frequently by the user process update(8) (about every 30 seconds).

The function fsync(2) may be used to synchronize individual file descrip-
tor attributes.

SEE ALSO
fsync(2), sync(8), update(8)
From linux, the sync command in section 8:
http://linux.about.com/library/cmd/blcmdl8_sync.htm

Quote:
sync writes any data buffered in memory out to disk. This can include (but is not limited to) modified superblocks, modified inodes, and delayed reads and writes. This must be implemented by the kernel; The sync program does nothing but exercise the sync(2) system call.

The kernel keeps data in memory to avoid doing (relatively slow) disk reads and writes. This improves performance, but if the computer crashes, data may be lost or the filesystem corrupted as a result. sync ensures that everything in memory is written to disk.
Seems like both sync and update call the same system call, so I'm not quite sure why both are there. Note: There's a sync in section 8 of the man pages for OS X, but the one above for Linux seemed a little more clear.

I'm not quite sure that it's necessary to be done so often. It seems like a filesystem integrity command of sorts.
  quote