0

I used the below code:

import time


def create_square(num):
    time.sleep(5)
    return num * num


create_square(12)
create_square(12)
create_square(12)

In task manager, why does it show 4 threads ?

enter image description here

1 Answer 1

1

It shows how many threads your interpreter has, not how many threads are there in your code.

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

2 Comments

Can you please elaborate your answer, why does the interpreter needs 4 threads ?
I'm not familiar with python interpreter's code to tell you anything smarter other than the number of threads you see in process manager is the number of threads interpreter uses. If you want more detailed answer you'll have to dig into cpython.

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.