Μνήμη και εκτελέσιμο.

Aggelos Economopoulos aoiko at cc.ece.ntua.gr
Mon Jun 2 23:13:01 EEST 2003


On Monday 02 June 2003 22:22, V13 wrote:
> On Monday 02 June 2003 21:31, Aggelos Economopoulos wrote:
> > On Monday 02 June 2003 18:27, V13 wrote:
> > > On Monday 02 June 2003 12:21, Nikos Kanellopoulos wrote:
> > > > Για να τρέξει πρέπει να φορτωθεί στη μνήμη.
> > > > Άρα χρειάζεται τουλάχιστον τόση μνήμη όσο το
> > > > μέγεθος του αρχείου.
> > >
> > > [1] Eikoniki VM == pseytiki VM giati sto linux mporeis na'xei "used VM"
> > > perissoteri apo tin "available VM" :)
> >
> > E, twra apla gia na to psirisoume ligo, ennoeis oti paradosiaka sta unix
> > mporeis na exeis perissoterh apo thn physically-backed vm kai oxi apo thn
> > vm[0]. Kai nai, auto einai problhma stis 32-bit arxitektonikes, giati den
> > se afhnei na kaneis kataxrhsh tou mmap() kai etsi na aplopoihseis polu
> > tous algorithmous tou programmatos sou. Nai, skeptomai polu sugkekrimenh
> > periptwsh ;-)
>
> Oxi :) enoo to /proc/sys/vm/overcommit_memory:
>
> =====
> overcommit_memory:
>
> This value contains a flag that enables memory overcommitment.
> When this flag is 0, the kernel checks before each malloc()
> to see if there's enough memory left. If the flag is nonzero,
> the system pretends there's always enough memory.
>
> This feature can be very useful because there are a lot of
> programs that malloc() huge amounts of memory "just-in-case"
> and don't use much of it.
>
> Look at: mm/mmap.c::vm_enough_memory() for more information.
> =====
>
> to opoio prepei na'nai 100% linux specific...

(eimai arketa kourasmenos, opote an kati apo ta parakatw den bgazei nohma, 
skounthste me diakritika kai 8a tsakistw na dieukrinisw (*yawn* - mallon 
aurio))

to overcommit == 1 den einai kanena kainourgio feature, einai h default 
sumperifora tou linux edw kai xronia. einai h Eukolh Lush (tm). Den einai h 
epi8umhth sumperifora kai oi address space accounting @@ies(interface stis 
opoies einai to /proc/sys/vm/overcommit_memory) tou Cox auto akribws exoun 
san stoxo. auto pou perigrafeis sto mail sto opoio apanthsa (fainetai pws) 
einai to overcommit == 1 to opoio 8ewrhtika (den nomizw oti endiaferei 
kanenan h gnwmh mou gia to 8ema :-)) einai Bad Thing.

to overcommit == 2 apla den douleuei akoma. des sto telos tou 
Documentation/vm/overcommit-accounting:

To Do
-----
o	Account ptrace pages (this is hard)

kai to e3hs sxolio tou alan cox sthn vm_enough_memory():
		/*
		 * The code below doesn't account for free space in the
		 * inode and dentry slab cache, slab cache fragmentation,
		 * inodes and dentries which will become freeable under
		 * VM load, etc. Lets just hope all these (complex)
		 * factors balance out...
		 */

uparxei kai h periptwsh na anaferosoun sto overcommit == 0, alla tote apla den 
mporw na katalabw pros ti o en8ousiasmos :-)

Se ka8e periptwsh, den mporeis na exeis perissoterh virtual memory apo to 
virtual address space sou, to opoio se 32bit arxitektonikes periorizetai sta 
4GB kai apo auta prepei na afaireseis arketa mappings pou ta exeis 8es den 
8es.

Auto loipon pou eipa me aformh thn parathrhsh sou einai oti kai autos o 
teleutaios periorismos mporei na einai enoxlhtikos giati se anagkazei na 
eisai prosektikos sth xrhsh tou virtual address space kai den einai duskolo 
na fantasteis mia test case[0] sthn opoia, anti8eta me thn sunh8ismenh 
periptwsh, xtupas to deutero orio[1] prin to prwto.

[0] clue: to map_size gia ena arxeio mporei na einai >> tou mege8ous tou 
arxeiou
[1] gia na mhn milhsoume gia external fragmentation



More information about the Linux-greek-users mailing list