Professional Documents
Culture Documents
1 Scheduling Criteria
TechKnowledge
PUDIIC ations
Operauing System (MUJ
Snort term scheduler allocates the processes to CPU as per some policy called as scheduingaigorithms.
CPU busy all the time.
ne man aim
of the scheduling is to improve performance by keeping
Criteria for the performance evaluation ofthe scheduling strategy is:
switching is minimized. The context switching overheads could be lowered by performing context switches
infrequently. This could, however, result in increasing the response time for processes.
turnaround time is minimized by
b. Average turnaround time and maximum waiting time: Average
executing the shortest tasks first. Such a scheduling policy could, however, starve long-running tasks and
that
algorithmns
1. Non-Preemptive : Non-preemptive algorithms are designed so
Microkernel size is smaller than monolithic kernel. It has a larger size compared to microkernel
Execution speed is slower than monolithic kernel. Execution speed is faster than microkernel.
It is more flexible. Any module can be replaced. It is not flexible as compared to microkernel. Its
component cannot be changed, without doing a total
shutdowm and perhaps even a full recompilation and
reinstallation.
Crash of one service does not affect working of other After crash of service complete operating system
part of microkernel. fails.
In microkernel, communication is through message Kernel calls the function directly.
passing
Performance degradation due to context switching Monolithic operating systems have drawbacks from
and communication overhead between different the viewpoint of openness, software
engineering,
modules. reliability, or maintainability. It has lack of flexibility
and having huge size.
Operating System Overview
Operating System (MU) 1-20
The interface calls that operating the system
between OS and user
to by
defined the set of system
OiTers. System
em callcalls
is the
make
call
un ththe operating is
for programs
programs svstem definea
Derform some task on behalf of the user's program.
Dy
first Operating system, applications do not have direct access to the computer hardware. Applications
user
request to the kernel to
get hardware access and access to computer resources.
During execution when application invokes a svstem call, it is interrupted and the system switches to Kernel
space. The kernel then saves the process execution context of
call. mterrupted prpces and determines purpose or the
T h e kernel warily makes sure tHat the_request is valid and that the process invoking the system calls has
sufficient privilege. Some of the
system calls canqnlylbe invoked by a user with super user privilege.
OIf the whole thing is fine, the kernel processe_ the request in kernel mode and can access the device drivers in
charge of conttelling the hardwaye. The data of the calling process can be read and modified by kernel, as it has
access to memory
in úser space
OBut, it will not execute any cqde from a user application, for clear security reasons.
DWhen the kernel finishes the processing of request, it restores the process execution context that was saved
when the system call was invoked.
1-22 Operating System
Operating System (MU)
because those methods mit sthe
do not limit Overie
method,
S o m e operating systems favor
the block or stack
number Op
length of parameters being passed.
***
1. Process contro
www.x RINKNRRRKEAKAYAAA WSOR
2. Device manipulation
2.
3. Communications
******ww*******w w w.wwewwwrwermerm wwwawn
4. File manipulation
www.ww******* *********
wwww***w*******|
3
5. Information maintenance
1. Open
Definition:An operating system acts as an interface between the user and hardware of the computer and also controls
Operating System
Servicess
w..ww
ww*wwwA
wwwww NAAAMWN
1, User Interface
********
****
2. Program Execution
wwwwwwwwwwwwwwwwwwwwwwwm
*** ****
3. 1/O Operations
********
5. Communications
wwwwwwww monwwe awewwwww
******* *wwwwww A
6. Error Detection
Techub::tKnomledgë
aionS
Operating System (MU)
1. User Interface
command-line
with the operating system through
Users either interface command.
executes next user-specified
GUI. Command interpreter
intertace.
as an
window and menu system
A GUI offers the user a mouse-based
2. Program Execution
3. 1/0 0perations
without taking any input.
This involves the use
of 1/0. During
OEach program requires cannot produce output
output.
perform I/0 operations for input
or
execution, program requires to
in three ways i.e. programmed I/0,
state. 1/0 can be performed
Until 1/0 is completed, program goes in waiting
the task
OThe user does not have to worry about secondary storage management. Operating system accomplishes
command specified by user.
of reading from files or writing into the files as per the
The
Although the user level programs canprovide these services, it is better to keep it with operating system.
execution speed is fundamental to I/0 operations.
reason behind this is that, program
5. Communications
TechKnouledge
ubiic ations
Operating system (MU) 1-9 Operating System Overview
This communication can be realized by making the use of user programs by customizing it to the hardware that
facilitates in transmission of the message.
Customization of the user programs can be done by means of offering the service interface to operating system to
realize communication among processes in distributed system.
Iu this way the communication service will be provided by operating system and user programs from will be
free from taking care of communications.
6. Error Detection
a In order to prevent the entire system from malfunctioning, the operating system continually keeps watch on the
system for detecting the errors.
User programs kept free from such error detection to improve the performance.
On the contrary, if this right would have been kept with user programs, most of the user
program would have
wasted time in error detection and actual work would be minimized
resulting in performance degradation.
Operating system needs to carry out complex tasks during the process of error detection.
aSuch task comprises deal location of many resources such as processor,
memory etc. If these tasks are again kept
with user programs, then it may disturb the normal
operation of operating system.
2.3 Process States
Each process remains in one of these five states. There is a queue associated with each state of the process.
Process resides
onthat queue as per the state in which it resides.
Tech Knowledge
Pubilc ationS
Process & Process Schedulino
2-3
Operating System (MU)
1. New state
2. Ready state
to it.
it is waiting for CPU being assined
A process is ready to run but
3. Executing state
it and it is executing,
CPU is allocated to
state if currently
A process is said to be in running
4Waiting(blocked) state
event to happen such as 1/0 completion. Process
execution because it
is waiting for
A process can't continue
the
external event happens.
is able to run when some
5. Terminated state
execution.
The process has completed
is shown in Fig 2.3.1.
The process state transition diagram
Terminated
New
/Finished
Submitted Interrupt
Executing
Ready
Dispatched for execution
I/O or event
VO or event completion
Waiting
diagram
Fig. 2.3.1: Process state transition
from executing
OWhen CPU is executing the process, it is in executing state. After context switch, process goes
initiates an I/0 operation before its allotted time expires, the executing
proces
ready state. If executing process
voluntarily give up the CPU.
I n this case process transit from executing to waiting state. When the external event for which a proces
sitto
waiting happens, process transit from waiting to ready state. When process finishes the execution, it trau
terminated state.
Tech ANONI
PubilCa
2.5 Process Control Block (PCB)
process
which are in the same
Traffic controller module keeps track on the status of the processes. PCB's of the processes
name to the list such as ready
list.
state (ready, executing, waiting etc) are linked together giving specific
a
OIfdevice becomes free then traffic controller checks the PCB chain to see if any process is waiting for the device.
If the processes are available in that device chain, then again it is placed back to ready state to request that device
again.
Process ID
Priority
Program counter
Registers
Accounting
Memory allocations
Eventinformation
List of openfiles
Fig. 2.5.1: Process control block
Tech Knowledge
PUb'iCationS
Operating System (MU) 2-6 Process& Process Scheduling
Pointer: This field points to other process's PCB. The scheduling list is maintained by pointer.
1.
2. Current state : Currently process can be in any of the state from new, ready, executing, waiting etc as
2.
described above.
3. Process ID : ldentification number of the process. Operating system assign this number to processto
distinguish it from other processes.
4, Priority: Difterent process can have different priority. Priority field indicate the priority ofthe process.
5. Program counter: Atter context switch, CPU is given to other process. When turn of the previously
executing process comes, again CPU gets allocated to it. Program counter contains address of the instruction
from which execution resumes after context switch.
6. Registers : It includes general purpose register, index registers, stack pointers and accumulators etc
number of register and type of register differs as per the architecture of computer. The state information
stored after interrupt is again used by the process to resume the execution.
7. Accounting : Information for calculating the process's priority relative to other processes. This may include
accounting information about resource use so far. It also includes amount of CPU time and real time used,
time limits, process numbers and so on.
8. Memory allocation: This information may include the value of base and limit regíster. It includes paging
segmentation related information depending on the memory system used. Address space allocated to the
process etc.
9. Event information: For a process in the blocked state this field contains information concerning the event
for which the process is waiting.
After creation of the process, hardware registers and flags are set as per the details supplied by loaders or
linkers.
At any time the process is blocked, the processor register's content are generally placed on the stack and the
pointer to the respective stack frame is stored in the PCB. In this fashion, the hardware state can be restored
when the process is scheduled and resume execution again.
2.6 Scheduling
aSystem places all the entered processes in job queue. All the processes in the system reside in job queue.
aWhen processes are ready for the execution and wait for CPU, they kept in ready queue.
Apart from the job queue, the operating system also has other queues.
Whe processes wait for particular device, they are kept in respective devices queue.
Tach Knowledge
Kernel tnreaas aregenerauy requires more ume w ereaeau uiauage uar a
O In this implementation, all the thread management functions are carried out by user level
space. So operations on thread do not require kernel intervention.
thread
package at usel
package.
Three types of
multithreading models
1. One to one
2. Many to one
3. Many to many
Tech Knowledge
PubIICa tiov
Operating System (MU) 2-20 Process & Process Scheduling
Therefore concurrent execution of threads cannot be achicved. This type of relationship facilitates an effective
context-switching environment, easily implementable even on simple kernels with no thread support
User level threads
a Many to many association exist between user level thread and kernel level thread in this model.
a It means that more number of user-level threads are allied to equal or less number of kernel-level threads.
aThe necessity of altering code in both kernel and user spaces leads to a level of complexity not present in the one
tone and many to one
model
O Like many-to-one model, this model offers an efficient context-switching environment as it
calls. repel from system
The keen complexity offers the potential for priority inversion and suboptimal scheduling with minimum
coordination between the user and kernel schedulers.
Q. What is operating system? MU-Dec. 14, June 15, Nov. 15, Dec. 18, 2 Marks
Q. Discuss Operating System as a Resource Manager. MU -Dec.19, 5 Marks
A n operating system is system software which manages, operates and communicates with the computer
hardware and software.
Definition :An operating system acts as an interface between the user and hardware of the computer and also controls
the execution of application programs.
User's program should get the processing unit to complete the execution and computer system should offer the
service to allocate processing unit to users program.
a The operating system allocates memory to user program as per need. In the same way, user programs interact
with the other user programs through devices like key board, or a mouse or even a joy stick.