OS-Assignment1

Hii Frndz,

Now I am going to upload all my assignments and Term-Papers, Projects One by One.

Part – A

1. Enumerate the benefits of Micro-kernel design.

Ans:
Microkernel is a computer kernel that provides the mechanisms needed to implement an operating system, such as low-level address space management, thread management, and inter-process communication. If the hardware provides multiple privilege levels, then the microkernel is the only software executing at the most privileged level (generally referred to as supervisor or kernel mode). Actual operating system services, such as device drivers, protocol stacks, file systems and user interface code are contained in user space.
In the micro kernel design all the modules are divided into the small-small kernel and each module have its own functioning therefore if we want to install new service over this design than we don’t have to interact with other design.

2. Enumerate certain advantages of SMP over uniprocessor architecture. Also, state the design considerations for a multi-processor operating system.

Ans:
The basic operating systems organizations for multiprocessors are master/slave, separate executive for each processor , and symmetric treatment of all processor.
With a single processor, parallel execution of programs is possible, while in multiprocessor systems parallel execution of programs is possible.
In uniprocessor, the virtue multiprocessor abstraction is supported by time multiplexing the physical processor among the virtual processors. In multiprocessors environment, true multiprocessor is possible by allocating a separate physical processor to each virtual processor.

3. Determine the causes behind certain errors that the designer of an Operating System might face.

Ans:
Designing an operating system is very different from designing an algorithm:
-The external interface (that is, the requirement) is less precisely defined more complex, and more subject to change.
-The system has much more internal structure, and hence many internal interfaces.
-The measure of success is much less clear.
The designer usually finds himself floundering in a sea of possibilities, unclear about how one choice will limit his freedom to make other choices, or affect the size and performance of the entire system. There probably isn’t a ‘best’ way to build the system, or even any major part of it; much more important is to avoid choosing a terrible way, and to have clear division of responsibilities among the parts.

Part – B

4. a) Compare various CPU scheduling algorithms (particularly: FCFS, SJF, and RR) on the grounds of throughput, response time, overhead, mode (pre-emptive or non-pre-emptive), starvation factor, fairness level to certain processes.

Ans:
1. FCFS This is the simple CPU scheduling algorithm. The idea is that job which comes first in ready queue is executed first by the CPU.
In this method, ready queue is considered as a FIFO queue, i.e, the job comes in ready queue is added at the tail of the queue and CPU takes the process from the head of queue for execution.

2. SJF This is very good CPU scheduling in this the job ,that has the smallest next CPU burst , is allocated to the CPU for executing first in case where more than one jobs have same length of next CPU burst , the FCFS scheduling is used to break the tie . This scheduling should be known as shortest next CPU burst rather than shortest job first.

3. RR the idea of RR scheduling is just like FCFS but it is preemptive. Time slice , is a small unit of time . the CPU is allocated to every process in the ready queue for one times slice . here , ready queue is treated as a circular queue . the tim slice may be of size 10 to 100 milliseconds. Due to this reason , it is called oftenly time slice scheduling.

b) Also, prepare Gantt charts and determine the average waiting time for the following set of processes using FCFS, SJF (non-pre-emptive) and RR (quantum=4 ms):
Process Name: P1 P2 P3 P4 P5 P6
Burst Time (in ms): 5 12 7 2 10 4

Ans:
Gantt chart of FCFS:
P1 P2 P3 P4 P5 P6
5 12 7 2 10 4
0 5 17 24 26 36 40
Waiting time for process p1= 0
Waiting time for process p2= 5
Waiting time for process p3= 17
Waiting time for process p4= 24
Waiting time for process p5= 26
Waiting time for process p6= 36

Total waiting time= 0+5+17+24+26+36
= 108.
Average waiting time= 108/6
= 18 ms.

Gantt chart for SJF:
P4
P6
P1
P3
P5
P2

0 2 6 11 18 28 12

Waiting time for process p1= 6
Waiting time for process p2= 28
Waiting time for process p3= 11
Waiting time for process p4= 0
Waiting time for process p5= 18
Waiting time for process p6= 2

Total waiting time= 6+28+11+0+18+2
= 65
Average waiting time= 65/6
= 10.83 ms.

Gantt chart for RR:
Given quantum= 4ms.

P1
P2
P3
P4 P5
P6
P1
P2 P3 P5 P2 P5
0 4 8 12 14 18 22 23 27 30 34 38 40

Waiting time for process p1= 22-4+0 = 18
Waiting time for process p2= 34-27+23-8+4 = 26
Waiting time for process p3= 27-12+8 = 23
Waiting time for process p4= 12
Waiting time for process p5= 38-18+14= 34
Waiting time for process p6= 18

Total waiting time= 18+26+23+12+34+18
= 131
Average waiting time = 131/6
= 21.83 ms.

5 a) Suggest a few reasons behind suspension of a process.
Ans:

The process was placed in the suspended state by itself, or OS, a parent process for the purpose of preventing its execution. This won’t be removed until the agent explicitly orders the removal.

Some of the reasons to behind suspension of a process are:-

1. If one process is ready to execute, but there is no space in the main memory, then it is suspended.

2. When one process in main memory which was blocked & there is another process ready to execute, but waiting in secondary memory, then the process in main memory is suspended.

3. When the parent process suspends, then the sub process is also suspended.

b) A process switch may occur any time that the OS has gained control from the currently running process. Suggest the possible events that may give the control to OS.

Ans:-There are various types of steps occur in the when it takes the control from the operating system. operating system make some call to switch the process which include the process id number and it states, when the function return true than the operating system initialize the next step to take the process and then in take the step.

6 a) Explore the role of Long Term scheduler to control the degree of multiprogramming in the system.

Ans:
Long term scheduler determines which programs are admitted to the system for execution and when, and which ones should be exited.
Long term scheduling obviously controls the degree of multiprogramming in multitasking systems, following certain policies to decide whether the system can honor a new job submission or, if more than one job is submitted, which of them should be selected. The need for some form of compromise between degree of multiprogramming and throughput seems evident, especially when one considers interactive systems. The higher the number of processes, in fact, the smaller the time each of them may control CPU for, if a fair share of responsiveness is to be given to all processes. Moreover we have already seen that a too high number of processes causes waste of CPU time for system housekeeping chores (trashing in virtual memory systems is a particularly nasty example of this). However, the number of active processes should be high enough to keep the CPU busy servicing the payload (i.e. the user processes) as much as possible, by ensuring that – on average – there always be a sufficient number of processes not waiting for I/O.

b) Suppose that a short term scheduler favors those processes that have used the CPU for least amount of time in the recent past. Justify, why this algorithm will eventually (or indirectly) favor the I/O-bound processes and not yet starve the CPU-bound processes completely.

Ans:
First of all the CPU bound process (supported by the short term scheduler) support the short process.. And the same activities also indirectly offer by the I/O bound process.
For example if the I/O bound process are short that mean it doesn’t go from long waiting than it shows the short term behavior.
And in the reverse condition if the CPU/bound process take (exceptionally) something different and then it behave like I/O bound process.

*************************** THE END *****************************

Advertisements
    • sunny
    • September 6th, 2010

    thanks

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: