You are on page 1of 5

Q-1 ANS

Actually process is nothing but a program which is in execution. An operating system considers a process to be the fundamental unit for resource allocation. The resources that could be allocated to a process are given below: (i) Memory (ii) Secondary memory (iii) I/O Devices (iv) files opened by the process (v) CPU time consumed by process Process Control Block is a data structure which is used to keep the track of information of a process and what type of information a PCB contain is defined below:Process ID Priority Process State PSR Registers Event Information Memory allocation Resources held PCB Pointer

(i) Process scheduling information: This information is having the first three fields that are shown in above figure i.e.Process ID, Priority, Process State. (ii) PSR and machine registers: These fields hold contents of the processor states register (PSR) and the machine registers when the execution of the process was last suspended. (iii) Event information: when a process is in blocked state, this field contains information concerning the event for which the process is waiting. (iv) Memory and resource information: This information is useful for the deallocating memory and resources when the process terminates. (v) PCB pointer: It is a pointer to the next PCB in the process scheduling list.

Q.2 Ans a) Write to a Disk:To write into a disk disk management component of the operating system is used. b) Which process will get the CPU time. To decide which process will get the CPU time Dispatcher component of operating system is used. c) Determine where in memory a new process should be placed. For this purpose i.e. where a new process should be placed in memory is comes under memory management component of Operating System. d) Enable one process to send data to another
For enabling one process to send data to another the Process Management component of CPU is used.

e) Communicate to an I/O device. To communicate to an I/O device I/O system of operating system is used.

Q.3 Ans.
Micro Kernel approach of the operating system include only all the essential features in kernel and rest as user space or system programs. This results in to smaller kernel. If any modification has to be done then service is added in user space thus making fewer changes to kernel and smaller in size. The resulting operating system(Micro kernel ) is portable in nature as it can easily adapt from hardware to other easily. The modular microkernel allows user level servers to be added and removed without having to shut-down the system. The flexibility of the microkernel comes from the fact that it does almost nothing so services can easily be added on. Each user level server has a welldefined interface that is easy to access and easy to understand. It is also easy to add a new service and debug it, as the whole system does not need to be stopped (as in the monolithic kernel architecture). With flexibility comes portability.

Q.4 Ans.
Spawned process is dependent on parent and parent get destroyed:Advantages: 1. When the parent is destroyed and spawned process is also destroyed then one advantage is that system do not need to locate process table. 2. Resources shared by child process are available for other processes. 3. When the parent process is terminated, it means that we it system dont require that process and its associative process .The spawned process is also the part of parent process. 4. If parent get destroyed then one advantage is also that there is no need of PCB for process control information.
Disadvantages: 1. The one of disadvantage of automatic destruction of parent process is that when the child process is used some other process the output will be affected by it. 2. We need spawned processes for some of the purposes eg. If we have a file and it is linked with the spawned process ,it means we are performing some operations through spawned process into the file, then destruction of parent results in the destruction of our file or data in the file.

Spawned Processes independent of parent and parent get destroyed:Advantages:


1. If parent is destroyed then one advantage is that If child process could assigned a new parent then all overheads of memory decreases. 2. If the child is using the some other processes and parent get destroyed then it will not affect the child.

Disadvantages:
1. Different process tables has to be created and memory overheads increased. 2. We have to create PCB for process identification, process status information and process control information.

Q.5.Ans.
Context switching is the process by which when we have a process in CPU and we switch the CPU for another process which requires to save the old process and load the saved state for the new process.

When operating system want to load the execution context for the process to be dispatched during a context switching it load it from PCB of the process. Because PCB contains the information about the process to be dispatched. Now, when a process is running, then the register contents of the process are loaded in CPU and the PCB is also get updated. When the OS preempts a running process, it stores the values of these registers into the PCB for that process. Processor further simplify and speed context switching by providing instructions that save and restore a processs execution context to and from its PCB, respectively.The following figure shows how the context switching process work:-

Q.6 Ans.
SJF(Shortest Job First Scheduling) is an an algorithm for CPU scheduling. This can be implemented in two ways i.e.:1) Non-preemptive(Shortest-next CPU burst) 2) Preemptive(Shortest Remaining CPU burst). In case of non-preemptive the CPU checks out the burst time of the different processes and firstly that process is processed out which is having the less CPU burst time.

The problem given in this question is the Preemptive case. Firstly we have to prepare the Gantt Chart for this particular problem . So the Gantt chart for this problem is:P1 0 3 P3 6 P1 10 P4 14 P2 24

Now we can calculate the average waiting time by using this Gantt Chart and the formula for calculating the average waiting time is:Average waiting time = ( (Leaving time of P1 Arrival time of P1) + (Leaving time of P2 Arrival time of P2) + (Leaving time of P3 Arrival time of P3) + (Leaving time of P4 Arrival time of P4) ) / 4. Firstly we calculate the waiting time of all the processes. So the waiting time for all the processes:-

Processes P1 P2 P3 P4

Waiting Time 6-3 =3 14-2=12 3-3=0 10-4=6

Avg. Waiting Time=(3+12+0+6)/4=21/4=5.25 units. The problem is of preemptive scheduling as already discussed so preemptive so here the first process P1 will run but after 3 seconds P3 process will run because its burst time is less than P1. After the completion of P3 process, P1 will be processed before P4. After 10 ms P4 will get processed and at the end P2 will be processed having maximum burst time.