I have the below python code. When I execute the code, it always displays only "End of the program!". But the print statement coded in both the definitions are not printed. is it because of multiprocessing.Process ?
Note: I am running this code in my personal laptop(tried in both Jupyter notebook as well as Spyder)
import multiprocessing
def print_cube(num):
aa1 = num * num * num
print("Cube: ", aa1)
def print_square(num):
bb1 = num * num
print("Square: ", bb1)
def main():
# creating processes
p1 = multiprocessing.Process(target=print_square, args=(10, ))
p2 = multiprocessing.Process(target=print_cube, args=(10, ))
# starting process 1
p1.start()
# starting process 2
p2.start()
# Assumed both processes are finished
print("End of the program!")
main()
p1.join(); p2.join(); print("End of the program!")?