8.16 Exercises
-
1.
Why panic in
balloc
? Can xv6 recover? -
2.
Why panic in
ialloc
? Can xv6 recover? -
3.
Why doesn’t
filealloc
panic when it runs out of files? Why is this more common and therefore worth handling? -
4.
Suppose the file corresponding to
ip
gets unlinked by another process betweensys_link
’s calls toiunlock(ip)
anddirlink
. Will the link be created correctly? Why or why not? -
5.
create
makes four function calls (one toialloc
and three todirlink
) that it requires to succeed. If any doesn’t,create
callspanic
. Why is this acceptable? Why can’t any of those four calls fail? -
6.
sys_chdir
callsiunlock(ip)
beforeiput(cp->cwd)
, which might try to lockcp->cwd
, yet postponingiunlock(ip)
until after theiput
would not cause deadlocks. Why not? -
7.
Implement the
lseek
system call. Supportinglseek
will also require that you modifyfilewrite
to fill holes in the file with zero iflseek
setsoff
beyondf->ip->size.
-
8.
Add
O_TRUNC
andO_APPEND
toopen
, 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.