Sponsored Content
Top Forums Programming How to limit the number of child processes Post 302371410 by xyzt on Saturday 14th of November 2009 03:15:51 PM
Old 11-14-2009
I solved the problem by handling the SIGCHLD signal and counting the child processes number.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

what are parent and child processes all about?

I don't follow what these are... this is what my text says... "When a process is started, a duplicate of that process is created. This new process is called the child and the process that created it is called the parent. The child process then replaces the copy for the code the parent... (1 Reply)
Discussion started by: xyyz
1 Replies

2. Programming

Controlling child processes

Hello all, I am trying to create n child processes and control them from a parent process; say make child 3 print its pid and then child 5 do the same and some other stuff. Is there a way to accomplishing this after all the child processes are created via a call to fork(). Thank you, FG (23 Replies)
Discussion started by: forumGuy
23 Replies

3. Shell Programming and Scripting

Parent/Child Processes

Hello. I have a global function name func1() that I am sourcing in from script A. I call the function from script B. Is there a way to find out which script called func1() dynamically so that the func1() can report it in the event there are errors? Thanks (2 Replies)
Discussion started by: yoi2hot4ya
2 Replies

4. Programming

fork() and child processes

Hello, How many child processes are actually created when running this code ? #include <signal.h> #include <stdio.h> int main () { int i ; setpgrp () ; for (i = 0; i < 10; i++) { if (fork () == 0) { if ( i & 1 ) setpgrp () ; printf ("Child id: %2d, group: %2d\n", getpid(),... (0 Replies)
Discussion started by: green_dot
0 Replies

5. Shell Programming and Scripting

fork() and child processes

Hello, How many child processes are actually created when running this code ? #include <signal.h> #include <stdio.h> int main () { int i ; setpgrp () ; for (i = 0; i < 10; i++) { if (fork () == 0) { if ( i & 1 ) setpgrp () ; printf ("Child id: %2d, group: %2d\n",... (1 Reply)
Discussion started by: green_dot
1 Replies

6. UNIX for Advanced & Expert Users

killing all child processes

Hi, Is there a way I can kill all the child processes of a process, given its process id. Many thanks in advance. J. (1 Reply)
Discussion started by: superuser84
1 Replies

7. Shell Programming and Scripting

36 Child Processes not running as desired

I have a parent process which will start 36 child process. This I achieved by using the 'for loop'. In Parent.sh:- ./Child.sh <arg1> <arg2> ... & If I execute "ps -ef | grep Child.sh", I can see 72 child processes running at the background. I mean I can see the duplicate of each process. ... (2 Replies)
Discussion started by: nthiruvenkatam
2 Replies

8. Shell Programming and Scripting

Kill child processes when exit

Hi, I have parent script which is invoking multiple child scripts. I would want to kill all the child processes before the parent process exit. > cat ./parent #!/bin/ksh while do . ./child arg1 & if ; then break fi done Is there a way to get the process group id for all the child... (3 Replies)
Discussion started by: midhun19
3 Replies

9. Shell Programming and Scripting

Controlling the Number of Child processes

I am trying to implement the below using Ksh script on a Lx machine. There is a file(input_file) with 100K records. For each of these records, certain script(process_rec) needs to be called with the record as input. Sequential processing is time-consuming and parallel processing would eat up... (2 Replies)
Discussion started by: APT_3009
2 Replies

10. Shell Programming and Scripting

Get all child processes of a process

is there a universal way of getting the children of a particular process? i'm looking for a solution that works across different OSes...linux, aix, sunos, hpux. i did a search online and i kept finding answers that were specific to Linux..i.e. pstree. i want to be able to specify a process... (2 Replies)
Discussion started by: SkySmart
2 Replies
siginfo(5)							File Formats Manual							siginfo(5)

NAME
siginfo - Details of signal generation SYNOPSIS
#include <siginfo.h> DESCRIPTION
The siginfo structure provides processes with information on why a signal was generated, or a process that is monitoring child processes may receive information that specifies why a child process changed state. See the sigaction(2) and waitid(2) reference pages for more information. The type siginfo_t contains the following members: Contains the system generated signal number. Note that for the waitid function, this field is always SIGCHLD. Contains, if non-zero, the errno that is associated with the signal. Specifies a code that determines whether the signal was generated by a user process, a specific signal, or by the kernel. When the value of si_code is less than or equal to zero (0), the signal was generated by a user process and the siginfo structure contains the following additional members: pid_t si_pid /*sending process ID*/ uid_t si_uid /*sending user ID*/ See the kill(2) and sigsend(2) reference pages for more information on these fields. The following table describes the meaning of the code generated by a signal. The table lists signals in alphabetical order. ---------------------------------------------------------- Signal Code Definition ---------------------------------------------------------- SIGBUS BUS_ADRALN invalid address alignment BUS_ADRERR non-existent physical address BUS_OBJERR object specific hardware error SIGCHLD CLD_EXITED child has exited CLD_KILLED child was killed CLD_DUMPED child terminated abnormally CLD_TRAPPED traced child has trapped CLD_STOPPED child has stopped CLD_CONTINUED stopped child has continued CLD_SIGEXITING child is about to exit because it received a fatal signal SIGILL ILL_ILLOPC illegal opcode ILL_ILLOPN illegal operand ILL_ILLADR illegal addressing mode ILL_ILLTRP illegal trap ILL_PRVOPC privileged opcode ILL_PRVREG privileged register ILL_COPROC coprocessor error ILL_BADSTK internal stack error SIGFPE FPE_INTDIV integer divide by zero FPE_INTOVF integer overflow FPE_FLTDIV floating point divide by zero FPE_FLTOVF floating point overflow FPE_FLTUND floating point underflow FPE_FLTRES floating point inexact result FPE_FLTINV invalid floating point opera- tion FPE_FLTSUB subscript out of range SIGPOLL POLL_IN data input available POLL_OUT output buffers available POLL_MSG input message available POLL_ERR I/O error POLL_PRI high priority input available POLL_HUP device disconnected SIGSEGV SEGV_MAPERR address not mapped to object SEGV_ACCERR invalid permissions for mapped object SIGTRAP TRAP_BRKPT process breakpoint TRAP_TRACE process trace trap ---------------------------------------------------------- When a signal is generated by the system, the meaning of the code is as follows: ------------------------------------------------------------ Signal Field Description ------------------------------------------------------------ SIGILL caddr_t si_addr address of faulting instruction SIGFPE SIGSEGV caddr_t si_addr address of faulting memory SIGBUS reference SIGCHLD pid_t si_pid child process ID int si_status exit value or signal SIGPOLL long si_band band event for POLL_IN, POLL_OUT, or POLL_MSG ------------------------------------------------------------ Note, if the signal is SIGCHLD, and the si_code is equivalent to CLD_EXITED, si_status is equivalent to the exit value of the process. If si_code is not equivalent to CLD_EXITED, the si_status field is equivalent to the signal that caused the process to change state. In some instances, si_addr may not be defined, but si_addr will appear on the same page as the faulting instruction or memory reference. SEE ALSO
Functions: kill(2), sigaction(2), sigsend(2), waitid(2) Files: signal(4) siginfo(5)
All times are GMT -4. The time now is 06:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy