xv6 一直是我自己很喜歡的一個專案,在 2023 年時就已經在 HackMD 上紀錄了當時的解題紀錄,但當時都偏向隨筆紀錄而已,如今想來翻新一下,自己是期望可以寫得更清楚一些,另外,之前在 Lab8: networking 之後就沒有再更新了,這次希望可以把後面也補足,希望對於想學習 xv6 的人有幫助。
[xv6 學習紀錄 06] Lab: Copy-on-Write Fork for xv6
Lab 連結:Lab: Copy-on-Write Fork for xv6 題目解析 The problem The fork() system call in xv6 copies all of the parent process’s user-space memory into the child. If the parent is large, copying can take a long time. Worse, the work is often largely wasted: fork() is commonly followed by exec() in the child, which discards the copied memory, usually without using most of it. On the other hand, if both parent and child use a copied page, and one or both writes it, the copy is truly needed. ...