From the course: Python Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Multiprocessing

Multiprocessing

- [Instructor] You're probably great at multi-processing and Python already and don't even know it. Here, I'll show you. I have a file called 1000seconds.py. All it does is call time.sleep for a thousand seconds. So I'm going to open a second tab and run it in the second tab. So now we have two tabs running this program. Great. Two Python processes running independently on my machine, multi-processing, and Python. All right, so that's how you do that, onto the next subject then. Just kidding. Yes, I do have two separate Python processes running but I had to start them by hand. How do we write a program to start, stop, and manage these for us? Well, conveniently, there's a module that's very similar to the threading module we used previously. Let's check it out. And that module is called multi-processing. From multiprocessing import Process. Okay, so before I run this, there is a small hitch with using the official…

Contents