Previous | Next --- Slide 10 of 58
Back to Lecture Thumbnails
gryffolyon

Thrashing here we mean thrashing of cache and memory by multiple threads which we want to avoid.

Sherry

As my understanding, N here should equal to the number of total execution contexts, otherwise the cost of switch threads would be high. Is my understanding wrong? Since in assignment 4 (there are 24 execution contexts in one machine), when I set the number of threads in the thread pool to be 36, the performance of web server is better than the performance when I set the number of threads to be 24.

gryffolyon

@Sherry you are referring to hardware execution contexts. Apart from these, OS maintain the execution contexts of multiple threads in their respective kernel stacks. The 2 are actually quite different. Hardware context switching is way faster than OS context switching. I can have way more threads than the hardware execution contexts as long as I have enough memory to support them. Hence you have 36 while the hardware execution contexts were 24. Also you saw better performance because there was always some thread available to do work and not blocked on anything

Sherry

@gryffolyon Thank you for your reply :)