Correct copy of the summary of checking the status of process u...

TAYBENGH%NUSDISCS.BITNET at cunyvm.cuny.edu TAYBENGH%NUSDISCS.BITNET at cunyvm.cuny.edu
Sun May 27 07:52:00 AEST 1990


        Sorry for posted a wrong file earlier!

        Hi! Netlander, Sorry to return to all of u lately.

        First I have to thank all of u who replied/helped. Thank U!

        Here is the summary of the replies regarding detection of process
status. Basically, I am designing a super-server to create/monitor/destroy
server processes. My main objective of monitoring the status of server
processes is detect crash of any server process. Here, I will refer polled
process as server, the process monitoring the status of the server processes
as manager.

        1) Using kill():
        This is the most popular way (judged from the number of
        replies). However, I did not adopt this technique because of the
        problem that the effective user ID of the server must be the same as
        the manager , which is quite impossible to impose in my server
        manager design. Moreover, kill() may not work when the server process
        crashes and its process ID is re-assigned to other process.

        2) Search the kernel process table (/dev/kmem):
        This approach is too OS specific. Portability will be a big problem
        even between different Unix OS.

        3) Purposely bind a socket to the server port:
        If the binding succeeds, then the server is dead since port cannot be
        re-used; otherwise if the binding fails and returns an error telling
        port in used, then the server is alive. However, this approach faced
        the similar problem as technique 1 if the port is re-used by other
        process after server crashes and before we bind the socket.

        4) Using "ps" command and pipe it to file:
        Personaly I think this is the best and easiest solution. "ps" provides
        comprehensive information such as execution filename, process ID,
        process state of a process. In addition, almost every system has
        similar command. The shortcomings are: overhead in using system() and
        re-directing output from "ps" to file; slow file I/O operation (read).
        "grep" can be used to filter out unnecessary processes information.
        I am quite surprisied that nobody suggested this way. This is probably
        due to ambiguity in my question asked.

        Any comments are welcomed.

- Beng Hang Tay (email: taybengh at nusdiscs)
  Dept. of Info. Sys. and Comp. Sc.
  National University of Singapore



More information about the Comp.unix.questions mailing list