Q. 20 What is a process ?
Q. 21 Define the terms : 1) Context switching 2) Degree of multiprogramming.
Q. 22 Explain context switching at a process level in multiprogramming system with example.
Q. 23 Explain Running, Ready and Blocked process states in process management. OR
Discuss various process states with examples.
Q. 24 What is process scheduling ? Explain scheduling objectives.
CONCEPT RELATED TO PROCESS MANAGEMENT
Q. 20 What is a process ?
Ans : Process :
i) A process is defined as a program under execution, which competes for CPU time and other memory resources.
ii) In simple terms, a program does not compete for computing resources such as CPU. time
or memory, whereas a process does. A program may be present on paper reside on disk.
It may be compiled or tested but it still does not compete for computing resources.
iii) Once a user wants to execute a program, it is located on the disk and loaded in the main memory, at that time, it becomes a process, because it then compete for C.P.U. time and other resources.
Q. 21 Define the terms :
1) Context switching
2) Degree of multiprogramming.
Ans : 1) Context switching :
In multiprogramming system, multiple processes are run at the same time such that when process 1 wait for an I/O, process 2 executes and vice versa. The lost in time, in turning the attention of CPU from one process to another is called as context switching.
2) Degree of multiprogramming :
The number of processes running simultaneously and hence competing for CPU is known as degree of multiprogramming.
Q. 22 Explain context switching at a process level in multiprogramming system with example.
Ans : i) Multiprogramming is the concept of increasing utilisation of C.P.U. by always having something for C.P.U. to execute.
ii) In multiprogramming, C.P.U. can execute two or more processes simultaneously. When process 1 waits for an external event such as an I/O operation, C.P.U. executes process 2 and vice versa.
iii) When C.PU. switches from one process to another the time required for switching is called as context switching.
Context switching
iv) Let A and B be the two processes ready for execution and requires C.P.U. time for execution.
Let CPU time be given to process A, which is having some instructions depending on
process B or on some external event such as an I/O operation. Then, it is the job of operating system to halt the execution of process A and give C.P.U. time for process B.
The lose in time in turning the attention of C.P.U. from process A to process B is known as context switching.
v) During context switching the status of C.P.U. registers and flags of the old process are
stored in memory.
For-e-g :-
// A. CPP
# include <iostream.h>
# include “B.h”
void main ()
{
int a = 10, b = 20;
cout << add (a,b);
}
// B.h
# include <iostream.h>
int add (int x, int y)
{
return (x+y);
}
C++Here A and B are the two processes, where process A is depending on B. When process A is being executed, CPU executes instructions one by one. When it comes to the instruction one by one. When it comes to the instructions cout <<add (a,b); it stops execution because the output of this instruction depends on Output of process B.
Thus there is need of execution of process B. So C.P.U. stores the contents of registers and flags of process A in RSA (Register Save Area). It then loads process B in memory. The time required for this is known as context switch. The CPU then executes process B and output is given to process A and execution of process A restarts from the instruction from which it was halted.
Q. 23 Explain Running, Ready and Blocked process states in process management. OR
Discuss various process states with examples.
Ans : In order to manage switching between processes, the operating system defines three basic process states, which are as given below.
i) Running state :
There is only one process, which is executed by C.P.U. at any given moment. This process is
called as running process.
In multiprocessor systems, with multiple C.P.Us, there are many running processes at a
given moment. The operating system keeps track of all of them.
ii) Ready state :
The process, which is not waiting for an external event such as an I/O operation, but which is not running is said to be in ready state.
Actually, a process in ready state could have been running. But the fact that, there is only one C.PU., which is executing some other process, while this process is waiting for C. PUs attention towards it.
iii) Blocked state :
When a process is waiting for an external event such as an I/O operation, the process is said to be in blocked state.
The major difference between blocked and ready process is that a blocked process can not
be directly scheduled even if CPU is free, whereas a ready process can be scheduled if the C.PU. is free.
Q. 24 What is process scheduling ? Explain scheduling objectives.
Ans. : 1) In a Multiuser Operating System, a number of programs are running simultancously
and these are called as processes.
2) In this case the O.S. has to keep track of all these processes and will have to dispatch them one after another. This is known as process schedulin.
3) While scheduling various processes, there are many objectives for the operating system.
Some of these objectives conflict with each other. Therefore, the O.S. designers have to
choose a set of objectives to be achieved. Some of these objectives are as listed below :
i) Fairness
ii) Good throughput
iii) Good CPU utilization
iv) Low turnaround time
v) Low waiting time
vi) Good response time.
i) Fairness refers to being fair to every user in terms of C.P.U. time
ii) Throughput refers to the total productive work done by all the users put together.
iii) CPU utilization is the fraction of the time that the CPU is busy.
iv) Turnaround time is the elapsed time between the time a program or job is submitted and the time when it is completed.
v) Waiting time is the time a job spends waiting in the queue of the newly admitted processes for the operating system to allocate resources to it before commerncing its execution.
vi) Response time is the time slice for responding to a question or an event. It depends on
degree of multiprogramming, the efficiency of the hardware along with the O.S. and th policy of O.S. to allocate the resources.
Click on DOWNLOAD and Operating System Part – 4 pdf will start downloading.
-
Can I download Operating System Part – 4 PDF Free ?
Yes, you can download TPS Computer Science 12th all Pdf for free. Only you need to click on download button and wait for 30 seconds. Your download will start automatically.
-
Unable to download the pdf ?
Please click on the download button and wait for 30 seconds for the downloading link to be generated. After that check your downloads you will get your pdf.
-
Why I am seeing count down timer after clicking on download button ?
Please wait for it to complete and then you will able to download it. You are seeing count down timer for downloading link to be generated.
Important Links