A fork implementation question.


R. Clayton (rclayton@monmouth.edu)
(no date)


  If I am fetching forked processes from the disk, do I start the new, forked
  process from the beginning or from the stage where the fork was called?

At the time of the fork, the new forked process is an exact copy of the old
forking process, except for the contents of register 1. This means the
pc-register contents in both process are the same, at the time of the fork.

This description is biased towards a fork implementation that shares user-space
code between the old forking and new forked processes. If you want to
implement fork so that each new forked process uses a new user-space copy of
the code, you have to change the above description to read "is effectively an
exact copy" to account for the differences in address spaces for the old
forking and new forked processes.

  If I am fetching the program from disk and retaining the PC of old process,
  where do I store the register values (PC etc) for the old process in order to
  initialize the new process?

I'm not sure I understand the question, but I think it depends on your
implementation. My guess is that this question has already been answered by
whatever mechanism you use to implement context switches.



This archive was generated by hypermail 2.0b3 on Mon Dec 16 2002 - 22:00:05 EST