Sponsored Content
Top Forums Shell Programming and Scripting Capturing PIDs of same process at different instances Post 302569840 by suryaemlinux on Tuesday 1st of November 2011 05:51:36 PM
Old 11-01-2011
Capturing PIDs of same process at different instances

Hi,
I'm gonna launch a process from my 'C' code. I'm gonna launch it a few times. I would like to capture the PID of that process each time I launch. I have to copy the each PIDs into a 'C' variable and I have to kill all of them when I exit from the 'C' code.

My requirement is


int pid_var1;
int pid_var2;
int pid_var3;


system(launch_pro); //Instance 1
pid_var1 = PID (launch_pro); // How do I do this???


I have to repeat this for all the instances.


Thanks,
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

capturing process id

I am newbie to unix shells world. I am trying to capture a background process id into a file so that it can be killed later. this process is basically a java program running in background as: java TestApp & this returning process id immediately. So how can i redirect that pid into a file.... (1 Reply)
Discussion started by: bvreddy
1 Replies

2. HP-UX

PIDs of background process

How to track the pid of a background child process(shell script) from a parent script ? For example :- $ sleep 10000 & 4220 where 4220 is the pid of bg process sleep. Now my requirement is to keep the sleep statement in a shell script(test.ksh) and will be invoking it from... (3 Replies)
Discussion started by: ramkumar
3 Replies

3. UNIX for Dummies Questions & Answers

Capturing the Process ID of a process

hi Everybody I am trying to capture process id of a process which has been started through the execution of a shell script CLASSPATH=. CLASSPATH=${CLASSPATH}:sampleswing.jar java -cp ${CLASSPATH} Sample echo $! > pid.sh above is the simple script file called swings.sh When i... (8 Replies)
Discussion started by: appleforme1415
8 Replies

4. Shell Programming and Scripting

Checking for multiple instances of a process

Hi I have a scenario where i need to check multiple instances of a running shell script (abc.sh) . How can I find from inside a running shell script whether any other instance of the same script is running or not? If any other instance of same shell script is running I need to exit from... (4 Replies)
Discussion started by: raghu.amilineni
4 Replies

5. AIX

Capturing Process on AIX boxes - IMP

Guys we all know what command 'COLUMNS=2047 /usr/bin/ps –eo pid,ppid,uid,user,args' does.It prints 5-column output for the running processes on a AIX box. Here is simple thing i need: I need to insert this tabular data in a db2 table. How do i need? I have created table with these five... (0 Replies)
Discussion started by: ak835
0 Replies

6. Shell Programming and Scripting

Capturing running process name

i'm looking to have my script capture it's own process name while running. i'm going to use this in the output of the script to track which script produced which output file(s). when i run: ps -ef | grep processname i only get as results a ps -ef listing for the grep inside my... (6 Replies)
Discussion started by: danmauer
6 Replies

7. Shell Programming and Scripting

Capturing the CPU% used by a process

Hi, I just wonder I need to write a script where I can check if a particular process is consuming X amount of CPU. I was thinking of using the ps command but doesn't seems to work. Any ideas. Thanks. (2 Replies)
Discussion started by: arizah
2 Replies

8. Shell Programming and Scripting

Capturing the killed process logs

I have two set of questions. 1) To skip killing some process automatically. 2) To kill other process and capture their log. I have set of process, some needs to be killed gracefully and others should be skipped. Listed are the process. adm 1522... (1 Reply)
Discussion started by: murali1687
1 Replies

9. Shell Programming and Scripting

Capturing the return code from background process

Hi All, I was out not working on unix from quite sometime and came back recently. I would really appreciate a help on one of the issue I am facing.... I am trying to kick off the CodeNameProcess.sh in PARALLEL for all the available codes. The script runs fine in parallel. Let say there are... (1 Reply)
Discussion started by: rkumar28
1 Replies

10. Hardware

CUDA GPU terminates process at random instances

I am trying to start troubleshooting an error on a virtual server that uses the ubuntu 14.04 OS. Basically what happens (seeming random) is that the GPU stops processing and terminates. What Imean by seeming random is that for 3 runs there is no error then on run 4 the error appears. It has... (2 Replies)
Discussion started by: cmccabe
2 Replies
numa_sched_launch(5)						File Formats Manual					      numa_sched_launch(5)

NAME
numa_sched_launch - change process default launch policy VALUES
Failsafe Default Allowed values Recommended values unless the application requires explicit different behavior. DESCRIPTION
The dynamic tunable controls the default launch policy for newly created processes. The process launch policy controls the initial place- ment of the child process at creation time. The scheduler can migrate threads from one locality domain (LDOM) to another to distribute workload for better throughput and responsiveness. The default launch policy is applicable only to processes that have no explicit launch policy, processor binding, or LDOM binding applied to them (see mpctl(2) for details). There are three possible values of this tunable: This value explicitly disables any change in the default launch policy for processes irrespective of the system configuration. A newly created process will be placed using the legacy default launch policy. This is the default and recommended value. HP-UX will autosense the right policy setting based on system configuration. This policy directs HP-UX to optimize the launch policy for multi-process applications that share data. Such applications can get better performance when the applications are packed together in the same LDOM. The policy will cause child processes created using to be placed in the same locality domain as the parent process. Note that a different default launch policy may be used in the future with new system configurations for improved application performance when this tunable is enabled. Processes created using will be treated as if they are a new application and will continue to be launched using the legacy default launch policy. This value explicitly enables the new default launch policy for processes. A process created using is placed in the same locality domain as its parent process irrespective of the system configuration. Who Is Expected to Change This Tunable? System administrators who prefer to explicitly control the default launch policy for applications even when LORA (Locality Optimized Resource Alignment) mode is enabled (see numa_policy(5) for details). Restrictions on Changing The tunable changes take effect immediately. However, changes to this tunable will not affect processes that are already created. Such processes will need to be stopped and restarted to be launched with a modified tunable setting. When Should the Value of This Tunable Be Changed to 0? The value of should be set to to preserve the legacy process default launch policy even when the system is configured in LORA mode. When Should the Value of This Tunable Be Changed to 1? The value of should be set to to improve the performance of multi-process applications. When Should the Value of This Tunable Be Changed to 2? The value of should be set to when a multi-process application is likely to see improved performance even if the system is not configured for LORA mode. What Are the Side Effects of Changing the Value? The distribution of CPU utilization across the system will change. This situation can result in a change in performance. The change in performance is highly dependent on the workload and the partition configuration. What Other Tunable Values Should Be Changed at the Same Time? None. WARNINGS
All HP-UX kernel tunable parameters are release specific. This parameter may be removed or have its meaning changed in future releases of HP-UX. Installation of optional kernel software, from HP or other vendors, may cause changes to tunable parameter values. After installation, some tunable parameters may no longer be at the default or recommended values. For information about the effects of installation on tun- able values, consult the documentation for the kernel software being installed. For information about optional kernel software that was factory installed on your system, see at AUTHOR
was developed by HP. SEE ALSO
fork(2), mpctl(2), vfork(2), numa_policy(5). Tunable Kernel Parameters numa_sched_launch(5)
All times are GMT -4. The time now is 02:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy