How to run processes in parallel?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to run processes in parallel?
# 1  
Old 11-03-2004
How to run processes in parallel?

In a korn shell script, how can I run several processes in parallel at the same time?

For example, I have 3 processes say p1, p2, p3

if I call them as
p1.ksh
p2.ksh
p3.ksh

they will run after one process finishes. But I want to run them in parallel and want to display "Process p1 completed... etc." after each process finishes.

How can I do that?

Thanks in advance
# 2  
Old 11-03-2004
You could make them run in background.

p1.ksh &
p2.ksh &
p3.ksh &
# 3  
Old 11-03-2004
Thanks for the reply.

Yes it would run in background but still sequencially instead of in parallel.
# 4  
Old 11-03-2004
We must be missing something here.

Unless those processes need to be precisely synchronized with each other somehow, running in the background is as close to 'parallel' as you will get.

We have multi-cpu boxes (say 10 cpu) - we start off 10 processes that each work on 1/10 of the dataset. We think of this as parallel, even though it is not.

Maybe you should explain your problem a little more.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

(bash) Script Processes in Parallel

Hello all, I tried to parralise my treatments but after a while 'ps -ef' display all child process <defunct> (zombie) Parent bash script to process all files (>100000) in directory: for filename in /Data/*.txt; do ./child_pprocess.sh $filename & done exit(0)I understand that the... (1 Reply)
Discussion started by: namnetes
1 Replies

2. Linux

Inconsistency with parallel run

Hi All, I am running a parallel processing on aggregating a file. I am splitting the process into 7 separate parallel process and processing the same input file and the process will do the same for each 7 run. The issue I am having is for some reason the 1st parallel processes complete first... (7 Replies)
Discussion started by: arunkumar_mca
7 Replies

3. Shell Programming and Scripting

Run the for loop in parallel

I have the below code which runs on multiple databases , but this runs one-after-one. I will need this to run in parallel so that i could save a lot of time. Please help!!! Thanks in advance for Db in `cat /var/opt/oracle/oratab |egrep -v "ASM" |grep -v \# |cut -d\: -f1` do { export... (5 Replies)
Discussion started by: jjoy
5 Replies

4. Shell Programming and Scripting

Keep up constant number of parallel processes

Hi guys, I am struggling with adapting my script to increase the performance. I created a ksh script to process a lot of files in parallel. I would like to know how can I do in such a way that a constant number of processes is always up (until all is finished). What I have is (not actual... (8 Replies)
Discussion started by: lurkerro
8 Replies

5. Shell Programming and Scripting

Deleting all the parallel processes launched when the main script receives a ctrl+c

Hi, I have a shell script that creates 2 parallel processes. When I press ctrl+c, i want the parallel process to get killed as well. #!/bin/bash cmd1="script1.py" cmd2="script2.py" ${cmd1} & pid1=$! echo ${pid1} ${cmd2} & pid2=$! (7 Replies)
Discussion started by: sana.usha
7 Replies

6. Shell Programming and Scripting

Parallel processes to INC- and DEC-rement shared counter

QUESTION: How do I run processes in parallel, so that the counter (in counter.txt) would vary in value (instead of just "0" and "1")? That is, how to not sequentially run inc.sh and dec.sh? The shared counter (a single number starting as 0) is in a file counter.txt. counter.sh is (supposed to... (2 Replies)
Discussion started by: courteous
2 Replies

7. Shell Programming and Scripting

Run in series and Parallel

I have a list with four dates say load_date.lst contains 2010-01-01 2010-01-31 2010-03-01 2010-03-31 2010-05-01 2010-05-31 2010-07-01 2010-07-31 And I have directory /lll/src/sql with set of sql's 1_load.sql 2_load.sql 3_load.sql I want to run the sql'in series with respective to... (3 Replies)
Discussion started by: sol_nov
3 Replies

8. Shell Programming and Scripting

Retention of Variable Value when a script is called by different processes in parallel- Linux 2.6.9

Hi, I have a generic FTP script which will be called by 28 different processes in parallel (through a GUI tool) may or may not be at the exact moment (there could be a delay of about a minute or so). ./FTP.ksh 1 (1 through 28) This script after importing file from remote m/c... (1 Reply)
Discussion started by: dips_ag
1 Replies

9. Shell Programming and Scripting

Run a command in parallel

Hi all, How do i run a command in parallel 50 times and capturing the result of each run in a separate file Eg: myApp arg1 > run1.txt myApp arg1 > run2.txt ::::::::::::::::::::::::: ::::::::::::::::::::::::: myApp arg1 > run50.txt The above way is sequential. ... (3 Replies)
Discussion started by: jakSun8
3 Replies

10. UNIX for Advanced & Expert Users

script to run different shells which run different processes

Hi, Would like to ask the experts if anyone knows how to run a script like this: dtterm -title shell1 run process1 on shell1 dtterm -title shell2 run process2 on shell2 cheers! p/s: sorry if i used the wrong forum, quite concussed after watching world cup for several nights; but I... (2 Replies)
Discussion started by: mochi
2 Replies
Login or Register to Ask a Question