Killing spawned tasks and Zombies

I am writing a deeply embedded application that communicates on DSSS type
radios to a stationary system using RTP 6.10 (latest). This application must
detect failures at all levels and retry/reconnect when comm is lost. It is
running on a 386sx pc/104 system with an attached PCMCIA card adapter with
an inserted CDS Technologies DSSS radio card.

I am using io-net with the tiny TCP stack and a 6.10 radio driver from CDS
Technologies. When my main process starts by powering up the machine, I
spawn devp-pccard then io-net with the CDS drive and ttcpip stack. I record
the PID from each.

Once I detect that the lowest level is not working, I am attempting to kill
io-net then devp-pccard then restart each process.
However, I can not keep io-net from creating ‘zombies’ and all instances of
io-net are not stopped.

I have spawned ‘slay -f -Q io-net’ then issued wait(&result).
I have also used kill(ionet_PID,SIGHUP); wait();

I must find a way to do this or this implementation is not viable.

Thanks in advance for your replies.

Jim

“Jim Moore” <jmoore@agvp.com> writes:

I am writing a deeply embedded application that communicates on DSSS type
radios to a stationary system using RTP 6.10 (latest). This application must
detect failures at all levels and retry/reconnect when comm is lost. It is
running on a 386sx pc/104 system with an attached PCMCIA card adapter with
an inserted CDS Technologies DSSS radio card.

I am using io-net with the tiny TCP stack and a 6.10 radio driver from CDS
Technologies. When my main process starts by powering up the machine, I
spawn devp-pccard then io-net with the CDS drive and ttcpip stack. I record
the PID from each.

Once I detect that the lowest level is not working, I am attempting to kill
io-net then devp-pccard then restart each process.
However, I can not keep io-net from creating ‘zombies’ and all instances of
io-net are not stopped.

I have spawned ‘slay -f -Q io-net’ then issued wait(&result).
I have also used kill(ionet_PID,SIGHUP); wait();

I must find a way to do this or this implementation is not viable.

Thanks in advance for your replies.

In order to get rid of a zombie process, you have two choices:

  1. call wait() or waitpid() from the process’s parent. That is, you
    have to reap the child process from the process that originally
    started it. It’s common for the parent to do this from within a
    SIGCHLD handler.

  2. Start the process using one of the spawnl() or spawnv() calls, and
    specify the mode as P_NOWAITO. When the child exits, it will not
    generate a signal (SIGCHLD) to its parent, and its exit status will
    not be available through wait(). The child will not create a
    zombie.

Cheers,
Andrew

\

Andrew Thomas, President, Cogent Real-Time Systems Inc.
2430 Meadowpine Boulevard, Suite 105, Mississauga, Ontario, Canada L5N 6S2
Email: andrew@cogent.ca WWW: http://www.cogent.ca

Thanks for the info. I added the P_NOWAIT and all is well.
RTP is a good operating system, however, it is sometimes dificult to know
where to look for information about a specific topic.

Jim

“Andrew Thomas” <andrew@cogent.ca> wrote in message
news:x7snfia1a9.fsf@cogent.ca

“Jim Moore” <> jmoore@agvp.com> > writes:

I am writing a deeply embedded application that communicates on DSSS
type
radios to a stationary system using RTP 6.10 (latest). This application
must
detect failures at all levels and retry/reconnect when comm is lost. It
is
running on a 386sx pc/104 system with an attached PCMCIA card adapter
with
an inserted CDS Technologies DSSS radio card.

I am using io-net with the tiny TCP stack and a 6.10 radio driver from
CDS
Technologies. When my main process starts by powering up the machine, I
spawn devp-pccard then io-net with the CDS drive and ttcpip stack. I
record
the PID from each.

Once I detect that the lowest level is not working, I am attempting to
kill
io-net then devp-pccard then restart each process.
However, I can not keep io-net from creating ‘zombies’ and all instances
of
io-net are not stopped.

I have spawned ‘slay -f -Q io-net’ then issued wait(&result).
I have also used kill(ionet_PID,SIGHUP); wait();

I must find a way to do this or this implementation is not viable.

Thanks in advance for your replies.

In order to get rid of a zombie process, you have two choices:

  1. call wait() or waitpid() from the process’s parent. That is, you
    have to reap the child process from the process that originally
    started it. It’s common for the parent to do this from within a
    SIGCHLD handler.

  2. Start the process using one of the spawnl() or spawnv() calls, and
    specify the mode as P_NOWAITO. When the child exits, it will not
    generate a signal (SIGCHLD) to its parent, and its exit status will
    not be available through wait(). The child will not create a
    zombie.

Cheers,
Andrew

\

Andrew Thomas, President, Cogent Real-Time Systems Inc.
2430 Meadowpine Boulevard, Suite 105, Mississauga, Ontario, Canada L5N 6S2
Email: > andrew@cogent.ca > WWW: > http://www.cogent.ca

Jim Moore <jmoore@agvp.com> wrote:

Thanks for the info. I added the P_NOWAIT and all is well.
RTP is a good operating system, however, it is sometimes dificult to know
where to look for information about a specific topic.

Jim

A good place to look for specific topic info is in the QNX Knowledge Base.
http://qdn.qnx.com/support/bok/index.html

Barry

“Andrew Thomas” <> andrew@cogent.ca> > wrote in message
news:> x7snfia1a9.fsf@cogent.ca> …
“Jim Moore” <> jmoore@agvp.com> > writes:

I am writing a deeply embedded application that communicates on DSSS
type
radios to a stationary system using RTP 6.10 (latest). This application
must
detect failures at all levels and retry/reconnect when comm is lost. It
is
running on a 386sx pc/104 system with an attached PCMCIA card adapter
with
an inserted CDS Technologies DSSS radio card.

I am using io-net with the tiny TCP stack and a 6.10 radio driver from
CDS
Technologies. When my main process starts by powering up the machine, I
spawn devp-pccard then io-net with the CDS drive and ttcpip stack. I
record
the PID from each.

Once I detect that the lowest level is not working, I am attempting to
kill
io-net then devp-pccard then restart each process.
However, I can not keep io-net from creating ‘zombies’ and all instances
of
io-net are not stopped.

I have spawned ‘slay -f -Q io-net’ then issued wait(&result).
I have also used kill(ionet_PID,SIGHUP); wait();

I must find a way to do this or this implementation is not viable.

Thanks in advance for your replies.

In order to get rid of a zombie process, you have two choices:

  1. call wait() or waitpid() from the process’s parent. That is, you
    have to reap the child process from the process that originally
    started it. It’s common for the parent to do this from within a
    SIGCHLD handler.

  2. Start the process using one of the spawnl() or spawnv() calls, and
    specify the mode as P_NOWAITO. When the child exits, it will not
    generate a signal (SIGCHLD) to its parent, and its exit status will
    not be available through wait(). The child will not create a
    zombie.

Cheers,
Andrew

\

Andrew Thomas, President, Cogent Real-Time Systems Inc.
2430 Meadowpine Boulevard, Suite 105, Mississauga, Ontario, Canada L5N 6S2
Email: > andrew@cogent.ca > WWW: > http://www.cogent.ca