OPERATING SYSTEM ASSIGNMENT SUBMITTED BY UDDIPTTA UJJAWAL 11007877 B53 SUBMITTED TO Ramanpreet Kaur Lamba

Home Work-I Operating System Course Code CSE316 Question 1. In a multiprogramming and time sharing environment. Question 2. Interrupts cause the operating to change a CPU from its current task and to run a kernel routine. What happens on a context switch? Should context switches happen frequently or infrequently? Explain your answer. So . several users share the system simultaneously. This task is known as a context switch. Ans:a)Two such problem that occur multiprogramming and time sharing is : in case of 1. When a context switch occurs. a) What are two such problems? b) Can we ensure the same degree of security in a time shared machine as we have in a dedicated machine? Explain your answer. This situation can result in various security problems.operation like context switch happens frequently in general purpose systems.Dealock: It can be defined as a state where two process are having resources that is need by each of them and one cannot perform a execution if it doesn’t have both resources and both . Ans: Switching the CPU to another process requires performing a state save of the current process and a state restore of a different process. the kernel saves the context of the old process in its PCB and loads the saved context of the new process scheduled to run.

Starvation: Starvation can be defined as a situation where a process has to wait indefinitely for certain amount of time . Trap: A trap is a software generated interrupt caused either by an error or by specific request from user program. This erroneous program might modify other program. 2. b)No. The fundamental idea behind virtual machine is to abstract hardware of a single computer (like disk drives. 3. Mach etc. The factor that are needed to be considered in choosing the host OS is : . loading of starting address and begin execution. we can’t assure the same security in time sharing machine as in Dedicated machine because in case of dedicated machine we have reserve machine time.are waiting for the resources to be free and will wait for infinite time. manages execution of program through console. thereby creating illusion that each separate environment is running its own private computer. Instead of have two computer we use the concept of virtual machine like VMware. What is the relationship between a guest OS and host OS in a system like VMware? What factors need to be considered in choosing the host OS? Ans:A guest OS is a virtual machine like VMware and host OS is operating system like windows. network interface card and so forth) into several different executing environment . Question 3. manually loading of program into memory. When one want to have two OS in a single pc then the idea of virtual machine comes into play. This phenomena is known as deadlock.

NIC(network Interface card): It is possible to define a network of virtual machine.Minidisk or physical shared disk: It makes it possible to share a mini disk and thus to share files .1. 3.d) i. 2. each of which can send information over the virtual communication network but is implemented in software.e heap and global variable . Question 4. This scheme is modelled after a physical shared disk but is implemented by software . Which of the following components of program state are shared across threads in a multithreaded process? a) Register values b) Heap Memory c) Global Variables d) Stack Memory Ans:c).CPU: the cpu must be virtually shared as the CPU of virtual machine.

99 and T0 =10 ms Ans: a) If α= 0 and T0 = 100 ms here the parameter α control the relative weight of recent and past history. What are the implications of assigning the following values to the parameters used by the algorithm? a. So if α= 0 and .Question 5. α= 0. α= 0 and T0 = 100 ms b. Consider the exponential average formula used to predict the length of the next CPU burst.

only the most recent cpu burst matters(history is assumed to be old and irrelevant . therefore if α=1 then T1=t0 i.99 and T0 =10 ms that is α tends to be 1. The formula always makes a prediction of 100 Milliseconds for the next CPU burst.The most recent behavior of the process is given much higher weight than the past history associated with the process Question 6 Draw a Gantt chart illustrating the execution of these processes using the FCFS scheduling algorithm. The current condition are assumed to be transient ).T0 = 100 ms then T1=T0 which imply that recent history has no effect ie. Round Robin with q=3 and SJF (Pre-emptive and non-pre-emptive). b)if α= 0.   What is the average process turnaround time? What is the average process waiting time? Process CPU Burst Arrival Time P0 P1 P2 P3 2 10 6 3 0 1 5 7 Ans: FCFS Schedulling P0 P3 P1 P2 .e .

Average waiting time: (0+10+6+1)/4 = 4.5 The Gantt chart for the schedule using SJF (nonpreemptive): Ci C C C .25 2. Average turnaround time =(2+11+13+14)/4=10ms 2. Average waiting time =(0+1+7+11)/4=4.75ms SJF Schedulling The Gantt chart for the schedule using Round Robin where q=3 P0 P1 P2 P3 P1 P2 P1 P1 0 21 2 5 8 11 14 17 20 1. Average Turnaround time : (2+20+12+4)/4=9.0 18 2 21 12 1.

. Average Turnaround time : (2+20+10+3)/4=8. Average waiting time: (0+10+3+0)/4=3.25 The Gantt chart for the schedule using SJF (preemptive): Ci C C C C C 0 2 5 7 10 14 21 1.0 21 2 12 15 1.25 2. Average waiting time: (0+1+10+5)/4=4 2. Average Turnaround time :(2+11+16+8)=9.75.