Process scheduling query

Process scheduling query

Post by David Pete » Tue, 04 Apr 1995 04:00:00

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)


1. scheduling for interactive processes


It seems to me that Linux does NOT specifically distinguish
interactive vs. non-interactive processes.  Does this mean that we can
create a non-interactive process with high priority (e.g. computing Pi
and then minimize the window) and make interactive processes
(e.g. emacs or netscape) not get scheduled for a long while?  Is it
hard to distinguish interactive and non-interactive processes?  How
does this definition sound?

An interactive process has the current focus of windows manager.
Otherwise, it is a non-interactive process.

It's not hard for a windows manager to inform the kernel which process
has the current focus, right?  Does it make sense for the scheduler to
favor interactive processes?

Thanks for sharing your opinions.

                                                   Yung-Hsiang Lu

2. modelines for Compaq chipset ?

3. Linux process scheduling problem

4. PCMCIA Xircom CBE-10/100TX card under Linux - driver available ???

5. Help NewB - process scheduling

6. Patch lists at SunSolve

7. IRIX O/S Process Scheduling Algorithm...

8. HELP ! : Linux + Win95

9. batch process scheduling help

10. Can I change the default process schedule policy through command line or program ?

11. Scheduling of processes, and timers

12. X-Windows Process Scheduling

13. Code for scheduling processes