top

V13 v13 at priest.com
Thu Sep 18 00:06:39 EEST 2003


On Wednesday 17 September 2003 14:13, Antonis Sidiropoulos wrote:
> Mia pou efere i koubenta prin sxetika me to top:
> Ti akribws einai to cached memory kai buffered memory pou dixnei?
>
> Ypothetw oti to cache einai h klasiki cache tou file system
> kai to buffered einai to synolo twn buffers pou exoun oi diafores
> processes (pou prokyptoun apo printf kai tetoia, pou pernoun apo buffer).

Oxi.. Ta stixia poy blepeis stin free einai toy kernel. Oi buffers poy 
anafereis gia ta processes (tis printf klp) ylopoioyntai meso tis glibc kai 
einai 
a) proeretikoi (sxetiko ayto), 
b) user-level / per-process

Ta parakato mporei na einai anakribi:

Oi buffers einai ta raw blocks poy diabazei apo toys diskoys. An p.x. baleis 
mesa ena CD kai to diabaseis olo sector by sector oi buffers soy tha 
ayksithoyn.

H cache xorizetai se 2: Sthn 'geniki' cache kai sthn swap cache.

H 'geniki' cache exei na kanei me arxeia pleon kai oxi me raw blocks. 

H swap cache einai h cache toy swap. Otan yparxoyn dedomena mesa sto swap ta 
opoia yparxoyn kai stin mnimi kai DEN einai 'dirty' (se polla eisagogika 
ayto) (diladi otan ston disko kai sti mnimi exei akribos ta idia), tote h 
mnimi ayti onomazetai swap cache kai einai apla boithitiki.. mporei na 
apodesmeytei xoris deyteri skepsi.

=====

Stin praksi tora... (poio low-level) 

Min nomiseis oti paei disk -> buffers -> cache -> user....

Paei disk -> cache/buffers -> user

Otidipote diabazeis apo to disko einai cache/buffers... (ston kernel 
onomazetai page cache)

Oti exei na kanei me to swap einai swapcache. 

Oti exei na kanei me arxeia, opos read, mmap klp klp onomazetai cache. 
Stin cache apothikevontai kai alla pragmata opos h cache gia ta inodes, ta 
dirs k.a. (Den ksero pia akribos, alla nomizo einai otidipote thelei na kanei 
kapoioy eidoys caching)

=====

one more time:

Otan diabazeis kati apo to disko einai page cache gia ton kernel kai 
taytoxrona kai buffers. An prokeitai gia file read h kati allo to opoio kanei 
caching (ektos apo raw block i/o) to metonomazei se cache.

p.x:
* An kaneis dd if=/dev/hda of=/dev/null tote h cache soy den tha alaksei 
katholoy eno oi buffers soy tha ayksithoyn. 
* An kaneis cat /vmlinuz > /dev/null tote tha megalosei h cache soy.

An deis to linux/fs/proc/proc_misc.c ayta poy anaferei to /proc/meminfo einai:

buffers: i.bufferram,
cache: get_page_cache_size()-total_swapcache_pages-i.bufferram
swapcache: total_swapcache_pages

ap'opoy fainetai oti yparxei h page cache kai san cache anaferetai h 
page_cache meion tin swapcache kai toys buffers.

Gia toy logoy to alithes, sto linux/Documentation/filesystems/proc.txt leei:

(perigrafontas to /proc/meminfo)
     Buffers: Relatively temporary storage for raw disk blocks
              shouldn't get tremendously large (20MB or so)
      Cached: in-memory cache for files read from the disk (the
              pagecache).  Doesn't include SwapCached
  SwapCached: Memory that once was swapped out, is swapped back in but
              still also is in the swapfile (if memory is needed it
              doesn't need to be swapped out AGAIN because it is already
              in the swapfile. This saves I/O)

> Se ena allo omws mixanaki me 2 CPUs, koitakste:
>   4:42pm  up 1 day,  2:12,  4 users,  load average: 0.07, 0.04, 0.01
> 85 processes: 83 sleeping, 1 running, 1 zombie, 0 stopped
> CPU states:  0.1% user,  1.2% system,  0.0% nice, 98.5% idle
> Mem:  776728K av, 744988K used,  31740K free,  30936K shrd, *410828K buff*
> Swap: 1004020K av,   6008K used, 998012K free                185044K cached
>
> 410MB buffered.... Poso fysiologiko einai auto re paidia?
> kai malista se katastasi ousiastika ypnou, xwris na trexei kati sobaro,
> ektos apo
> ena http,mysql kai sendmail ...

To mixanima ayto exei poly mnimi kai den tin xrisimopoiei.. oi buffers poy 
fainontai mporei na einai etsi gia poly kairo. Mipos etrekse kanena fsck otan 
ekane boot ?

> A.
<<V13>>

p.s. Elpizo na min se mperdepsa




More information about the Linux-greek-users mailing list