460 Take Home Exam
0. Demo of LAST assignment sh (and any other missing Labs): sign up with the TA to demo in his office on/before Thur, 4-24-08 Sign up for oral with KCW in sloan 321 on Friday 4-25-08 DUE: 6 PM, Monday April 28, 2008 (TextEdit and Printed copy) 1. Assume: 1.44 MB floppy disk contains a bootable MTX image, whose disk block numbers are stored as a sequence of ushort numbers in the last block (block 1439) of the disk. The sequence of numbers ends with a 0. As usual, block 0 contains a MTX booter. DO: Write pseudo-C code for such a MTX booter. (BONUS): Create and Demo such a bootable FD on Monday, 4-28-08 2. Assume: The tswitch() function in our MTX kernel is modified as .globl _tswitch, _scheduler, _running, _int100h _tswitch: int 100 ret _int100h: !--------------------------------- ! Interrupt handler for INT 100 !--------------------------------- DO: Write assembly code for the INT 100 Interrupt handler shown in the dashed box. (BONUS): Demo YOUR MTX (based on Lab#5.2) with the modified tswitch(). 3. The exec syscall in the MTX system of the SH assignment has the form int r = exec(cmdLine) char *cmdLine where the string cmdLine is passed to the target program as main(s) char *s; DO: Use pseudo-C code and diagrams (plus words) to explain HOW IS THIS DONE? (Start from the current Umode image that issues an exec("mkdir /a/b/c"); When the task executes kexec() in the MTX kernel: what does it do so that the string "mkdir /a/b/c" will be accessable as main(s) in the new image?) 4. Given : A semaphore s, with s.value = 2 and s.queue = 0 initially. A sequence of P, V operations on s as shown below: =============================================================== time: 0 1 2 3 4 5 6 7 8 ------------------------------------------- TaskID : 1 2 2 3 4 1 2 3 Operation: - P P V P P P V V =============================================================== DO: Show the semaphore value and queue contents between the time instants. s.value : s.queue : 5. Refer to the serial driver in LAB #8. (a). The shown code supports only ONE serial terminal at 0x3F8. Explain HOW TO support an ADDITIONAL serial terminal at 0x2F8. (b). When a task calls sputline(), it only puts a line of chars into the output buffer, outbuf[]. Explain: How are the chars actually sent out? (c). What's wrong with the following do_tx() code? WHY? struct semaphore outdata; // outdata.value = # of chars in outbuf[ ] struct semaphore outroom; // outroom.value = # of rooms in outbuf[ ] int do_tx() { P(&outdata); // wait if no data in outbuf[ ] output a char from outbuf[ ] V(&outroom); }