Professional Web Applications Themes

mmap vs read/write - UNIX Programming

if one process access a file using mmap() and other through read/write system calls what inconsistencies may arise? thanx and regards........

  1. #1

    Default mmap vs read/write

    if one process access a file using mmap() and other through
    read/write system calls what inconsistencies may arise?

    thanx and regards.....
    junky_fellow Guest

  2. #2

    Default Re: mmap vs read/write

    In article <google.com>,
    co.in (junky_fellow) wrote:
     

    More homework?

    --
    Barry Margolin, mit.edu
    Arlington, MA
    *** PLEASE post questions in newsgroups, not directly to me ***
    Barry Guest

  3. #3

    Default Re: mmap vs read/write

    Barry Margolin <mit.edu> wrote in message news:<ash.giganews.com>... 
    >
    > More homework?[/ref]

    i am newbie to unix. Before putting this question i had
    a lots of discussion with my friends. i also searched on "google".
    but didn't get any satisfactory answer.
    Any hints will be highly appreciated....
    thanx in advance....
    junky_fellow Guest

  4. #4

    Default Re: mmap vs read/write

    On 2004-03-01, junky_fellow <co.in> wrote: 
    >>
    >> More homework?[/ref]
    >
    > i am newbie to unix. Before putting this question i had
    > a lots of discussion with my friends. i also searched on "google".
    > but didn't get any satisfactory answer.
    > Any hints will be highly appreciated....
    > thanx in advance....[/ref]

    Read man mmap. Then read man 2 write. On Linux, these specify that any
    reads that happen after write shall return the data written. If mmap was
    done with MAP_SHARED option then reading/writing that memory is
    equivivalent of using read/write calls. So no inconsistencies shall
    arise. Just make sure that there are no race conditions.

    (I might be wrong here, but I believe that write and read calls
    internally use the same mmap.)

    Andrei
    Andrei Guest

  5. #5

    Default Re: mmap vs read/write

    In article <google.com>,
    co.in (junky_fellow) wrote:
     
    > >
    > > More homework?[/ref]
    >
    > i am newbie to unix. Before putting this question i had
    > a lots of discussion with my friends. i also searched on "google".
    > but didn't get any satisfactory answer.
    > Any hints will be highly appreciated....
    > thanx in advance....[/ref]

    I think the answer is system-dependent. On systems where file buffers
    are integrated with the virtual memory system, there shouldn't be any
    more inconsistencies between mmap() and read/write than you would have
    between processes using shared memory. If it's a single-processor
    system there shouldn't be any inconsistencies then; on multi-processor
    systems it depends on whether they implement cache-synchronization.

    On systems without an integrated file system buffer, there's a system
    call that forces a mapped memory to be written to the filesystem (I
    can't remember the name of the system call). Until you call this, they
    can be inconsistent.

    --
    Barry Margolin, mit.edu
    Arlington, MA
    *** PLEASE post questions in newsgroups, not directly to me ***
    Barry Guest

Similar Threads

  1. How to write and read data to and from .flv
    By e-WideWeb in forum Macromedia Flash Flashcom
    Replies: 5
    Last Post: October 17th, 07:27 AM
  2. Can't read/write to Registry
    By Nikolay Petrov in forum ASP.NET Web Services
    Replies: 10
    Last Post: December 3rd, 10:14 PM
  3. To can write with asp page and read to all
    By in forum ASP.NET Security
    Replies: 0
    Last Post: March 1st, 10:44 AM
  4. File system get auto change from read-write to read-oly
    By RC in forum Linux / Unix Administration
    Replies: 1
    Last Post: October 23rd, 10:51 PM
  5. Read & Read/Write Groups
    By Damien Harrod in forum Sun Solaris
    Replies: 1
    Last Post: July 22nd, 01:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139