Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

I am trying to understand threading in Python. I've looked at the documentation and examples, but quite frankly, many examples are overly sophisticated and I'm having trouble understanding them.

How do you clearly show tasks being divided for multi-threading?

1 Answer

0 votes
by (106k points)

By using the below-mentioned code you can use threading in Python. If you want to benefit from multiple cores for CPU-bound tasks, use multiprocessing:

from multiprocessing import Process 

def f(name): 

print 'hello', name 

if __name__ == '__main__': 

p = Process(target=f, args=('bob',)) 

p.start() 

p.join()

To know more about this you can have a look at the following video tutorial:-

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
4 answers
0 votes
1 answer

Browse Categories

...