fork()/exec() and X11 streams usage.
fork()/exec() and X11 streams usage.
- Subject: fork()/exec() and X11 streams usage.
- From: Robert Tillyard <email@hidden>
- Date: Mon, 08 Oct 2012 22:42:17 +0100
Hello, all,
I have a general X11 question: Would anyone know if it is okay to use fork()/exec()/waitpid() in an X11 app? or should this be handled in some other way.
We have a large number of SCO OpenServer based systems in the field that use apps written using Qt/X11 to display onto PCs and Macs. In the very near future the plan is to remove the SCO boxes and replace with Mac OS X on Mac Pros, however, as the force behind moving it all to Mac I'd like to try and find the answer to this problem in case I am causing an issue that will also bite us on Macs as well.
Every so often the SCO boxes start consuming a vast amount of streams resources which if not caught in time will bring the system down in a kernel panic. If we do catch it in time we can find the X11 user that has high recv-Q/send-Q in netstat and ask them to come out of the system and go in again which will solve the issue.
So far as I can see this is with those connecting from PCs and not Macs (we've tried three different PC based X Servers). Our system consists of several modules and when a user runs a new module where the old one needs hiding until that sub-module has finished we use fork()/exec()/waitpid().
While trying to investigate this it seems that calling fork() and exec() to run sub-processes where the parent process blocks could be the problem, once fork() is called we use waitpid() to get the return from the child but if we use WNOHAND and sit in a loop calling some qApp->flushX11() routine the MBLKs in streams is kept low.
Would anyone know if it is okay to use fork()/exec()/waitpid() in an X11 app? or should this be handled in some other way.
At present process switches are kept at around 1500 per second but if we use WNOHANG on waitpid() and we keep calling qApp->flushX11() at regular intervals after small sleeps the number of precess switches jumps to around 500000 per second and the oldest parent processes won't get swapped out (well they do but they they have to be constantly swapped back in again for more CPU time).
Regards, Rob.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden