Can anyone help with the following problem I'm having on HP-UX 9.03 (or 9.05)?
I have a program consisting of two processes - a parent and child. The purpose
of the child process is to read packets from a lan card, filter them and the
pass the filtered packets up to the parent process in a pipe.
The child (filter) process is centered around a select(2) call which looks at 2
file descriptors: one for the lan card and one for a 'down' pipe coming from
the parent process which is used for sending packets from the parent process
and for occasional requests e.g. for changing the filter parameters. When a
filtered packet has been accepted, the child process puts it in the 'up' pipe
to the parent process then notifies it by sending it a SIGIO. The parent
process reads the packet from the 'up' pipe when it gets the SIGIO. Packet
transmission by the parent is not interrupt-driven. So packet transmission by
the parent process is synchronous and packet reception by the parent process is
The child writes the filtered packet to the 'up' pipe in one operation using a
write(2) call. Since packets may be of variable sizes (up to a maximum value),
I prepend the packet with its size (in bytes). The parent reads the packet by
first reading the size then reading the rest of the packet using read(2).
The problem I have concerns my program's speed. Sometimes (and seemingly at
random) it will run (i.e. be able to process packets from the lan card) at
roughly twice the rate it can at other times. I'm told that this may be due to
the relative ordering of parent and child in the process table, but the speeds
I see don't appear to be related to the order of parent and child in a 'ps'
listing. Can anyone tell me what could be going on to cause the behaviour I see
with my program's program speed, and what I can do to ensure that it always
runs at the maximum speed?
Thanks in advance
PS. I've tried experimenting with always sending maximum-sized packets from the
child to the parent so I only have to do one write(2) (at the child end) and
one read(2) at the parent end of the pipe, but this didn't make any difference.
PPS I've also tried giving the child process real-time priority but again
without any difference. (I can't give the parent process real-time priority
because that would hang the system).
_/_/_/ _/_/_/_/ _/_/_/_/ David P Peter
_/ _/ _/ _/ _/ _/ Insignia Solutions Inc.
_/ _/ _/ _/ +44 1494 453431
_/_/_/ _/ _/ In God We Trust (In Cars We Rust)