shell, perl, performance, parallelism, profiling, etc.

Jerry Feldman gaf at blu.org
Wed Oct 22 14:51:12 EDT 2008


On 10/22/2008 11:34 AM, Ben Scott wrote:
> On Wed, Oct 22, 2008 at 10:12 AM, Jerry Feldman <gaf at blu.org> wrote:
>   
>> The original reason for the sticky bit is because some Unix commands are so
>> frequently used and small that keeping them in memory significantly improves
>> performance, especially in a multi-user system.
>>     
>
>   Plus (from what I've been told), older Unix systems didn't always
> have very sophisticated caching subsystems, and/or enough RAM to make
> use of such.  So the sticky bit was a way to manually tell a system to
> never unload an executable image.  Linux effectively makes that
> decision automatically.
>
>   
>> I believe from my previous research on Linux virtual memory that commands
>> will remain in virtual memory long enough to where the sticky bit is not
>> needed.
>>     
>
>   That correlates with what I read (long ago): Linux is entirely
> demand-paged, and does not implicitly commit swap space.  The
> executable file is mapped into virtual memory first.  Then the process
> starts, and immediately triggers a page fault to load the code.  Pages
> are not allocated in the swap file until the system needs to free up
> RAM for more stuff.  That's one of the reasons the kernel
> out-of-memory algorithms are of such interest.  (Again, I'm just
> repeating received wisdom; this could be wrong.)
>
>   
Unix did not have virtual memory until the early 1980s, and by that time 
each vendor had its own version. Most Unix VMs are demand paged using an 
LRU based page replacement algorithm, unlike Digital VMS which was based 
on working set size  algorithms.  In all cases you need hardware to 
support virtual memory which was not available to Unix in the 1970s 
although Unix is derived from Multics. The algorithms used by Sun's 
Unixes, Digital's and others Unix systems were all different. By the 
time Linux came out, the 386 chip had support for virtual memory with 
the LRU algorithm. The beauty of the way Linux and most Unix systems use 
VM is that read-only pages are not physically loaded until needed, and 
that data pages are not created until they are written to. And, (as has 
been the case or many years in Unix) multiple instances of the same 
executable share the same text segment. One might remember the Unix 
vfork(2) system call. Originally, the fork(2) call would clone the 
entire data segment (data abd .bss), but vfork(2) would implement a 
copy-on-write strategy. Since Linux has been virtual since inception, 
there is no difference between the vfork(2) and fork(2) system calls. 
The bottom line is that the Linux and some Unix systems have a very 
efficient virtual memory and only use the swap space when memory becomes 
tight.

Today, demand-paged virtual memory is the standard virtual memory 
implemented by most systems, but way back there were other methods of 
virtual memory, such as the older Burroughs systems.

-- 
Jerry Feldman <gaf at blu.org>
Boston Linux and Unix
PGP key id: 537C5846
PGP Key fingerprint: 3D1B 8377 A3C0 A5F2 ECBB  CA3B 4607 4319 537C 5846


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
Url : http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20081022/8626ca58/attachment.bin 


More information about the gnhlug-discuss mailing list