mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Helge Hafting <helge.hafting@aitel.hist.no>
To: sylvanino b <sylvanino@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: questions about system function: mmap / fwrite
Date: Fri, 20 May 2005 11:35:35 +0200	[thread overview]
Message-ID: <428DAF67.70105@aitel.hist.no> (raw)
In-Reply-To: <d14685de050520021439e48c8d@mail.gmail.com>

sylvanino b wrote:

>Hello,
>
>I have a question about ways of accessing a file. 
>
>I know it is possible to use: fseek + fwrite/fread to access a file.
>and It is also possible to map file in memory with  "mmap" function,
>and access it by adressing memory.
>
>Currently I use the frame buffer of  mobile phones with mmap function.
>For my understanding, I would like to know what is the difference
>between using fseek+fwrite compared to mmap style.
>Dont hesitate to be precise or to use technical terms.
>
>Thanks you,
>  
>
There may be subtle performance differences, but I'd say the most
important here is to use the API that best suits the problem at hand.
fwrite/fread is sequential in nature, useful when you want to read/write
large contigous chunks of data, and when the notion of a "current position"
in the file is useful.

mmap is nice when you find it useful to access the file as a random-access
array of bytes. mmap style access seems to be the best fit for a 
framebuffer.

Helge Hafting

Helge Hafting


      reply	other threads:[~2005-05-20  9:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-20  9:14 sylvanino b
2005-05-20  9:35 ` Helge Hafting [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=428DAF67.70105@aitel.hist.no \
    --to=helge.hafting@aitel.hist.no \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sylvanino@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome