stopping a running program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hsn
    New Member
    • Sep 2007
    • 237

    stopping a running program

    hello everyone i am creating a system full of programs here and there.
    think about it like this there is a big program and there are mini programs running.
    how can i through the big program stop one of the mini programs when i don't need it.
    i am using C++
    thanks alot

    regards
    hsn
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    Originally posted by hsn
    hello everyone i am creating a system full of programs here and there.
    think about it like this there is a big program and there are mini programs running.
    how can i through the big program stop one of the mini programs when i don't need it.
    i am using C++
    thanks alot

    regards
    hsn

    You can use kill -9 <pid> with system command to do the same.

    Raghuram

    Comment

    • hsn
      New Member
      • Sep 2007
      • 237

      #3
      Originally posted by gpraghuram
      You can use kill -9 <pid> with system command to do the same.

      Raghuram
      how can i get the process ID
      and is this for windows

      Comment

      • mmk
        New Member
        • Oct 2006
        • 19

        #4
        Originally posted by hsn
        how can i get the process ID
        and is this for windows
        You can get PID by typing $ps -ef in your linux terminal. Which shows the processors list which are currently running. Second column in the displayed table is PID. Just grep the processes pid you want to kill and kill it as stated by Raghu.

        Comment

        • mmk
          New Member
          • Oct 2006
          • 19

          #5
          Sorry in above mentioned answer, $ps -ef is linux command to display snapshot of current processes not processor.

          Comment

          • Banfa
            Recognized Expert Expert
            • Feb 2006
            • 9067

            #6
            Originally posted by hsn
            how can i get the process ID
            and is this for windows
            Presumably your big process create the mini-processes?

            If so then when you call CreateProcess part of the returned data is the process id which can be used with TerminateProces s.

            However TerminateProces s is not a recommended function call for normal operation it would be better if you could signal the mini-processes to terminate themselves gracefully (i.e. release resources) rather than doing so from the big process.

            You could uses something like an Event object to do this.

            Comment

            Working...