You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Processes I<br />
Rules about sharing of file pointers:<br />
- <strong>the</strong> only time a single process table entry contains pointers to <strong>the</strong> same file table entry is from a dup system call<br />
- if a single process opens <strong>the</strong> same file more than once, each open returns a file descriptor that points to a<br />
unique file table entry, but all <strong>the</strong>se file table entries point to <strong>the</strong> same i-node table entry<br />
- a file table entry can only have more than one process table entry pointing to it from a fork operation<br />
- if <strong>the</strong> parent and child do not coordinate <strong>the</strong> use of a shared file from a fork, <strong>the</strong>n any changes made by one of<br />
<strong>the</strong> two processes to <strong>the</strong> file position affects <strong>the</strong> o<strong>the</strong>r<br />
! Daemon Processes<br />
A daemon is a process that executes in <strong>the</strong> background waiting for some event to occur, or waiting to perform a<br />
task on a periodic basis.<br />
A standard <strong>Unix</strong> process named cron performs periodic tasks at given times during<br />
<strong>the</strong> day from /usr/lib/crontab /* cron table */.<br />
Daemon process startup:<br />
1. started at boot by initialization script /etc/rc<br />
2. from system's /usr/lib/crontab on periodic basis<br />
3. from user's crontab on periodic basis (System V)<br />
4. by executing <strong>the</strong> at command - schedules a job<br />
5. from user terminal - foreground or background job<br />
Typical system daemons characteristics:<br />
(e.g. a line printer)<br />
- started once, when system is initialized<br />
- lifetime is <strong>the</strong> entire time system is operating . spend most time waiting from some event to occur<br />
- spawn o<strong>the</strong>r processes to handle service requests<br />
Close all Open File Descriptors<br />
All unnecessary file descriptors should be closed.<br />
#include <br />
for (i=0; i