From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Mike Haertel" <9fans@ducky.net> To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] Install from CD fails Date: Tue, 18 Apr 2006 20:27:48 -0700 Message-Id: <20060419032748.D6264A82C@mail.cse.psu.edu> Topicbox-Message-UUID: 3e7b84f6-ead1-11e9-9d60-3106f5b1d025 >I once knew >someone who thought that a context switch was less expensive using >shared libraries than without. That could actually be true in some situations, for the following reason: if program A and B have small unshared amounts of memory, but are sharing many megabytes of libraries, potentially there are far fewer cache misses after a context switches than there would be in the case that A and B were each statically linked with their own copies of the many megabytes of libraries. However, some of this benefit is eaten by TLB misses: dynamically linked programs tend to have much more total active virtual address space than the corresponding statically linked programs that link only the code they need. And TLBs usually get flushed by context switches. So some of the savings gained by not thrashing things in and out of the cache is lost to thrashing things in and out of the TLBs. TLB misses are usually more expensive than cache misses, since a single TLB miss can spawn many cache misses.