ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi,
I have a program that monitors server load and sends SIGSTOP signal to a process group via killpg() to reduce load and then SIGCONT again to restart. The problem I'm having is one of the child processes in this process group will at times ignore the SIGSTOP signal, all the other processes will stop but this process will not. So all the other processes die off and this one process is left running. If you try to stop this process from the command line sometimes its stops for a few seconds then it will start up again all by itself. Its driving me nuts because its breaking the rules as far as I can tell.
Can anyone tell me any reason why a SIGSTOP signal may fail on this process or on any process? And is there anyway to work around such a situation? Such as being able to detect when a process may be likely to ignore a SIGSTOP signal and perhaps wait until its state changes back to normal again?
Please any help will be so greatly appreciated I can't begin to explain
SIGSTOP can't be caught or ignored. Period. It will stop the program. The only way the program can continue is if someone sends it a SIGCONT. I suspect someone is doing that, sometimes right away, sometimes after a few seconds.
Can you temporarily modify the code in the runaway process to catch the SIGCONT signal and log when it receives one?
SIGSTOP can't be caught or ignored. Period. It will stop the program. The only way the program can continue is if someone sends it a SIGCONT. I suspect someone is doing that, sometimes right away, sometimes after a few seconds.
Can you temporarily modify the code in the runaway process to catch the SIGCONT signal and log when it receives one?
Hope this helps.
Thanks to all for you rinput so far .
I beleived SIGSTOP could not be ignoreed too (and want to believe it) but I ran a strace on this process while it was actively being sent SIGSTOP signals and it only showed the SIGSTOP signals being sent to the process every second or so - as my program is meant to do. There were no SIGCONT signals. So its been a real annoyance for me. I could send this process 10 SIGSTOP signals and see them all in the strace (one after another) but the process would just keep running, completely ignoring the signals. How can it do this?
Im looking into some other way of controlling server load. My true aim is to turn fast high CPU intensive processes into slow low intensive CPU processes. Nice, Renice are not effective enough - I'm now researching on other process scheduling type settings, like changing timeslice of the runtime of the process and other such settings - if they can be changed??? What kind of functions are avaialble to modify scheduling? Changing the CPU intensity of a running process? What methods are available? Sorry I'm not too knowledgable about this stuff yet, still reading up on it all. Any input is greatly appreciated, thanks in advance.
After researching all the options, scheduling and real time processing I've come to the conclusion I don't like the limited control Linux gives you over process scheduling. I wish there was some simple way to force a process to be idle for x seconds. This is all I need - to be able to force a process off the process que for a period of time - or to force the process to remain on the "expired" process que for a certain length of time.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.