remzi-arpacidusseau/ostep-projects

Book: a little typos

laokz opened this issue · 0 comments

laokz commented

I don't know how to commit issue to the book directly, so come here.

  1. fix argument of example code 'swtch'

In Figure 6.4 of chapter 6, first argument of function swtch is struct context**old. I think it should be struct context *old, because the following code need a memory address of old context, not address of a pointer to the old context.

  1. better clear formula 9.2

In CFS scheduler section of chapter 9, formula 9.2 gives: vruntimei=vruntimei+weight0/weighti·runtimei. But the text didn't describe what weight0 for. This might confusing newbies like me to "process 0's weight".

After searching, it showed weight0 may be the value of "nice 0" into prio_to_weight[40].

  1. In chapter 23 page 10, bold "directory memory access" might be "direct memory access".

  2. In chapter 30, I could hardly find the problems in the broken CV codes but got an irrelevant one ;-( One producer produced loops values and two consumers consumed double. Sorry, professor :-) (just while(1) may be OK)

  3. fix Figure 33.1 code

18    int fd;
19    for (fd = minFD; fd < maxFD; fd++)
20        FD_SET(fd, &readFDs);
21
22    // do the select
23    int rc = select(maxFD+1, &readFDs, NULL, NULL, NULL);
24
25    // check which actually have data using FD_ISSET()
26    int fd;
27    for (fd = minFD; fd < maxFD; fd++)

The first argument of select() is maxFD+1, then the max monitored file descriptor is maxFD, so the two loop conditions should be fd <= maxFD(line 19, 27). And line 26 is redundant.

  1. In chapter 38 page 11, the table shows BLOCKs of 2 bits size, but the text above it shows 4 bits.

  2. Chapter 39. In the middle of page 6, in this spot (“hello”) might be in this spot (“hello\n”).

Page 8 struct { struct spinlock lock;... } ftable;, xv6 source shows that the lock indeed per whole instead of per entry.

Page 24 sidebar, it might be difficult for malicious user to attack the service via a call to rename(), but rather easy via ln command.

Thank you for the excellent book!