What really is /dev/shm ? - Redhat

This is a discussion on What really is /dev/shm ? - Redhat ; Doing df reveals, among other things: none 2062736 0 2062736 0% /dev/shm Now presumably this has something to do with shared memory. But when I run a suite of programs that use around 8 Megabytes of shared memory (IBM's DB2 ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: What really is /dev/shm ?

  1. What really is /dev/shm ?

    Doing df reveals, among other things:

    none 2062736 0 2062736 0% /dev/shm

    Now presumably this has something to do with shared memory. But when I run
    a suite of programs that use around 8 Megabytes of shared memory (IBM's
    DB2 dbms), it remains zero here, but ipcs -m reveals lots of shared memory
    in use.

    trillian:jdbeyer[~]$ ipcs -m


    ------ Shared Memory Segments --------
    key shmid owner perms bytes nattch status
    0xa2f0b274 6127616 db2inst1 767 8525056 12

    (db2 was not actually doing anything when I ran it this time, but it is
    about the same when it is running.)

    So I do not know what the sizes here (less than 8 megabytes, for one
    thing) mean.

    --
    .~. Jean-David Beyer Registered Linux User 85642.
    /V\ Registered Machine 241939.
    /( )\ Shrewsbury, New Jersey http://counter.li.org
    ^^-^^ 09:35:00 up 2 days, 19:00, 4 users, load average: 4.41, 4.25, 4.19


  2. Re: What really is /dev/shm ?

    Jean-David Beyer wrote:
    > Doing df reveals, among other things:
    >
    > none 2062736 0 2062736 0% /dev/shm
    >
    > Now presumably this has something to do with shared memory. But when I run
    > a suite of programs that use around 8 Megabytes of shared memory (IBM's
    > DB2 dbms), it remains zero here, but ipcs -m reveals lots of shared memory
    > in use.


    Hi J-D. I seem to remember that people gave up trying to account shared
    memory accurately in the kernel (and anyway, it would be counting shared
    pages, shared libs, etc., but not necessarily sysv shmem).

    Peter

  3. Re: What really is /dev/shm ?

    Jean-David Beyer wrote:

    > Doing df reveals, among other things:
    >
    > none 2062736 0 2062736 0% /dev/shm
    >
    > Now presumably this has something to do with shared memory. But when I
    > run a suite of programs that use around 8 Megabytes of shared memory
    > (IBM's DB2 dbms), it remains zero here, but ipcs -m reveals lots of
    > shared memory in use.


    Linux supports two shared memory APIs: POSIX and SysV. /dev/shm is used
    for POSIX shared memory and ipcs reports SysV shared memory statistics.

    --
    Markku Kolkka
    markku.kolkka@iki.fi

  4. Re: What really is /dev/shm ?

    Markku Kolkka wrote:
    > Jean-David Beyer wrote:
    >
    >
    >>Doing df reveals, among other things:
    >>
    >>none 2062736 0 2062736 0% /dev/shm
    >>
    >>Now presumably this has something to do with shared memory. But when I
    >>run a suite of programs that use around 8 Megabytes of shared memory
    >>(IBM's DB2 dbms), it remains zero here, but ipcs -m reveals lots of
    >>shared memory in use.

    >
    >
    > Linux supports two shared memory APIs: POSIX and SysV. /dev/shm is used
    > for POSIX shared memory and ipcs reports SysV shared memory statistics.
    >

    I do not see how it can be different APIs unless each API has a different
    implimentation underneath. If that is the case, there is a reduncancy
    there that should (with low priority, I will agree) be removed. The API
    hides the implimentation from the programmer, but to have two
    implimentations seems excessive.

    Do I understand you correctly?

    --
    .~. Jean-David Beyer Registered Linux User 85642.
    /V\ Registered Machine 241939.
    /( )\ Shrewsbury, New Jersey http://counter.li.org
    ^^-^^ 21:45:00 up 3 days, 7:10, 8 users, load average: 2.17, 2.10, 2.07


  5. Re: What really is /dev/shm ?

    Jean-David Beyer writes:
    >Markku Kolkka wrote:
    >> Jean-David Beyer wrote:
    >>
    >>
    >>>Doing df reveals, among other things:
    >>>
    >>>none 2062736 0 2062736 0% /dev/shm
    >>>
    >>>Now presumably this has something to do with shared memory. But when I
    >>>run a suite of programs that use around 8 Megabytes of shared memory
    >>>(IBM's DB2 dbms), it remains zero here, but ipcs -m reveals lots of
    >>>shared memory in use.

    >>
    >>
    >> Linux supports two shared memory APIs: POSIX and SysV. /dev/shm is used
    >> for POSIX shared memory and ipcs reports SysV shared memory statistics.
    >>

    >I do not see how it can be different APIs unless each API has a different
    >implimentation underneath. If that is the case, there is a reduncancy
    >there that should (with low priority, I will agree) be removed. The API
    >hides the implimentation from the programmer, but to have two
    >implimentations seems excessive.


    There are two separate source API's:

    1) system V shared memory (shmat, shmdt, shmop, shmctl)
    2) Posix shared memory (shm_open, mmap, shm_unlink).

    All Unix(tm) systems (Open Group's Single Unix Specification) must
    support (1), and (2) is optional. New applications should be
    written to (2), if supported by the OS implementation.

    /dev/shm is there to help implement shm_open(2).

    scott


  6. Re: What really is /dev/shm ?

    Jean-David Beyer wrote:
    > Markku Kolkka wrote:
    >> Linux supports two shared memory APIs: POSIX and SysV. /dev/shm is
    >> used for POSIX shared memory and ipcs reports SysV shared memory
    >> statistics.


    A slight correction, actually both interfaces are included in the Single
    Unix Specification (a.k.a. POSIX). The SysV-derived interface is part
    of the XSI Interprocess Communication extension of the standard and
    uses the shmat(), shmctl(), shmdt() and shmget() functions. The second
    API is part of the POSIX realtime extension and has the functions
    shm_open() and shm_unlink().

    > I do not see how it can be different APIs unless each API has a
    > different implimentation underneath. If that is the case, there is a
    > reduncancy there that should (with low priority, I will agree) be
    > removed.


    First you need to convince the programmers to convert all existing
    applications to use one API, then you need to change the Single Unix
    Specification standard, and then you might be able to drop the obsolete
    API after a suitable transition period. Want to spend the next 10 years
    on this?

    --
    Markku Kolkka
    markku.kolkka@iki.fi

  7. Re: What really is /dev/shm ?

    On Sat, 12 Jun 2004 02:35:57 +0300, Markku Kolkka
    wrote:

    >First you need to convince the programmers to convert all existing
    >applications to use one API, then you need to change the Single Unix
    >Specification standard, and then you might be able to drop the obsolete
    >API after a suitable transition period. Want to spend the next 10 years
    >on this?


    Wasn't the question as to why the two API's apparently weren't using
    the same memory for the implementation, rather than why there were two
    API's?

    Now you've got me curious, not that you care but.....

+ Reply to Thread