by miraculixx · 3y ago · 0 comments
I am perfectly aware that threads are not free.
Just as I am perfectly aware that a context switch between threads is less expensive that switching a new process onto the core, and that IPC requires kernel involvement.
But the overhead of a context switch for a thread and process is very similar. The main difference is whether memory is shared by default.
Except that the threads share the exact same virtual address space, and processes do not, which makes the thread context switch faster.
And that is to say nothing about the setup and teardown process, which for a process involves copy-on-demand'ing the entire memory, but for a thread merely setting up its own stack.
That's what I said. But it's really not much. I'm afraid we will need numbers now to continue the conversation. If I measured would you be open to changing your opinion? Or are you committed to this topic, so that it would have no bearing?