VM: killing process X
ricudis at itc.auth.gr
ricudis at itc.auth.gr
Fri May 28 23:38:11 EEST 2004
> On Friday 28 May 2004 16:44, Christos Ricudis wrote:
>> To senario einai poly syxnotero apo oti fantazesai. Me opoiadhpote
>> logikh kai na prospa8hseis na dialekseis TI 8a skotwseis,
>> exeis megalh pi8anothta na skotwseis kapoio entelws asxeto process.
>>
> apo to man page tis malloc :):
>
> -----
> void *malloc(size_t size);
>
> For calloc() and malloc(), the value returned is a pointer
> to the allocated memory, which is suitably aligned for any
> kind of variable, or NULL if the request fails.
> -----
>
> Opote to mono poy menei einai o kernel na min kanei tipote oste
> opoiodipote programma elegxei to apotelesma ton malloc() poy kanei
> na min kindinevei na skotothei (Ta ypoloipa tha trone sigsegv)...
> To mono poy xreiazetai einai
> ena
> echo 1 > /proc/sys/vm/overcommit_memory
> h
> echo 2 > /proc/sys/vm/overcommit_memory
>
> Apla epidi ayto den to kanei sxedon kanenas (including me), yparxei
> (ypirxe) o oom killer... Tora, to oti kindinevei na soy skotosei
> ton sshd kai na s'afisei ekso apo to mixanima, einai ena allo thema.
Lypamai kyrie Stefane alla mallon to ma8hma twn leitourgikwn systhmatwn to
dinate Iounio kai sas eixe piasei h anoiksh (ta poylakia poy kelahdane, oi
petalouditses poy phdiountai apo louloudaki se louloudaki ktl).
Otan kanw malloc() exw 2 pi8anothtes :
1) pairnw ena pointer pou deixnei se allocated mnhmh
2) pairnw ena null pointer.
Akoma kai sthn periptwsh poy DEN elegksw to apotelesma ths malloc, me to
poy 8a paw na grapsw ston null pointer (case 2) 8a faw sigsegv 8elw de
8elw. Sthn periptwsh 1) den 8a prepe na yparxei problhma outws h allws.
Bebaia h malloc() den einai o monos tropos na desmeyseis mnhmh. Thn
malloc() thn elegxeis. Den yparxei omes kanenas tropos na elegkseis an to
epomeno function call poy 8a kaneis 8a apotyxei epeidh den yparxei xwros
gia akoma ena stack frame. Fysika kai s'ayth thn periptwsh 8a fas sigsegv.
To overcommit xrhsimeyei sthn periptwsh programmatwn poy kanoyn allocate
mnhmh kai pote den grafoun s'ayth. 8a'8ela na dw ena paradeigma
pragmatikou programmatos poy kanei kati tetoio. To prwto pragma poy
moyrxetai sto myalo einai sparse matrix handling, alla etsi ki alliws otan
kaneis allocate mnhmh ypoti8etai oti pairneis zero pages - den desmeyetai
mnhmh mexri na kaneis to prwto write se mia selida.
O OOM handler grafthke gia na kanei kati diaforetiko. To problhma den
einai kapoios o opoios zhtaei ksafnika pollh mnhmh. To problhma einai
kapoios poy zhtaei ligh ligh mnhmh, me thn diestrammenh elpida oti 8a
ftasei to systhma se tetoio starvation poy 8a arxisei na skotwnei ASXETA
processes poy prospa8oun ta kahmena na xwresoun kapou ta ftwxa, amoira
dedomena tous. To pragmatiko problhma einai oti 8ewrhtika einai adynaton
na breis ton offender.
Praktika opws toxoume ksanapei, o offender einai synh8ws o mozilla :P
More information about the Linux-greek-users
mailing list