Parallel process in Perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Parallel process in Perl
# 1  
Old 04-15-2012
Parallel process in Perl

HI All,
I have scenerio where I need to call sub modules through for loop

Code:
for (i=0; i<8000 ;i++)
{
..
BLOCKA

}
BLOCKA
{
..
..
subroutine 1;
subroutine 2;
}
I want this to be run in parallel

process1 BLOCKA
{
...
...
subroutine 1;
subroutine 2;
}

process2 BLOCKA
{
....
....
subroutine 1;
subroutine 2;
}

Is there way in perl to do this .

I want to create 8000 process and want to run all the process in parallel


Thanks,
gvk

Last edited by radoulov; 04-15-2012 at 06:38 PM..
# 2  
Old 04-15-2012
Hi gvk25,

Use fork() function.
# 3  
Old 04-16-2012
Can you elobrate more ,I am bit new to perl scripting
# 4  
Old 04-16-2012
Take a look to perlipc help page. There are several examples using fork().

It should be something similar to:
Code:
for (i=0; i<8000 ;i++) {
    my $child = fork();
    die qq[ERROR in fork() function\n] unless defined $child;
    next if $child != 0;

    ## Do job for the child...

    exit 0;
}

This User Gave Thanks to birei For This Post:
# 5  
Old 04-16-2012
I had a doubt on fork(),pls help me.

I can create only 4000 process on my machine .

I need to make 8000 process ,does the fork will wait for other process to complete and will create a new process on completion of that.
# 6  
Old 04-16-2012
check the no. of processes a user can run? Its setup on the box / server. I am not sure about the parameter for that but i remember we used to set that limit to 4000 and if anyone tried to create new process would be rejected ... to check try logging on the box with this user in new session & let us know if that works, if there is a limit then it should fail. search google : https://www.google.co.in/search?q=ma...+fork+%2B+perl
# 7  
Old 04-16-2012
Unless you have 8,000 processors, what is the advantage of running 8,000 processes?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Monitoring processes in parallel and process log file after process exits

I am writing a script to kick off a process to gather logs on multiple nodes in parallel using "&". These processes create individual log files. Which I would like to filter and convert in CSV format after they are complete. I am facing following issues: 1. Monitor all Processes parallelly.... (5 Replies)
Discussion started by: shunya
5 Replies

2. Shell Programming and Scripting

Make process parallel

Hi, I have a file which has a list of 200 tables e.g: table.txt I need to do a count for each table and store it in a file. So I did something like this: for TABLE in `cat table.txt` do T_CNT=$(sqlplus -s -l / as sysdba <<EOF set echo off heading off feadback off SELECT count(*) FROM... (1 Reply)
Discussion started by: wahi80
1 Replies

3. UNIX for Dummies Questions & Answers

Running parallel process

i am having 4 process,have to run parallel and not after one by one. sample1.sh sample2.sh sample3.sh sample4.sh Thanks in advance. i (11 Replies)
Discussion started by: sagar_1986
11 Replies

4. Programming

Parallel process in java

Hello; Please Are both threads execute in parallel? Thank you (4 Replies)
Discussion started by: chercheur857
4 Replies

5. Shell Programming and Scripting

PARALLEL PROCESSING IN PERL

HI All, I have scenerio where I need to call sub modules through for loop for (i=0; i<30 ;i++) { .. .. .. subroutine 1; subroutine 2; } I want this to be run in parallel process1 { ... ... subroutine 1; subroutine 2; (0 Replies)
Discussion started by: gvk25
0 Replies

6. Shell Programming and Scripting

How to put FTP process as a background process/job in perl?

Hi, I am using net::ftp for transferring files now i am trying in the same Linux server as a result ftp is very fast but if the server is other location (remote) then the file transferred will be time consuming. So i want try putting FTP part as a background process. I am unaware how to do... (5 Replies)
Discussion started by: vanitham
5 Replies

7. UNIX for Dummies Questions & Answers

Slow printing / CUPS - process "parallel" high cpu

Hello. I have a slackware system running cups with an HP laserJet 2100 connected via parallel port in ECP mode. Print jobs are working. Very slowly. 15K test print out of cups takes about 2 minutes to complete. When the printout is on the way to the printer, the process "parallel" uses... (0 Replies)
Discussion started by: agentrnge
0 Replies

8. UNIX and Linux Applications

How can i see if a unix Process Aplication i.e oracle is running in parallel

There is a unix process process in oracle running and i see running by typing ps -fea|grep GE_CLIENTES. The question is How can i see if this process is running in paralel. I dont know with a Unix command or specifically its a comand from Oracle. I kow a Parallel process ia a process that... (1 Reply)
Discussion started by: alexcol
1 Replies

9. Shell Programming and Scripting

split process files in parallel and rejoin

Hi I need to split a huge file into multiple smaller files using split command. After that i need to process each file in the back ground with sql loader .Sql loader is a utlity to load CSV files into oracle . Check the status of each of these sqlloaders and then after sucessfull... (6 Replies)
Discussion started by: xiamin
6 Replies

10. UNIX for Dummies Questions & Answers

killing parallel oracle process

Hi guys: I have a an oracle job which uses 10 parallel hints and would like to killit when it hangs. I want to kill all the processes that have been spawned. what I do right now is get the pid of the scheduler process which initiated theis job and the do a ps -ef| grep 'pid' and trace through... (1 Reply)
Discussion started by: oracle8
1 Replies
Login or Register to Ask a Question