$30
Homework #1
Instructions:
HW must be submitted on typed pdf or word document.
Q1. What is the main advantage for an operating-system designer of using virtual-machine architecture? What is the main advantage for a user? (1 points)
Answer:
Q2. Describe the similarities and differences between Unix and Linux OSs (3 points)
Answer:
Q3. What are the benefits and the disadvantages of the automatic and explicit buffering? (1 point)
Answer:
Q4. Assume that the following program contains no syntax errors. As it executes it will create one or more processes. (3 points)
Simulate the execution of this program and show how processes are created
#include<stdio.h
main()
{
int m=10, n=5,count=1, mult=1;
while(count <3)
{
if(m != 0)
{
m = fork(); n = n+25;
}
else
{
m = fork(); n = n+20; mult = mult*n;
}
printf(“ n = %d mult = %d”, n, mult);
count =count + 1;
}
}
What is total number of processes? Show your work.
What will this program print on the screen when it executes?
6. The CPU and I/O times for 2 processes are shown below. Assume that PI gets to the ready queue just before P2 and the scheduling algorithm used by the OS is Round Robin with a time slice of 4 time units. Assume that the I/Os for the processes are different so that there is no I/O queue. Assume also that an interrupt from a completed I/O for process "X" will place process "X" in the ready queue BEHIND the process that was just interrupted. (2 points)
a. Using the first empty graph, describe how the CPU will be assigned to each process and for how long.
b. Use the second empty graph to show ALL the states that P1 goes through and the amount of time it has remained in that state until it has halted.