Chapter 8, cpu-sched-mlfq.pdf page 6, Figure 8.5 (Right): with priority boost every 50ms, missing boost at time 50. Or maybe boost should be specified as 100ms? (near bottom of page 7 referring to the figure) homework/cpu-sched-mlfq/mlfq.py bugfix: with boost, job ticksLeft should be allotment TIMES quantum: % diff mlfq.py.ORIG mlfq.py 249c249 < job[j]['ticksLeft'] = allotment[hiQueue] --- > job[j]['ticksLeft'] = allotment[hiQueue] * quantum[hiQueue] % homework/cpu-sched-mlfq/README.md: Help display in the README is missing some options: -a ALLOTMENT, --allotment=ALLOTMENT -A ALLOTMENTLIST, --allotmentList=ALLOTMENTLIST -I, --iobump -------------------------------------------------------------------------------- Chapter 15, vm-mechanism.pdf page 7: "If a process generates a virtual address that is greater than the bounds," should be: "If a process generates a virtual address that is greater than or equal to the bounds," -------------------------------------------------------------------------------- Chapter 19, vm-tlbs.pdf page 14, reference [H93] "MIPS R4000 Microprocessor User's Manual", by Joe Heinrich. Link "http://cag.csail.mit.edu/raw/ . documents/R4400 Uman book Ed2.pdf" should be: https://groups.csail.mit.edu/cag/raw/documents/R4400_Uman_book_Ed2.pdf But that link no longer works; an alternate location for the document is: https://minnie.tuhs.org/CompArch/Resources/R4400_Uman_book_Ed2.pdf -------------------------------------------------------------------------------- Chapter 26, code/threads-intro/t1.c bad pointer cast, should use no cast and %p format: t1.c: In function 'main': t1.c:31:5: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] (unsigned int) &counter); ^ % diff ORIG/t1.c t1.c 30,31c30,31 < printf("main: begin [counter = %d] [%x]\n", counter, < (unsigned int) &counter); --- > printf("main: begin [counter = %d] [%p]\n", counter, > &counter); % homework/threads-intro/README.md typo (same mistake in Chapter 28, homework/threads-locks/README.md): last "test" in the trace finds %dx and 0 to be equal should be: last "test" in the trace finds %dx less than 0 -------------------------------------------------------------------------------- Chapter 28, threads-locks.pdf page 22, HW Q2: "Can you predict what value will end up in flag?" should be: "Can you predict what value will end up in count?" homework/threads-locks/README.md Example missing one more iteration before halt: ./x86.py -p loop.s -t 1 -a dx=3 -R dx -C -c output should be: dx >= > <= < != == Thread 0 3 0 0 0 0 0 0 2 0 0 0 0 0 0 1000 sub $1,%dx 2 1 1 0 0 1 0 1001 test $0,%dx 2 1 1 0 0 1 0 1002 jgte .top 1 1 1 0 0 1 0 1000 sub $1,%dx 1 1 1 0 0 1 0 1001 test $0,%dx 1 1 1 0 0 1 0 1002 jgte .top 0 1 1 0 0 1 0 1000 sub $1,%dx 0 1 0 1 0 0 1 1001 test $0,%dx 0 1 0 1 0 0 1 1002 jgte .top -1 1 0 1 0 0 1 1000 sub $1,%dx -1 0 0 1 1 1 0 1001 test $0,%dx -1 0 0 1 1 1 0 1002 jgte .top -1 0 0 1 1 1 0 1003 halt typo (same mistake in Chapter 26, homework/threads-intro/README.md): last "test" in the trace finds %dx and 0 to be equal should be: last "test" in the trace finds %dx less than 0 Missing documentation of fetchadd instruction, used in ticket.s -------------------------------------------------------------------------------- Chapter 37, homework/file-disks/disk.py - fix MakeRequests to convert list from string to int when addr != -1, otherwise -l doesn't work - fix maxBlock setting in InitBlockLayout() % diff disk.py.ORIG disk.py 315c315 < self.maxBlock = pblock --- > self.maxBlock = block + 1 341,342c341,346 < else: < return addr.split(',') --- > else: # convert list from string to int > slist = addr.split(',') > tmpList = [] > for s in slist: > tmpList.append(int(s)) > return tmpList % homework/file-disks/README.md REQUESTS [br '10'] should be: REQUESTS [10] -------------------------------------------------------------------------------- Chapter 38, homework/file-raid/README.md RAID-1: for even-numbered logical blocks, the RAID chooses the even-numbered disk in the pair; the odd disk is used for odd-numbered logical blocks. should be: for even-numbered offsets, the RAID chooses the even-numbered disk in the pair; the odd disk is used for odd-numbered offsets. See raid.py line 231: if off % 2 == 0: self.doSingleRead(disk1, off, True) else: self.doSingleRead(disk2, off, True) -------------------------------------------------------------------------------- Chapter 40, file-implementation.pdf Figure 40.4: the first read of the bar inode is not needed; since the file is being created, the original inode contents are irrelevant. homework/file-implementation/README.md Example reference count for root directory should be 3, not 6: *** ORIG/README.md 2021-03-01 13:09:07.000000000 -0500 --- README.md 2021-06-04 16:19:49.618657707 -0400 *************** *** 77,83 **** ```sh inode bitmap 11110000 ! inodes [d a:0 r:6] [f a:1 r:1] [f a:-1 r:1] [d a:2 r:2] [] ... data bitmap 11100000 data [(.,0) (..,0) (y,1) (z,2) (f,3)] [u] [(.,3) (..,0)] [] ... ``` --- 77,83 ---- ```sh inode bitmap 11110000 ! inodes [d a:0 r:3] [f a:1 r:1] [f a:-1 r:1] [d a:2 r:2] [] ... data bitmap 11100000 data [(.,0) (..,0) (y,1) (z,2) (f,3)] [u] [(.,3) (..,0)] [] ... ``` homework/file-implementation/vsfs.py When writing data, should show the data value, otherwise can't answer the question: % python ./vsfs.py.ORIG -r -s 1 ... fd=open("/n/x", O_WRONLY|O_APPEND); write(fd, buf, BLOCKSIZE); close(fd); State of file system (inode bitmap, inodes, data bitmap, data)? ... % python ./vsfs.py -r -s 1 ... fd=open("/n/x", O_WRONLY|O_APPEND); write(fd, "o", BLOCKSIZE); close(fd); State of file system (inode bitmap, inodes, data bitmap, data)? ... Answer for data in above example needs to know that "o" was written: data [(.,0) (..,0) (n,1)] [(.,1) (..,0) (x,2)] [o] [] [] [] [] [] ---------------------------------------------------------^ fix: % diff vsfs.py.ORIG vsfs.py 392c392 < print('fd=open("%s", O_WRONLY|O_APPEND); write(fd, buf, BLOCKSIZE); close(fd);' % tfile) --- > print('fd=open("%s", O_WRONLY|O_APPEND); write(fd, "%c", BLOCKSIZE); close(fd);' % (tfile,data)) e % -------------------------------------------------------------------------------- Chapter 41, file-ffs.pdf page 14, Q7: "-I 5" should be "-I" (ffs.py -I option doesn't take argument value) -------------------------------------------------------------------------------- Chapter 42, homework/file-journaling/fsck.py *** fsck.py.ORIG 2021-03-01 13:09:07.000000000 -0500 --- fsck.py 2021-06-05 11:34:06.906923228 -0400 *************** *** 1,5 **** --- 1,11 ---- #! /usr/bin/env python + # RP 2021-06-05: + # - when creating orphan ("new fake inode", num = 3 or 9) mark the inode as allocated + # - fix message for case where inode gets its type switched, + # could be "was type file, now dir" or "was type dir, now file". + # - in pickRandom(), handle case with no 'f' files (not good if num == 5 or num == 11) + from __future__ import print_function import random import string *************** *** 507,512 **** --- 513,520 ---- for i in range(len(self.inodes)): if self.inodes[i].getType() == match: inodes.append(i) + # handle case with no 'f' files (not good if num == 5 or num == 11): + if len(inodes) == 0 and match == 'f': return self.pickRandom('d') assert(len(inodes) > 0) return random_choice(inodes) *************** *** 561,566 **** --- 569,575 ---- elif num == 3 or num == 9: # create new fake inode badInode = self.pickRandom('free') + self.ibitmap.markAllocated(badInode); if self.solve: print('INODE %d orphan' % badInode) if num == 3: *************** *** 581,593 **** # normal inode gets its type switched if num == 5: badInode = self.pickRandom('f') ! else: ! badInode = self.pickRandom('d') ! if self.solve: ! print('INODE %d was type file, now dir' % badInode) ! if num == 5: self.inodes[badInode].setType('d') else: self.inodes[badInode].setType('f') elif num == 6: # corrupt a directory block by making one tuple refer to a BAD INODE --- 590,602 ---- # normal inode gets its type switched if num == 5: badInode = self.pickRandom('f') ! if self.solve: ! print('INODE %d was type file, now dir' % badInode) self.inodes[badInode].setType('d') else: + badInode = self.pickRandom('d') + if self.solve: + print('INODE %d was type dir, now file' % badInode) self.inodes[badInode].setType('f') elif num == 6: # corrupt a directory block by making one tuple refer to a BAD INODE -------------------------------------------------------------------------------- Chapter 44, homework/file-ssd/README.md % diff ORIG/README.md README.md 133c133 < Here, we can see that on Block 2 (i.e., Page 10), there is the data "a", and --- > Here, we can see that on Block 1 (i.e., Page 10), there is the data "a", and % -------------------------------------------------------------------------------- Chapter 45, homework/file-integrity/checksum.py suggestion: instead of int(t) use int(t,0) for automatic base detection so user can specify values in decimal, hex, or binary with -D option % diff checksum.py.ORIG checksum.py 48c48 < values.append(int(t)) --- > values.append(int(t,0)) # automatic base detection, 0b1010..., 0xabc, etc. %