|
15-410 HW2 solutions (Spring, 2006)Question 1 - Public Key PracticumIf you did this problem correctly, in a couple of hours your hw2 directory should contain a $USER.message.decrypted file. If not, check to see if there is a $USER.ERROR file. If not, a popular problem is that you used file names other than the ones specified in the assignment, the grading script wasn't able to guess what you meant, and the grader hasn't yet had the time to manually intervene. By the way, your encrypted messages to us were read and, generally, appreciated. Question 2 - Virtual MemoryPart AIdentify four specific kinds or areas of kernel code or data which could not safely be paged out, describing briefly why each would be unsafe. Sort your list so that the most unsafe entries come first.
Part BWhat one kind of kernel code or data do you think would be most attractive to page out? Explain briefly. To some extent it depends on your kernel. You might think of paging out large kernel data structures related to user processes which have been substantially paged out... some operating systems page out page tables. For Pebbles-like kernels an attractive target is probably kernel stacks, though you would probably want to be a little careful about exactly when to page them out and back in (page faults in certain parts of context switch might not be so fun). Question 3 - SchedulingPart ADescribe briefly how a scheduler can determine which threads in kernel mode are there "for real" versus having been forced into the kernel by an interrupt. Probably the simplest way would be for the assembly-language wrappers to set a thread-specific flag on the way in and clear it on the way out. Howver, that would require the scheduler to search around for high-priority threads, so some linked-list action might be better. Part BIs the proposed scheduling design wise? Any process able to spend lots of time running
in the kernel
(as opposed to blocked in the kernel)
would deny service to all threads
trying to get work done in user space (e.g., mandelbrot).
Since we generally buy machines to run user applications, a system
which spent all its time busily in the kernel would be bad.
What kind of program would spend essentially all of its time in
the kernel running busily away? How about fork_bomb?
A loop around Part CBriefly suggest an alternate scheduling strategy which would be sensitive to the argument described above. One approach would be a form of priority inheritance: acquiring a lock would raise a thread's priority until the lock were relinquished. Another, cruder, approach would be for lock acquisition to disable interrupts. Either way it would be important to not hold that kind of lock for a long time while doing work, or else a practice designed to stop other threads from being delayed would act to delay them! For further reading...Here is last semester's homework page. | ||||||||||
[Last modified Friday December 07, 2007] |