Thread: Stopping Processes Question

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    31

    Stopping Processes Question

    Hi,
    I would firstly like to say a huge thank you to all of you in these forums. You have been so very helpful in the past and its just really great to have this kind of community online.

    Ok now to the question:

    I'm using the kill(int pid, SIGSTOP); function to stop a process group (job) when server load gets too high and then restart it again when the servers load goes down again. I just ran my program then and it ran perfectly, however its performance is not reliable. Sometimes the stopping and starting of the process group seems to cause a failure - one of the child processes doesn't stop properly and half of the processes stop and the other half don't. This leads to the process group being broken and obviously a failure. I've tried running my program and watching closely what happens, but like I said before - this time it all worked perfectly. So my question is can anyone tell me is there a time limit on how long a process group can be in the "STOPPED" (or susended) state? I was thinking that perhaps on previous runs the load may have stayed higher for longer and caused the process group to be "STOPPED" for many minutes at a time. I was thinking maybe there was a time limit for how long a process can be stopped?

    Or can anyone else think of a reason why the process group (job) would break down and you end up with 2 groups of processes and a failure? Can anyone think of how I could test for this and avoid such a problem? I did notice that when it failed previoulsy the parent process zombied and the child processes kept running and I could not even stop them myself manually from the command line. Is there anyway you could test a process if its stoppable, prior to actually stopping it? What reasons would a process not be stoppable? Thanks you very much to anyone who adds any insight.

  2. #2
    Registered User
    Join Date
    Sep 2003
    Posts
    31
    Any kind of input is welcomed

  3. #3
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    You don't have the patience to wait half an hour before posting again?

    This type of question is better suited in the Linux section since it's a Unix/Linux question, not firmly related to C.

  4. #4
    Registered User
    Join Date
    Sep 2003
    Posts
    31
    Yes I can wait

    Just letting people know I'm interested in all ideas and input from other.

    I've just changed the usage of the kill function, before I was using kill(-pgid, SIGSTOP) to stop the process group, however I just discovered there's a specific kill function for sending signals to process groups - killpg(int pgid, SIGNAL). I don't think this will make any difference but doesn't hurt to add.

    Also I was wondering if there's a limit to the number of times a process group can be stopped and started?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 12:14 PM
  2. beginner question about stopping a for-loop.
    By Techboy10 in forum C Programming
    Replies: 3
    Last Post: 12-11-2008, 05:15 PM
  3. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  4. Computer Processes.... Which can be stopped?
    By Sevrin in forum Tech Board
    Replies: 3
    Last Post: 06-08-2003, 08:13 PM
  5. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM