Explain the difference between how fork and vfork UNIX syste

Explain the difference between how fork() and vfork() UNIX system calls calls work, from virtual memory management prospective, i.e., explain how the way these system calls work affects how the memory management system deals with them, (relevant to Section 9.1-3)_________________________Assume the following page reference sequence. (1, 2, 3, 5, 6, 2, 3, 4, 5, 6, 1, 2, 1, 6, 7). Calculate the number of page faults as w ell as the content of the memory frames at the end of the references for the following 6 cases (scenarios): the memory system contains 1, 2, 3, 4, 5, or 6 frames. Draw curse that show Number of Frames on the X axis and number of page faults on the Y axis. Show your work in a separate page of paper? (relevant to Section 9.4)

Solution

1) Fork:

The fork call basically makes a duplicate of the current process, identical in almost every way (not everything is copied over, for example, resource limits in some implementations but the idea is to create as close a copy as possible).

The new process (child) gets a different process ID (PID) and has the the PID of the old process (parent) as its parent PID (PPID). Because the two processes are now running exactly the same code, they can tell which is which by the return code of fork - the child gets 0, the parent gets the PID of the child. This is all, of course, assuming the fork call works - if not, no child is created and the parent gets an error code.

Vfork:

The basic difference between vfork and fork is that when a new process is created with vfork(), the parent process is temporarily suspended, and the child process might borrow the parent\'s address space. This strange state of affairs continues until the child process either exits, or calls execve(), at which point the parent process continues.

This means that the child process of a vfork() must be careful to avoid unexpectedly modifying variables of the parent process. In particular, the child process must not return from the function containing the vfork() call, and it must not call exit() (if it needs to exit, it should use _exit(); actually, this is also true for the child of a normal fork()).

 Explain the difference between how fork() and vfork() UNIX system calls calls work, from virtual memory management prospective, i.e., explain how the way these

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site