8.16 Exercises
-
1.
Why panic in
balloc? Can xv6 recover? -
2.
Why panic in
ialloc? Can xv6 recover? -
3.
Why doesn’t
fileallocpanic when it runs out of files? Why is this more common and therefore worth handling? -
4.
Suppose the file corresponding to
ipgets unlinked by another process betweensys_link’s calls toiunlock(ip)anddirlink. Will the link be created correctly? Why or why not? -
5.
createmakes four function calls (one toiallocand three todirlink) that it requires to succeed. If any doesn’t,createcallspanic. Why is this acceptable? Why can’t any of those four calls fail? -
6.
sys_chdircallsiunlock(ip)beforeiput(cp->cwd), which might try to lockcp->cwd, yet postponingiunlock(ip)until after theiputwould not cause deadlocks. Why not? -
7.
Implement the
lseeksystem call. Supportinglseekwill also require that you modifyfilewriteto fill holes in the file with zero iflseeksetsoffbeyondf->ip->size. -
8.
Add
O_TRUNCandO_APPENDtoopen, so that>and>>operators work in the shell. -
9.
Modify the file system to support symbolic links.
-
10.
Modify the file system to support named pipes.
-
11.
Modify the file and VM system to support memory-mapped files.