[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

About fathers and sons

From: Jose Luis Alarcon Sanchez
Subject: About fathers and sons
Date: Fri, 11 Mar 2005 22:10:42 +0000

  Hi Hurd People.

  I want ask a dudes i have in this list:

  This is the code:

* Processes n' Signals

#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>

int main (void)
  int i;
  int n = 5;
  int status;
  pid_t childpid;
  for (i = 1; i < n; ++i)
    if (childpid = fork())
    fprintf(stderr, "Daddy process %ld. Child process %ld. Signal %d\n",
    (long)getppid(), (long)getpid(), WTERMSIG(status));

  exit (0);

  It is inspired by the examples in the book "Practical UNIX
Programming: A Guide to Concurrency, Communication, and Multithreading",
written by Kay A. Robbins and Steven Robbins, 1996, Prentice Hall.

  They tells that this is the way for get a CHAIN of processes in Unix,
well i compile it on my two machines, kernel GNUmach 1.3 on an AMD K6-2
and kernel Linux 2.6.10 on an AMD Athlon.

  At the PC with Linux, the result is the waited, and described by the
authors, this can be a "scheme":

        process x - 4
        process x - 3
        process x - 2
        process x - 1
        process x

  This is a chain of procceses, like are described by the authors.

  But in the GNU/Hurd system, with kernel GNUmach 1.3, things happen in
another way. This is a simple scheme of the result:

         bash             init(process 1)
           l              l      l      l
        process x - 6   x - 5  x - 4  x - 2
                                     process x

  I have many questions about this: 

  - Why this "strange" way of produce processes?. In Unix init become
father when the original father proccess is dead, is this right?. Why in
Mach the processes dead so quickly while in Linux and other Unixes they
don't do?.

  - Where are the processes x - 3 and x - 1?. I can't understand why
this processes aren't into the scheme of processes production.

  - About signals: in our system the macro WTERMSIG(status) returns 88
and the macro WSTOPSIG(status) returns 133. What are the mean of this

  Thanks you, very much, in advance.




Not Registered Bee GNU/Hurd User.
Registered BSD User 51101.
Registered Linux User #213309.
Memories..... You are talking about memories. 
Rick Deckard. Blade Runner.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]