ADVERTISEMENT
ADVERTISEMENT

Python program to illustrate multithreading

Here, we are going to learn about the multithreading in Python, demonstrating the multithreading using a Python program.
Submitted by Shivang Yadav, on February 19, 2021

Multithreading is executing multiple threads concurrently by the processor.

In programming, a process can have two or more threads.

Here, we will see a program to create multiple threads in python

Python program to show the working of multithreading

import threading

def ProcessOne():
    while(True):
        print("Process One")
def ProcessTwo():
    while(True):
        print("Process Two")

T1=threading.Thread(target=ProcessOne)
T2=threading.Thread(target=ProcessTwo)

T1.start()
T2.start()

Output:

Process One
Process Two
...
...

Python Threading Programs »



ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.