The 81st Thread

The 81st Thread

Real basic question here (writing my first threading code) ... It saysthe test hardware is a 40 core (80 thread) machine ... what happens if your code requests the 81 thread? ... are you blocked until a tread is released? Thanks

5 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

No, the OS will go 'this thread has not had a go for a while' and switch another one off to make room.

Look up OS process scheduling. Give or take, it is the same.

@duncanhopkins thanks for the quick reply ...

now I just have more questions :-) ... if you can run more
than 80 threads at the same time, why does the description explicitly
call out a 80 thread environment (what's the point)? ... is it that the hardware can run 80
threadsconcurrently, any more threads and switching occurs?

pretty much. Each of the 40 cores can run two threads at a time (*sort of* look-up Hyper-threading). If you use 81 threads then you're not going to get improved performance (unless you're IO bound somehow) as at least 1 will always be inactive.

Slightly off topic, but be wary of the Hyper-Threading (HT).
I have done some exsperiments with the MTL last year and was finding I could get lovely scaling upto 32 threads. But as soon as I start using the HT threads I got no speed up. I also did not get any speed down, so no over head for thread context switches etc because they was not any. Which is part of the signiture of a memory bound algo.

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!