Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Got called to a professor’s office after a complaint his Sparc4 was running slow. Parent comment
Sync is not synchronous. When it is back to the shell there is no guarantee that data in memory is fully copied to disk.
However, it sets a flag that is reset when the copying is done. Sync will hang if the flag is set.
So the first sync arms the copy and sets the flag and is back to the shell.
The second sync starts, blocks at the flag. The flag gets reset and it is back to the shell.
So the 2nd sync going back to the shell is a guarantee that the first sync is fine and data is safe
There are no comments on this comment yet.
Sync is not synchronous. When it is back to the shell there is no guarantee that data in memory is fully copied to disk.
However, it sets a flag that is reset when the copying is done. Sync will hang if the flag is set.
So the first sync arms the copy and sets the flag and is back to the shell.
The second sync starts, blocks at the flag. The flag gets reset and it is back to the shell.
So the 2nd sync going back to the shell is a guarantee that the first sync is fine and data is safe