mit-pdos / xv6-riscv-book

Text describing xv6 on RISC-V
Other
662 stars 137 forks source link

Rewording How Fork is Described #36

Closed qiongsiwu closed 3 months ago

qiongsiwu commented 1 year ago

The current text states that

fork gives the new process an exact copy of the calling process's memory, both instruction and data.

A few sentences above, the text states that

An xv6 process consists of user-space memory (instructions, data, and stack) ...

The combination of these two sentences may imply that "stack" is not cloned during fork, and the code https://github.com/mit-pdos/xv6-riscv/blob/f5b93ef12f7159f74f80f94729ee4faabe42c360/kernel/proc.c#L292 implies that we are copying the whole user-space memory, including instructions, data, and stack.

This PR rewords the sentence that describes fork to reduce ambiguity.

kaashoek commented 3 months ago

Thx! I clarified the text to make clear that the stack is included.