Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7819855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:05:37+00:00 2026-06-02T07:05:37+00:00

Say a process is forked from another process. In other words, we replicate a

  • 0

Say a process is forked from another process. In other words, we replicate a process through the fork function call. Now since forking is a copy-on-write mechanism, what happens is that whenever the forked process or the original process write to a page, they get a new physical page to write. So what I’ve understood, things go like this when both forked and original processes are executing.

–> when forking, all pages of original and forked process are given read only access, so that the kernel get to know which page is written. When that happens, the kernel maps a new physical page to the writing process, writes the previous content to it, and then gives the write access to that page. Now what I am not clear about is if both fork and original process write to the same page, will one of them will still hold the original physical page (prior to forking that is) or both will get new physical pages. Secondly, is my assumption correct that all pages in forked and original process are given read only access at time of forking?

–> Now since each page fault will trigger an interrupt, that means each write to original or forked process will slow down execution. Say if we know about the application, and we know that alot of contiguous memory pages will be written, wouldn’t it be better to give write permission to multiple pages ( a group of pages lets say ) when one of the page in the group is written to. That would reduce the number of interrupts due to page fault handling. Isn’t it? Sure, we may sometimes make a copy unnecessarily in this case, but I think an interrupt has much more overhead than writing 512 variables of type long (4096 bytes of a page). Is my understanding correct or am I missing something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T07:05:39+00:00Added an answer on June 2, 2026 at 7:05 am

    If I’m not mistaken, one of the processes will be seen as writing to the page first. Even if you hae multiple cores, I believe the page fault will be handled serially. In that case, the first one to be caught will de-couple the pages of the two processes, so by the time the second writes to it, there won’t be a fault, because it’ll now have a writable page of its own.

    I believe when that’s done, the existing page is kept by one process (and set back to read/write), and one new copy is made for the other process.

    I think your third point revolves around one simple point: “Say if we know about the application…”. That’s the problem right there: the OS does not know about the application. Essentially the only thing it “knows” will be indirect, through observation by the kernel coders. They will undoubtedly observe that fork is normally followed by exec, so that’s the case for which they will undoubtedly optimize. Yes, that’s not always the case, and you’re obviously concerned about the other cases — all I’m saying here is that they’re sufficiently unusual that I’d guess little effort is expended on them.

    I’m not quite sure I follow the logic or math about 512 longs in a 4096 byte page — the first time a page is written, it gets duplicated and decoupled between the processes. From that point onward, further writes to either process’ copy of that page will not cause any further page faults (at least related to the copy on write — of course if a process sites idle a long time that data might be paged out to the page file, or something on that order, but it’s irrelevant here).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run elevated process, say, file_copier.exe, from another host process with ShellExecuteEx
Let's say I want to implement a function that is supposed to process an
Is malloc deterministic? Say If I have a forked process, that is, a replica
Say we have an existing process (or application) that calls a COM object from
Say I have a data file that I want to process; I want to
Lets say that I'm trying to create a new process with the following code:
Let's say you had an external process writing files to some directory, and you
I need to process messages in batches, lets say of 10. After 10 transactions
I am trying to dump a process, say calc.exe When I run my program
I need to kill windows explorer's process (explorer.exe), for that lets say i use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.