Reputation: 52
Is there a case where process context switching is faster than thread's one? In all cases thread switching seems faster.
Upvotes: 1
Views: 323
Reputation: 52
So i got the answer of this question. (From teacher) Process Switching can be Faster than Thread Switching in 1 case When there are 2 Processes: The thread switching between two threads of two different processes is slower than Process switching between two processes
Upvotes: 0
Reputation: 698
Process context switching is more time consuming because virtual memory space is completely changed.
I'm not an expert, but I think the context switch of a thread will be always faster than context switch of a process. Perhaps you could have a small (very small) latency if the memory you'll use in the thread about-to-be context switched is not allocated/mmaped yet. However this latency is not in the context switch itself, but while thread is running. I don't really know, only a test can effectively prove it.
Upvotes: 2