7 ms·
> The parent context asked what code could have 40 cores spinning, I picked the first example I could think of. Hmmm... okay. I think I see what you're going f
by dragontamer 8y ago
> The parent context asked what code could have 40 cores spinning, I picked the first example I could think of.
Hmmm... okay. I think I see what you're going for. I think its a bit of a muddy example though because of the mutex.
But pre-mutex, there's definitely a spinlock, and the 40-cores would definitely hit that first. Mutexes themselves are likely a spinlock as well, so there's a chance (a low-chance... but a chance nonetheless) that everything is fast-pathed and never sleeps a thread.
So yeah, there are better examples you could use. But upon further analysis, it does seem like your example does work with the right frame of mind.