1 |
On Thursday 09 February 2006 01:17, Duncan wrote: |
2 |
> Simon Stelling posted <43EA568D.6020307@g.o>, excerpted below, on |
3 |
> My thinking, which is possibly incorrect (your input appreciated), is that |
4 |
> file-based scripts get pulled into cache the first time they are executed, |
5 |
> and will remain there (with a gig of memory) pretty much until I'm done |
6 |
> doing my upgrades. At the same time, they are simply in cache, not |
7 |
> something in bash's memory, so if the memory is needed, it will be |
8 |
> reclaimed. As well, after I'm done and on to other tasks, the cached |
9 |
> commands will eventually be replaced by other data, if need be. |
10 |
> |
11 |
> Aliases (and bash-functions) are held in memory. That's not as flexible |
12 |
> as cache in terms of being knocked out of memory if the memory is needed |
13 |
> by other things. Sure, that memory may be flushed to disk-based swap, but |
14 |
> that's disk based the same as the actual script files I'm using, so |
15 |
> reading it back into main memory if it's faulted out will take something |
16 |
> comparable to the time it'd take to read in the script file again anyway. |
17 |
> That's little gain, with the additional overhead and therefore loss of |
18 |
> having to manage the temp-copy in swapped memory, if it comes to that. |
19 |
|
20 |
Besides the fact that memory use is negligeable, you should keep into account |
21 |
that scripts (even oneliners) use one memory page per script. Aliasses |
22 |
however are stored by bash in a way that multiple aliases fit into one block |
23 |
of memory. And when the memory is needed, bash will be bumped out of memory |
24 |
too. But the idea is that those small aliasses will not actually need more |
25 |
memory. |
26 |
|
27 |
Paul |
28 |
|
29 |
-- |
30 |
Paul de Vrieze |
31 |
Gentoo Developer |
32 |
Mail: pauldv@g.o |
33 |
Homepage: http://www.devrieze.net |