public inbox for linux-newbie@vger.kernel.org
 help / color / mirror / Atom feed
From: <stackframe@charter.net>
To: linux-newbie@vger.kernel.org
Subject: No copy on write system call?
Date: Mon, 21 Mar 2005 22:38:51 -0600	[thread overview]
Message-ID: <3rr9ri$pii5sp@mxip18a.cluster1.charter.net> (raw)

How is it that a write (man 2 write) can be passed a buffer 
that exceeds most of the physical and virtual memory on a 
system and work successfully?

I wrote a simple program that allocates a large buffer on 
the heap, zeros the space and then calls write 
(man 2 write).  Even though the buffer is almost as large 
as physical memory + page space the call completes without 
error.  In my example I allocated 705MB on a system that 
has 256MB physical and 512MB virtual.  When it completes 
there is a 705MB file on disk as expected.

So is it in the case of the sys_write that the memory is 
accessed and allowed to page fault as needed while running 
in the context of the kernel?  Most of the kernel books 
talk about using copy_from_user on system calls before
using memory from the user.  Strace shows one write 
call with the entire length.

So what is going on to allow this to happen?

Thanks,
Tony

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

                 reply	other threads:[~2005-03-22  4:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='3rr9ri$pii5sp@mxip18a.cluster1.charter.net' \
    --to=stackframe@charter.net \
    --cc=linux-newbie@vger.kernel.org \
    /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