This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.828 Operating System Engineering: Fall 2003 Quiz II Solutions All problems are open-ended questions. In order to receive credit you must answer the question as precisely as possible. You have 80 minutes to answer this quiz. Write your name on this cover sheet AND at the bottom of each page of this booklet. Some questions may be much harder than others. Read them all through first and attack them in the order that allows you to make the most progress. If you find a question ambiguous, be sure to write down any assumptions you make. Be neat. If we can’t understand your answer, we can’t give you credit! THIS IS AN OPEN BOOK, OPEN NOTES QUIZ. 1 (xx/15) 2 (xx/25) 3 (xx/20) 4 (xx/25) 5 (xx/15) Total (xx/100) Name: I 6.828 FALL 2003, Quiz 2 Solutions Page 2 of 11 Control-C and the shell 1. [15 points]: In UNIX when a user is running a program from the shell, the user can terminate the program by typing ctrl-C. How would you change the 6.828 kernel and its shell to support this feature? Be careful, make sure when a user types the name of the program and hits ctrl-C before the program runs that the right thing happens (i.e., don’t kill the shell itself or the file system). (Sketch an implementation and define “what the right thing” is.) There are many possible solutions; here are three: – Add a system call to the kernel that allows the shell to indicate at any given point what environment, if any, should be killed when the user types ctrl-C. Modify the console code in the kernel appropriately so that the kernel intercepts ctrl-C (instead of passing it on as a control character to whatever environment is reading the console), and kills the indicated environment. With this solution, environments can never prevent them- selves from getting killed: thus, CTRL-C acts like a “hard” or “uncatchable” Unix signal. – Modify the kernel’s console code so that the shell can intercept ctrl-C input charac- ters even when other, “normal” input characters may be going to some other (e.g., child) environment that happens to be reading from the console. Then upon receiving this special control character from the kernel in the console input stream, the shell can decide which of its child environments should be killed. With this solution, en- vironments once again cannot prevent themselves from getting killed, but only the immediate child environments of the shell can be killed this way: a (killable) child environment can easily create another, “unkillable” environment simply by forking or spawning a child of its own (a grandchild of the shell). – Add some form of asynchronous event handling support to the kernel’s console code so that environments can asynchronously accept and handle ctrl-C input characters themselves. For example, each environment might be able to register a user-mode “ctrl-C handler,” along the lines of the current user-mode...
View Full Document
This note was uploaded on 05/29/2010 for the course 6 828 taught by Professor Guy during the Spring '08 term at MIT.
- Spring '08