Is it possible ????


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Is it possible ????
# 8  
Old 08-16-2007
hey arun,

thanx a lot, but the link is not working......can u pls give me sample on my requirement , as i am running out of time.........
# 9  
Old 08-16-2007
Quote:
Originally Posted by manas_ranjan
yep joerg , by giving & it will run the scripts in Back ground..
by query is to run parallel, not one afteranother.

Arunkumar, Can u elaborate how can i use fork to run two scripts in parallel ......
How do you define of parallel processes? And what is your distinction between parallel and background?

"&" causes shell to fork another copy of itself.

Is this homework?
# 10  
Old 08-16-2007
1st------this is not home work.
2nd------I am good @ my homework.
3rd------parallel means , both scripts needs to start simultaneously,
let a.sh & , this will give the pid and run in back ground...and then b.sh will run ....

but i need both scripts to run at same time.

hopes kahuna you are clear and i gabe u clear explanation.
please let me know, if you have solution for this.
# 11  
Old 08-16-2007
Quote:
Originally Posted by manas_ranjan
3rd------parallel means , both scripts needs to start simultaneously,
let a.sh & , this will give the pid and run in back ground...and then b.sh will run ....

but i need both scripts to run at same time.
If you have a single processor, there is no such thing as starting scripts "simultaneously". One will be started first, then the other.

Actually "a.sh &" and "b.sh &" will run both scripts concurrently. But one will start first, then the other. To verify, try running 2 scripts in the "background" that each have a 10 second sleep in them. You will find that they will complete in less than 20 seconds.

Again, how do you distinguish parallel from background?

Last edited by kahuna; 08-16-2007 at 01:27 PM.. Reason: clarify "same time" vs concurrent
# 12  
Old 08-16-2007
hey kahuna,

even if u do have single processor , you can divide the process between the both scripts......but i really dun't know how to achive this.....by fork() or some other methods.
Smilie

Any body help me out.
# 13  
Old 08-16-2007
Quote:
Originally Posted by manas_ranjan
even if u do have single processor , you can divide the process between the both scripts
That is exactly what the "&" does. It creates a new process so that processor time is allocated to the new process along with the existing processes.

Since this is "not homework", perhaps it would be better if we concentrate on exactly what you are trying to accomplish. Exactly what are you trying to do?
# 14  
Old 08-16-2007
hey kahuna,

please note that i would like to accomplish that, a.sh and b.sh should run at single time....not a fracton of sec delay.....
 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question