-2

I have two python scripts, both of whom i need to start at exactly the same time

This is because i am trying to measure performance metrics of both the scripts and it is a compulsory requirement of the task at hand that both of them should have started their execution at the same time

Is there a trivial way to do this?

Preferably through a third python script, which executes them both at the same time ?

5

2 Answers 2

0

It depends on what precision you mean with "exactly the same time".

If that means "within a microsecond", then it is probably not possible.

But it I write a script like this (assuming a POSIX operating system):

python a.py >/dev/null &
python b.py >/dev/null &

And run that with /usr/bin/time sh together.sh, the output is:

    0.00 real         0.00 user         0.00 sys

So that means that both python instances have started in less than 0.01 seconds.

Sign up to request clarification or add additional context in comments.

Comments

-1

I think you mean you want to open two python files at the same time? Just CTRL click them so that they are both selected and then press ENTER or right click --> open hope that helps

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.