B
B
beduin012017-10-08 12:26:03
Programming
beduin01, 2017-10-08 12:26:03

What happens when a new thread is created?

Everywhere they say that this is an expensive operation. Why? What is happening at this moment? And why does it take so long?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
res2001, 2017-10-08
@res2001

The OS allocates memory for structures describing the thread, allocates the thread stack, and adds the thread to the scheduler.
All this takes both CPU time and memory, so every thread is not free. Much or little time/memory is, of course, relative. Concerning those tasks which the flow will solve.

X
xmoonlight, 2017-10-08
@xmoonlight

Rave.
Most processors now support Hyper-Threading: X cores = 2X threads. Therefore, do not use the power, forcing them to stand idle - I do not see it as rational.
Reading for understanding.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question