LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-15-2009, 01:02 PM   #1
sank1800
LQ Newbie
 
Registered: Feb 2009
Posts: 11

Rep: Reputation: 0
starting multiple processes at the same time


Hi,

I want to start 2 linux processes at the exact same time. The only way I can think of is to use cron and schedule both at the same time. However then to test that I have to wait till cron starts.

Is there any other way to do this manually?

Thanks
 
Old 09-15-2009, 02:38 PM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Quote:
I want to start 2 linux processes at the exact same time.
How to do this (if it is possible at all) depends on your definition of "exact".
So, please define it.
 
Old 09-15-2009, 03:43 PM   #3
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by sank1800 View Post
Hi,

I want to start 2 linux processes at the exact same time. The only way I can think of is to use cron and schedule both at the same time. However then to test that I have to wait till cron starts.

Is there any other way to do this manually?

Thanks
Most version of Linux are not RTOS's (real-time operating systems). So you cannot cause two or more processes to start and run at the same time. But you can get processes to run in reasonable synchrony, like this:

process1 &
process2 &
process3 &

This is best done in a shell script. The '&' symbol makes each process run in the background, which frees the shell to accept more commands.
 
Old 09-15-2009, 04:46 PM   #4
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Quote:
Most version of Linux are not RTOS's (real-time operating systems). So you cannot cause two or more processes to start and run at the same time. But you can get processes to run in reasonable synchrony, like this:
You are quite right to suggest putting the process into the background, but sank1800 hasn't yet defined his interpretation of "exact".

"Exact" with absolute synchronicity: - you'd need two CPUs and some fancy machine-code footwork: Disable all interrupts, wait for the flag.... GO! But even then there will still be be microsecond discrepancies. [ You could search on machine code race conditions ] if you wish to understand more.

"Exact" with approximate synchronicity, you could do a bash script as above, but you might be out by a second or more, depending on the CPU load (which, unless you choose to define it, is going to be unpredictable).

What, exactly is sank1800 trying to start at "exactly the same time" ?

And why?

Then maybe we can help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using 'time' command with multiple background processes jiffydude Linux - Newbie 5 09-09-2008 09:16 PM
starting processes on startup Henster Linux - Newbie 2 06-28-2005 01:12 PM
Multiple threads vs Multiple processes deveraux83 Programming 1 05-11-2005 11:22 AM
Many processes are starting in Linux r_213 Linux - Networking 6 11-18-2004 02:22 PM
Starting Processes baldurkn Linux - Newbie 2 06-28-2003 08:08 PM


All times are GMT -5. The time now is 06:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration