3

Consider process P that owns 10 physical frames. Suppose process P calls fork() and creates a child process Q.

How many physical frames does the child initially own, without copy-on-write? 10

How many frames does the child initially own, with copy-on-write? 0 not sure if this is a correct answer.

Thank you!

1 Answer 1

3

The forked process needs act as if it was an exact image of the parent, so without COW it would indeed own 10 frames initially.

But it can't initially own no memory of its own at all - at least one non-shared frame is necessary: fork doesn't return the same value in the parent and the child, so the page where that return value is stored cannot be shared.

In practice, there will probably be a few pages that aren't shared, the exact number will probably depend on the operating system. The only certain thing is that it can't be zero.

3
  • Where can I find more info on on how many frames frames child will get with COW? Thank you!
    – SoftDisk -
    Dec 29, 2012 at 17:34
  • I don't think you will (easily anyway) except if you focus on one very specific OS & kernel version, and dig into the guts of it. I don't really see why the exact number is important, that's a really low-level implementation detail you won't get guarantees about (except possibly on things like hard-real-time OSes or such specialized things).
    – Mat
    Dec 29, 2012 at 17:37
  • It was a question on the final exam. The teacher said that with COW is 0. I am just not sure. Thanks.
    – SoftDisk -
    Dec 29, 2012 at 19:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .