Lab Assignment 2 - Multiprocessing - Design Doc (template)

Overview

The goal of this assignment is to…

In-depth analysis and implementation

fork (EXAMPLE):

  • A new process needs to be created through kernel/proc.c:proc_init.

  • The parent must copy its memory to the child via kernel/mm/vm.c:as_copy_as.

  • All opened files must be duplicated in the new process (make sure to call fs_reopen_file).

  • A new thread needs to be created to run the process, and a new process needs to be added to the process table (see the example in proc_spawn).

  • The current thread (parent’s process)’s trapframe needs to be duplicated in the new thread (child process). (Recall that assigning one struct to another results in a copy.)

  • The call to fork() has two different return values; the trapframe needs to be set up to return 0 in the child via kernel/trap.c:tf_set_return, while returning the child’s pid in the parent.

Risk analysis

Unanswered questions

Staging of work

We plan to implement the work in this lab as follows:

Time estimation