3 ms·
Threads aren't particularly low-level; they're more like a mid-level concurrency abstraction. The whole point of a thread is that you get to use abstractions (
by nostrademons 9y ago
Threads aren't particularly low-level; they're more like a mid-level concurrency abstraction. The whole point of a thread is that you get to use abstractions (like semicolons, variable access, function calls, and program stacks) that are familiar from sequential programming in a concurrent setting.
At the machine level, these are all done with interrupts, shared memory, CAS & LL/SC instructions, and memory barriers, which actually tend to map more closely to the event model.
In the middle, there's a whole family of concurrent data structures - semaphores, producer/consumer queues, mutexes, transactions, etc. - which really are worth learning about.