On Tue, 11 Feb 2003, Min Xu wrote: > I don't understand, if the client is blocked, it only be woke up when > the server reply is avaiable. In that case, the server should have done > it is job. In other words, the client is not spinning, it is instead > put on sleep when calling read syscall.
Of course the client isn't spinning, but your statement that "the server should have done its job" assumes that the entire response is sent at once. Depending on its length, it is entirely possible that the server would send the response in multiple packets. But as soon as *any* packets arrive, the client is woken up. That means that the server and the client are vying for timeslices. Let's say the client gets it. The client receives the partial response and then goes right back to sleep again. Sure the server wakes right back up and starts sending more of the response, but in the meanwhile, several context switches had to happen. --Cliff
