HW-1
February 9, 2015 This assignment is to be done individually and submitted in class. (Online submissions are not allowed) Due Date: February 16, 2015
Question 1 (20 points): What is the purpose of interrupts? What are the differences between a trap and an interrupt? Can traps be generated intentionally by a user program? If so, for what purpose?
Interrupt is that causes a computer processor to temporarily stop executing its current program and execute another program instead, finally returning control to the original program. So it prevent that more important task goes back because of less important task. The main difference between a trap and an interrupt is where they are generated. An interrupt is a hardware-generated. And it can be used to signal the completion of an I/O to obviate the need for device polling. Whereas a trap is software-generated interrupt and it can be used to call operating system routines or to catch arithmetic errors.
Question 2 (10 points): Why is the separation of mechanism and policy desirable?
Question 3 (10 points): What are the advantages of using loadable kernel modules?
Question 4 (15 points): Explain the role of the init process on UNIX and Linux systems in regards to process termination.
Question 5 (15 points): Can a multithreaded solution using multiple user-level threads achieve better performance on a multiprocessor system than on a single processor system? Explain.
Question 6 (20 points): Consider the following code segment: pid t pid; pid = fork(); if (pid == 0) { /* child process */ fork(); thread create( . . .);
}
fork();
a. How many unique processes are created?
b. How many unique threads are created?
Question 7 (20 points): A variation of the round-robin scheduler is the regressive round-robin scheduler. This scheduler assigns each process a time quantum and a priority. The initial value of a time quantum is 50 milliseconds.However, every