page cache , process map issues

From: Tolga Evren (tolgae_at_paro.com.tr)
Date: 09/22/05

  • Next message: Clark, Patricia: "Errata and update releases"
    Date: Thu, 22 Sep 2005 11:09:50 +0300
    To: <redhat-list@redhat.com>
    
    

    Hi Gurus ,

     

    I need to understand the interaction between the page cache (which is
    used for file systemn data cache) , and virtual memory map of a process
    which uses data from the cache.

     

    Where does the pages which are read from the disk is mapped inside a
    process?

     

    Imagine a simple c program:

     

         char *buf;

         buf = (char *)malloc(1000);

     

    This buf is allocated inside the heap , or in detail it is first
    reserved (in swap file) ,and on demand , it is allocated (inside the
    phy.ram)

     

         Then imagine that the code has the following line:

      

         *buf = 65 ;

     

    So i modifed the contents the buffer.

     

    As far as i know , if the pages which are modified like this , needs to
    be written to the swap disk in order to be reused again .

    So if these pages pageout by the os , they are written to the swap
    file.

     

          Now consider that ,i start to read data files by using read ,or
    readv or pread system calls. ( readv and pread are the io calls which
    oracle or other database systems uses on unix)

     

           

    fdes=open("/data/spss/x1.dat",O_RDONLY);

     

    while (fdes)

    {

     printf("%d\n",read(fdes, buf,sz));

    }

     

    I wonder how things happen now.

    How the data blocks which are cached inside the page cache mapped to the
    process?

    If the file is read first time by this process , the file must be read
    from the disk. Then the blocks are cached inside the page cache. The
    page cache has no backing storage inside the swap file ,

    but instead it is directly mapped from the data file itself.

    (Is this correct?)

     

    When my process reads data from the disk , then does the page that is
    inside the page cache copied into the process map ? Or is it shared and
    no copy takes place?

     

    Kind Regards,

    tolga

    -- 
    redhat-list mailing list
    unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
    https://www.redhat.com/mailman/listinfo/redhat-list
    

  • Next message: Clark, Patricia: "Errata and update releases"

    Relevant Pages

    • page cache - process memory - disk read
      ... used for file systemn data cache), and virtual memory map of a process ... which uses data from the cache. ... So if these pages pageout by the os, they are written to the swap ...
      (linux.redhat)
    • process memory and page cache clarification is needed
      ... used for file systemn data cache), and virtual memory map of a process ... which uses data from the cache. ... So if these pages pageout by the os, they are written to the swap ...
      (comp.unix.solaris)
    • PROBLEM: sata_sil24 lockups under heavy i/o
      ... a total of 4) and started heavy i/o (extending a software raid5 device) ... system recovers the disk transfer speed is reduced from UDMA/100 to ... Cache Line Size: 32 bytes ... parport_pc: Current parallel port base: 0x378 ...
      (Linux-Kernel)
    • Re: Scheduler: Process priority fed back to parent?
      ... Mac OS X has a special cache ... on disk of things that get loaded on boot. ... >>initial priority is a guess, and isn't set until the priority info has ... This prefetch activity could be turned on/off ...
      (Linux-Kernel)
    • Re: Spyware in Content.IES
      ... Cleaner to clean the TIFs at boot and once in a while, ... I have Disk Cleaner set to run quiet at startup. ... Temporary Internet Files ... Firefox Cache ...
      (microsoft.public.windowsxp.security_admin)