Vous êtes sur la page 1sur 24

Table of contend

Operating system...........................................................................................................................................................................2
There are three kinds of software ..................................................................................................................................................2
Functions of operating system .......................................................................................................................................................3
Process state diagram ...................................................................................................................................................................3
Components of process state diagram ...........................................................................................................................................3
CPU scheduling ..............................................................................................................................................................................4
Algorithm of scheduling .................................................................................................................................................................4
Round robin scheduling .................................................................................................................................................................6
Scheduling in operating .................................................................................................................................................................7
Diagram of scheduler .....................................................................................................................................................................8
PCB(PROCESS CONTROL BLOCK).....................................................................................................................................................8
BUFFERING AND SPOOLING ...........................................................................................................................................................8
DEADLOCK .....................................................................................................................................................................................9
Dos BIOS and Interrupts ...............................................................................................................................................................10
What is thread? Explain multithreading. ......................................................................................................................................10
What is operating system? Explain types of operating system? ....................................................................................................11
Memory management operating system .....................................................................................................................................13
Multiprogramming with single monitor .......................................................................................................................................13
Multiprogramming with multiprocessors .....................................................................................................................................13
Dynamic or variable partition ......................................................................................................................................................15
Paging .................................................................................................................................................Error! Bookmark not defined.
Diagram for presenting paging .....................................................................................................................................................19
Segmentation ..............................................................................................................................................................................19
Difference between paging and segmentation .............................................................................................................................19
Swap in and swap out ..................................................................................................................................................................20
Difference between paging and swapping....................................................................................................................................21
Demand paging ............................................................................................................................................................................22
Page replacement ........................................................................................................................................................................22
Algorithm of page replacement ...................................................................................................................................................22
Operating system
Software :- The well collection of program written in computer language on the computer system is called
software.

There are three kinds of software


1. System software
2. Application software
3. Utility software

1.System software:-Which software control or manages all over the system known as system software

For .e.g., system software are operating system ,compiler, interpreter etc.

Operating system:- It is an example of system software it executes application program with respect to their
interfaces

Function of operating system

 Process management
 Memory management
 File management
 Device management
 Command line arguments
 Security management

2.Application software:-Which software provides application or task related to the user using different application
known as application software is either based on command line interfaces or graphically user interface.

For .e.g., ms-office, busy ,tally , Qbasic , photoshop etc.

3.utility software:- Which software provides the security between system and application known as utility
software.

It managements system and user files located into the disk

For .e.g., disk defragmentation , scandisk , anti-virus etc.

Objective of operating system.

 Managing all resources related to the computer system.


 Making a system and convention to use.

Managing all resources related to the computer system :-

The device management is an important function of operating system it manages input and output devices works
with the controls given into system programs.

Making a system and convention to use.

Operating system executes both application like command line and graphically user interfaces. The graphically user
related programs are more convention due to tools or option guided by pointing device, which is connected to the
computer system
Functions of operating system
Process management :- The term process is an active entirely of the program which is saved into backup memory.
In multiuser operating system the process management provides numbers of control for executing one by one
through CPU for which it stabiles is process state where new job, redique ,running , suspended /swapped ,outline
and terminated are given

Memory management:-It is an important part of operating system. operating system wants maximum utilization of
main memory and higher through put.

To manage main memory operating system create partition and allocated our process into the exact space of the
main memory .

File management:-The term file mains collection of related data and the name of file must be unique .It is an
important to manage our files form the disk operating system is responsible for tracking the file and display
contains of the file on the screen .we known that the file is allocated into the disk , operating system located the
file form disk and display on the system .

Device management:- operating system follows the device driver for calling hardware resource ,which is connected
to a system .

In other word we can say that resources are called by the device driver using control in operating system the basic
output system is responsible for managing all the resources related to the system requirement .

Command line arguments:- operating system is classified into CLI and GUI where command line interface uses set
of operation related to the file definition manipulated and control management also

Security management :-It is an important to provide to security to file related to the user and system it gives the
role of administrator to run executed any type of program in the period of installation . today , unix (multiuser
operating system) provides vast to maintain security concern of the administrator and user.

Process state diagram


Program process
active

Swapped in
Swapped out

New job Ready queue CPU Terminator

Suspended
block

Components of process state diagram


1. New job:- The job or program is created in the position of new job. After creating in the program it
allocates into backup memory.
2. Ready queue:-Set of process are sorted into the main memory for executing on latter. It is also called
main memory.
3. CPU Or running:- In process state diagram the CPU Or running is the step where set of instruction are
executed into and order
4. Terminator:- It is the finial step of the process state diagram.
5. Suspended block/state:-It holds set of processes which occurs and error related to the device driver, After
error free by the user locates into main memory for executing through the CPU

6. Swapped out/In:-In process state diagram swapped out/In help our system for sending our process to the
backup memory when memory space is not enough similarly , the process execute through the CPU our
process is recall by backup memory to the main memory that process is called swapped In.

Through put:- A set of processes executes within a period of time, than unit of time is called through put.

Suppose, there are five processes hold or wait in main memory. CPU wants to execute this process one by one, it
perform a unit of time is called through put.

Waiting time :- The unit of time hold or wait in main memory for executing or later, the constant time of that
process wait in main memory is called waiting time. The waiting time various according to algorithm because it
evaluated by the process of pre-emptive and non pre-emptive scheduling algorithm.

Turn around time :- In process management the turn around time is a time generated where CPU time and waiting
time

In other word, we can say that turn around time=CPU time+ waiting time

The time submission and completion is called turn around time .

Response time :- In process management our process execute first instruction on the system through the CPU and
it produced a message either positive or negative in a period of time, it is called response time.

CPU time and burst time :- In process management the time of completion of each process is called CPU time. The
CPU time use maximum time given by an administrator during execution of the process.

CPU scheduling
The term scheduling it means schedule all process before use. An important role CPU scheduling is to make the
system efficient , fast and fair when ever the CPU become ideal. The operating system must select on of the
process is ready queue to be execute.

In process management set of process are managed before executing there for operating system maintains an
algorithm and sequence for arranging this process into process state diagram.

The scheduled selects from set of process in memory that are ready to executed and allocate the CPU to one of
them.

Algorithm of scheduling
There are two type of scheduling

1. Pre-Empitive scheduling
2. Non per-Empitive scheduling

1.pre –Empitive scheduling :-A scheduling discipline is pre-Empitive is ones a process has been given a CPU taken
away. On this way CPU accept that process and print to another.

It is the responsibility of the CPU scheduling to allot a time maintain by manager of the system .
The resource are allocated approaches for limited time It is flexible therefore it is not rigid for declaring the
compression time because it various time to time the best e.g., of pre-Empitive scheduling is Round robin
scheduling .

2.Non pre-Empitive scheduling :-It is an algorithm based on non pre-empitive based process.

Once resource are allocated the process holds it till it completes burst time given by the CPU . Process can not be
interpreted till it terminates or because the time of burst or complication is fixed by the system manager. An e.g.,
given non pre-Empitive scheduling are:-

FCFS(First come first serve)

LJF(Large job first)

SJF(Large job first)

LIFO(Last in first out)

First come first serve :- It is an example of non pre-Empitive scheduling algorithm .It depends upon arrival of
process therefore list of process and there burst time calculate the waiting time and turn around time according to
there arrival of process.

It is the simples way from arranging set of process into a table and execute these process after follow turn around
(completion time waiting time).

Process CPU time Arrival time Waiting time Turn around time
P1 10 0 0 10
P2 15 0 10 25
P3 5 0 25 30
P4 25 0 30 55
P5 20 0 55 75
Average waiting time = total waiting /5

= 120/5=60

Shortest job first :- It is an example of non pre-Empitive scheduling.

It provide longer waiting time because process are non pre-Empitive till the CPU used total complication time in
the period of execution.

Process are scheduling according to CPU time in ascending manner.

Process CPU time Arrival time Waiting time Turn around time
P3 5 0 0 5
P1 10 0 5 15
P2 15 0 15 30
P5 20 0 30 50
P4 25 0 50 75
Largest job first:- It is the non pre-Empitive scheduling algorithm. It words with larger job first because larger CPU
time related processes are executed first and rest will be queue according to there order.

It gives turn around time and waiting time went CPU time and arrival time both given into the table.
Process CPU time Arrival time Waiting time Turn around time
P4 25 0 0 25
P5 20 0 25 45
P2 15 0 45 60
P1 10 0 55 65
P3 5 0 60 70

Round robin scheduling


It is the CPU scheduling algorithm where each process is assigned a quantum time. Operating system provides
single time slice of each process at the same time if more than one each process then it goes to tell of the ready
queue and call again.

It is the simples way for implementing the scheduling algorithm and provide quick and immediate response. It is
the most commonly use technique in CPU. The Round robin scheduling works with pre-Empitive process algorithm
therefore no any process can hold or wait on longer waiting time.

CPU Arrival Completion Waiting Rest Turn around


Process
time time time time time time
P1 5 0 17 17 20 17
P2 7 0 27 27 410 24
P3 10 0 34 34 7410 34
P4 3 0 12 12 0 12
P5 12 0 37 37 9630 37

Gantt chart
Queue quantum time: 3
P1 P2 P3 P4 P5 P1 P2 P3 P5 P2 P3 P5 P3 P5
P1 P2 P3 P4 P5 P1 P2 P3 P5 P2 P3 P5 P3 P5
0 3 6 9 12 15 17 20 23 26 27 30 33 34 37
Gantt chart
Queue quantum time: 3
P1 P2 P1 P3 P4 P5 P3 P2 P5 P3 P5 P3 P5
P1 P2 P3 P4 P5 P1 P2 P3 P5 P2 P3 P5 P3 P5
0 3 6 8 11 14 17 20 23 26 27 30 33 34 37
CPU Arrival Completion Waiting Rest Turn around
Process
time time time time time time
P1 5 0 8 3 20 8
P2 7 2 24 17 410 24
P3 10 5 34 24 7410 34
P4 3 6 14 9 0 12
P5 12 10 37 25 9630 37

Scheduling in operating
The turn scheduling is a program which provide service through CPU from main memory. It selects the process
from ready queue one running.

It is an important role of CPU scheduling algorithm. We know that the scheduling is manner for executing set of
jobs through higher through put and use maximum CPU time by the way of long, medium and short turn
scheduling.

There are three kinds of scheduling

1.Long term scheduling

2.Medium term scheduling

3.Short term scheduling

1.Long term scheduling:- It consumes maximum CPU time because long term scheduling follows the new job ready
queue, running and terminate.

Similarly, rest all scheduler user less CPU time compare to long term scheduler.

In other word we can say that the scheduler select the job form newly assembled by the programmer terminates
successfully.

2.Medium term scheduler :- It is the kind of scheduler .It follows the process state diagram and also select the job
form suspended, swap out/in stage and send it to the CPU for executing.

It is different from long term scheduler because distance covered by medium term scheduler is less than of that. It
select error prone program from suspended block and send it to the tail of ready queue after compile of that
process in this situation process will be either executed or suspended with respect to instruction used by the
programmer.

3.Short term scheduler:- It is the simplest the program because process are added or selected from ready queue
then after send into the CPU for executing. It consumed little bit time because distance covered by short term
scheduler is less than other.

It is very important for managing set of processes because scheduling mechanism main a manner for arrange set of
processes before use. In this situation short term scheduling select the form ready queue and send to the CPU one
by one using constant interval of time.
Diagram of scheduler

Swapped out/In

New job Ready queue CPU Terminator


STS
I/O ERROR I/O
FREE INTERUPT
Suspended queue
MTS
LTS

PCB(PROCESS CONTROL BLOCK)


It is an array of total information about process for selecting that process by the scheduler after knowing about
process state, process id program counter, Register local block etc.

A process control block consist of information about the process which denotes their existence in a ready queue.
We known that three kinds of scheduler select the process form main memory and send it two the CPU for running

Description of PCB

1. Process state:- It holds the prospective state of the process


2. Process id :- Every process is assigned with a unique id known as process id. It is the unique for all
processes.
3. Program counter:- It holds an address of the next extension that is executed for the process.
4. Local block:- It is an area where processes are stored. It is the local block where variable are defined or
declare. It is necessary to define the set of variable where variable are defined or declare.
5. Global block :- There are sum variable used in our program, These variables are generate declare as a
global not for local because the value of that variable are executed form whole program.

The process control block is generated when our process is initialized form new job position and our PCB is
destroyed when the process is terminated.

BUFFERING AND SPOOLING


In operating system the buffering is a process to store process data to the temporary buffer and speed up the rate
of CPU, In this situation process management maintains the concept of buffering and overlap all the process one
by one according to their process state diagram.

The buffering process true for the higher through put and maximum utilization of CPU .

In practical , process management uses a buffer between CPU and output resource. When processed data goes to
the buffers then CPU is free from the process and accepts and another process for executing.
We know that speed of CPU is very fast compare to other if the speed of an output device is slower and
interpreted for any condition then CPU goes to ideal stage. Operating system worried about that situation for
which buffer store processed data one by one upon it. But the demerit of buffering , it is overflow then no any
resources will be executing successfully.

The term spooling it means simulations peripheral operation online work with the total resource at the same time.
If any resource has not working the spooling activate all resource able for working continuously.

DEADLOCK
Deadlock is a situation occurred by process management method. In this situation no any processes will be
terminated. When acceptation of deadlock are permitted by CPU scheduling management.

In our system resources are limited for executing set of programs. But in multiuser operating system process are
unlimited and want to execute through CPU using the process state diagram. If follows three satirizes for
avoidance of deadlock like request to thee resource, use the resource after completion of time .

In multiuser operating system process always send their request to the resource without knowing about there
engagement of resources. If the request with relating it previous, in this condition to deadlock condition .

R1 R1

P1 P1

Request to resource Use of resource by p1

 Deadlock condition :-
1. Hold or wait
2. Circular wait
3. No preemption
4. Mutual exclusion
 Represent of deadlock

R1
P2 DEADLOCK P2

R2

R1:-Resource

R2:-Resource

P1:-Process

P2:-Process

1. Hold or wait:- There must exists a process that is holding at list one resource and is waiting to required
addition currently being held by other processes. This conduction is done when resource request to one
process and again required will be accepted without releasing its previous and that situation deadlock is
created
2. Circular wait:- In deadlock there are set of processes goes to waiting according to an order therefore list
of process create a shape called circle and this type of hold or wait condition called circular wait.
3. No preemption:- Resources cannot be preempted that is a resource can only be related by process
holding it after the process has completed is task.
4. Mutual exclusion:- A list one resource is held in a non-shareable mode that is only one process at time can
used a resource the requesting process must be delayed until the resource has been released.
 Avoidance of deadlock:- Deadlock is a state in which a process is waiting for the resource that is already
use by another process and that another process is waiting for another resource.
o There are two avoidance of deadlock.
1. Safe state
2. Unsafe state
1. Safe state:- In this situation process are execute in sequence there for no another process is running at a
time.
2. Unsafe state:- In the unsafe state there are multiple process running and requesting resource that may
because a deadlock to occurs.

Dos BIOS and Interrupts


In disk operating system maintains a check list were resources related to the system are configured on the related
program. In the period of booting BIOS check all the resources in our system are properly working or not. If all the
resources are added and ready for execution then booting process is continued now, otherwise it generates and
error known as BIOS Interrupts.

It is the basic parts of system where system programs are configured into the BIOS program dialog box We know
that the residence of BIOS is read only memory.

The term booting is also related to the BIOS Interrupts because system is on and information goes to the BIOS for
checking all the devices will be properly done or not. If all the resource available in our system and ready for
execution then booting process is continued now, otherwise Display a message “boot failure”.

Device driver:- If is an important for executing our device when related drivers are configured into the system
using suitable program. It is made by system software therefore device are configured when related drivers are
properly installed into the system for working.

Generally, device driver are machine dependents. In this situation programmer developed the software after
knowing about requirement of the machine given by the system. The c-programming language is capable for
developing device driver and execute properly.

What is thread? Explain multithreading.


Ans:-A thread is a basic unit of CPU utilization where numbers of objectives are used for their functioning. We
known that process is a heavy weighted because its consists of stack, code of the program and program counter
register.

It is the path of execution within the a process therefore each thread consists of program counter stacks function
and processor related to application of the user.

Role of thread

In each process there are multiple functions are used and each functions are provides basic utility of that program
therefore used of thread means application of user in capsulated by function where it has.
Code Code Code Code
Stack Stack Stack Stack
Pc Pc Pc Pc
Function Function Function Function
. . . .
. . . .
. . . .
. . . .
Single
. Thread . . . Multi Thread
. . . .

 It uses when multiple program are executed

Multi Thread:- A thread is also known as light weight process. A process given into multiples thread or
numbers of code, functions, stack and program, counter therefore collection of multiples information are
called Multi Thread

For.e.g., In a browser, Multiple tabs can be different threads similarly, Microsoft word uses Multiple Threads, one
threads to the format the text another threads to save our data to the specific file, close the file from the desktop
etc.
There are options of Microsoft word is called Multi Thread based program.

What is operating system? Explain types of operating system?


Ans:- It is an example of system software it executes application program with respect to their interfaces

Objective of operating system.

 Managing resources related to the computer system.


 Making a system and convention to use.

Managing resources related to the computer system :-

The device management is an important function of operating system it manages input and output devices works
with the controls given into system programs.

Making a system and convenient to use.

Operating system executes both application like command line and graphically user. The graphically user related
programs are more convention due to tools or option guided by pointing device, which is connected to the
computer system

Type of operating system

1. Real time operating system


2. Time sharing operating system
3. Distributed operating system
4. Batch operating system
5. Multiprogramming operating system
1.Real time operating system(RTOS):- A real time operating is a multiuser multitasking operating system

Multitasking operating system, which indented for using fixed deadline for computing such application include sum
system program as for e.g., auto mobile, engine controller, industrial control, Defense tool controlling system and
sum large real computer system.

The real time operating system can be classified into two carious.

1. Hard real time


2. Soft real time

1.Hard real time:- A hard real time system granted critical task be completed time. This goal required that all
delay in the system be bounded from the stored data to thee time, executed by the time interval given to the
system.

2.Soft real time:- A soft real time system less restive time of real time operating system here a critical real time
task until it completes rest all operating system given to the operating system.

An application uses soft real time is messaging system related to communication media.

2.Time sharing operating system:- It is also multiuser multitasking operating system. It provides a time given to all
process or jobs execute in the time interval, If the time of CPU is greater than the time sharing given by operating
system then, call again and arrange it to the tail of ready queue.

There are some extra facility application for facility.

 Faster switching between multiple job to make processing faster.


 It allowed multiple to shared computer system simultaneously.
 The user can interrupt with each job while it is running.

3.Distributed operating system:- It is also an example of multiuser multitasking operating system. In distributed
system the different machine are connected in a network and each machine has own processor and own local
memory. In this system, the operating system on all the machine worked together to manage the collection
network resource.

It can be classified into two categories

1. Client server.
2. Peer to peer networking.

4.Batch operating system:-This type of operating system accepts more than one jobs and these job are batch
together according to there similar requirement. This is done by computer operator. When ever the computer
become available batched jobs are send for execution but one and only one program is executed at a time.

In other words we can say about batch operating system, It is allowed only one program at a time executing
through the CPU. This operating system is responsible for scheduling the jobs according to priority but the
resource is required for each and every program.

5.Multiprogmming operating system:- This type of operating system is used to execute more than one jobs
simultaneously by single processor it increase CPU utilization by organizing jobs that the CPU always has one job to
execute at a time using an operation.

The concept of multiprogramming is described as following objective all the job that inter the system are store in
the disk.
An operating system simply switches to on job and another there for all the job are scheduler before use. It is
followed the multiuser operating system therefore we
can say that multiple process order in a queue goes to the CPU one by one with respect to there turn around time.

This type of management is processed by multiprogramming processing and the system software required for
executing there processes is said to be multiprogramming operating system.

Memory management operating system


It is the function of operating system. It manage or controls our main memory where number of processes are
arrange in a queue and ready for execution.

Operating system wants maximum utilization of main memory and also higher through put. In process
management system operating system provides several time for their execution known as wait time, turn around
time, submission time and completion time.

Multiprogramming with single monitor


As we disused earlier, Operating system uses number of processes, arrange into the main memory and scheduling
send one by one process to the CPU for executing but pair multiprogramming with single monitor say that one and
located into the main memory at a time. In this case there are no any extra different will be done due to maximum
space of memory are free for next incoming processes.

In single user operating system, user open one and only process at a time.

In this situation maximum memory is same .Because one and only one process is allocated in ready queue.

Operating system 48kB

P1
2000kB

Multiprogramming with multiprocessors


In multiuser operating system our main memory are partitions for allocating set of process into required frame
according to the process table given by operating system.

There are two ways for partition our main memory.

1. Static or fixed partition


2. Dynamic or variable partition

1.static or fixed partition:-It is done by operating system. It produces partition are created before allocating
process in main memory.

In other word, we can say that no any partition are created with respect to size of the process therefore three
strategies are use for allocating processes in main memory. These three strategies are First fit, Best fit, Worst fit.

Process Memory management

P1 200

P2 180

P3 120

P4 220
P5 250

Os 48kb
100
P3 120
150
First fit
140
P1 250
P2 260
2000kb
P4 300
P5 330
210
90

Os 48kb
100 Best fit
P3 120
150
140
P2 250
2000kb
P4 260
P5 300
330
P1 210
90

The above table show that, processes P1(210), P2(250),P3(120), P4(260), P5(300) are occupied suitable memory
space in shareable memory by the help of best fit strategies.

We know that the best, Fit allocation technique consumed a lot of time for allocating process in fixed memory
allocation method.

The process P1, P2, P4, P5 processes are occupied maximum memory spaces therefore these process has occurred
internal fragmentation, which is not shareable to another process due to these partition are fixed or statics.

Suppose process P6 wants to allocate in main memory for executing in later but, the memory requirement of that
process is about 350kb. Operating system scan all partition from main memory. But no any exact and nearest
partition and wait from outer side of the main memory.
The process P6 suffers from external fragmentation.

Dynamic or variable partition


In operating system the partition will be done. When processes goes to the main memory for its allocation not
fixed but it varies from one to another.

In dynamic partition number of partition in main memory are created during the time of allocation not for the pre-
allocation of their jobs.

In other word, we can say that the run time allocation is called variable or dynamic partition similarly compile time
allocation is called static or fixed partition.

Process Memory space(KB)

P1 220

P2 180

P3 160

P4 300

P5 350

Os 48kb
P1 220kb
P2 180kb
P3 160kb
P4 300kb
P5 350kb
790kb
2MB
The above table and memory representation shows that the size of each process is occupied on main memory run
time therefore no any internal fragmentation is generated here.

Suppose process p6 wants to allocated in main memory and required 350kb then allocate. On run time and rest
free spaces 440kb shared to the incoming process used in multiuser operating system.

According to arrival first p1 goes to the CPU and terminate successfully. In multiuser operating system the process
p7 wants to allocates in main memory at required 500kb memory in size then, it suffers form external
fragmentation.

On that situation p7 goes to hold or wait outer side of the main memory

Os 48kb 48kb
P1 220kb
P2
180kb
P3
P4
160kb
P5 300kb
P6 350kb

440kb
Os
220kb
P2
180kb
P3
160kb P4
300kb P5
350kb P6

440kb

Compaction :- In variable partition the compaction is a method to solve external fragmentation after cool down all
partition and create singe partition in the button of memory.

It is not applicable in fixed partition in memory management because static or fixed partition are not breakable
therefore compaction can not resolved. That problem in memory management technique.

In other word, we can say about compaction it is resolve the problem of external fragmentation regarding variable
or dynamic partition based memory management.

The about memory represent, the process P7 can not allocated due to lack of partition therefore compaction
combined both partition and form a single partition of total size admit the request the P7 and rest spaces free
from the next incoming process.

What is fragmentation? Explain types of fragmentation.

Ans:- In memory management the fragmentation is the acronym of free spaces but not shareable to incoming
process. It occurs on both statics and variable partition.

There are two types of fragmentation generated by memory management technique.

Internal fragmentation:- The fragmentation is called internal when the process is occupied extra spaces in memory
it generates only static or fixed partition. Because the partition are created before allocating of the job.

Os
P1
P2
P3
P4
P5

An external fragmentation is also non sharable spaces of memory but it is not occupied internally. On both type of
partition, properties of external fragmentation will be changed according to its own characteristics.

An external fragmentation represent non contiguous manner. In dynamic or variable partition best memory
management , an external fragmentation is resolve easily by the help of compaction tool.

Write short note or following?

1. Memory map table


2. Page map table
1.Memory map table:- The memory table(MMT) is a memory mapping system shows that all possible partition in
memory are free or allocated. In this condition references of total partition are given for allocating another file,
this type of measurement is called memory map table.

In statics or variable partition , therefore some partition are allocated and free randomly we know that the
character of both partition are different because processors are assigned in compile and run time allocation.

The memory map table is a mapping system which denotes a list of free and allocated block for addressing the file
into the memory on later.

2.page map table:- It is an index where page and page frame number are given. In other words page map table
array represent where two column maintained by operating system where first is called page number and another
is called page frame number.

In paging system, operating system locates our file from PMT the after read, write to the memory in the period of
processing.

Paging
In operating system the paging is a memory management technique use for classified our main memory into the
equal sizes blocks and allocated the page into it. It saves the spaces of main memory because large process is
executed through single page frame at same time.

It is a memory management technique in which memory is divide into fixed size pages. Paging is used for faster
access to data.

When a program needs up page it is available in the memory at the operating system copy a certain number of
paged from your storage device to main memory. Paging allows the physical address space at a process in non-
contiguous manner.

Operating system perform an operating for storing data for secondary storage then after allocate in main memory.
It is deal with external fragmentation problem and may be internal also.

O.S
Page 1

Arbitrary
Page 0
Program
Page 1
6200 BYTE

Page 3
External memory
Page 4
F =m/p

=6200/1024 Page 5

F = page frame Page 6

P = page

F=7 the size of page will be fixed equal


Page map table
Page Page frame
0 1
1 2
2 4
3 5
4 6
5 7
6 8

The above partition of memory management says that a process(6200 byte) wants to allocate in memory and size
of each frame is 1kb then total frames are evaluated by F=m/p where “F” is the total memory requirement and p is
the size of page.

After calculated, we have about 7 frame required allocating the paging system therefore we can say that last frame
occurs internal fragmentation. We know that the paging mechanism based on non contiguous of arrangement of
pages therefore page map table creates a list where page frame and page number operating system assigned all
pages into required page frame number and execute through the CPU on letter.

The purpose of memory management unit is to convert the logical address into the physical address. The logical
address is address generated by the CPU for every page while the physical address is the actual address of the
frame where each page will be stored.

When a page to be access by the CPU by using logical address, the operating system needs to obtain the physical
address to access that page

The logical address divided into two parts:-

1. Page number
2. Offset

Memory management of unit of operating system needs to convert the page number to required frame number.

For example :- A process need same memory required then CPU creates logical address for addressing those pages
in memory after this event logical address directly co-related to the physical address where frame number and
offset value are given.

Note:- An offset is the value given into both logical and physical address position. If defines actual and visual base
address in memory. Logical address
CPU PAGE NO/OFFSET FRAME/OFFSET
Diagram for presenting paging
logical address physical address
Page Page frame
CPU PAGE NO/OFFSET FRAME/OFFSET
0 1
1 2
2 4
3 5
4 6
5 7
6 8

Physical memory

Note :-Logical address is generated by CPU

Segmentation
In operating system, the segmentation is a process or mechanism use for splitting our program into multiple slices.
Each slice or part of segmentation is equivalent to the thread or process. This process is done by operating system
from backup memory.

As be discuses earlier, large program or process can be execute from small hole of the memory therefore
operating system firstly segment of that process into external memory and execute one by one segmented part
through CPU by the help of demand paging technique. The segmentation consider a program is divide into five
segment of a process such as processor stack, libraries function, local block area, global block area, sub-routine etc.

The segment part of process is arbitrary in size it maintains segment number and the offset value. If is specified
user not for the hardware resources
Difference between paging and segmentation
Paging Segmentation

1. Paging is a fixed block size 1. A segmentation is variable or arbitrary in size

2. It is generated in memory 2. It is generated in backup memory

3. In paging CPU generates logical 3. It segmentation the size of each block depends on the size of

Address but latter. It gives physical component of the program like function , processes, stack , local

Address where pages are allocated block etc.

4.Paging involves a page map table 4. It involves a segmentation table that contains segment

That contains frame and their program number and their offset value

5.Paging process may be occurred and 5. It may be lead to only external fragmentation because

Internal fragmentation which is the last the size of each block in segmentation is pre-define

Frame that of the process in size.

Swap in and swap out


The swapping is mechanisms in which a process can be swapped temporality out of main memory to
secondary storage and make that memory available to other process. At some later time the system
swap back the process from secondary storage to main memory.

It is related to memory management, It effects by swapping process but it helps in running multiple and
process in parallel , that reason swapping will be done and executes a lot of process through shareable
memory same time.

Suppose a process need single partition and the size of income process is not available in memory
therefor that process goes to hold or wait on longer time. As be discussed aerial the scheduling
processes, Operating system, select any process which is suitable for the incoming process which has
long waiting time of executing, In this condition operating system shift that process from main memory
to backup memory, This process is called swap out.

Similarly higher priority related process allocated into the main memory for executing currently this
process is called swap in. On the sum interval of time our process which is shifted into the backup
memory is assigned currently main memory and executed through the CPU within current interval of
time.
Difference between paging and swapping

Paging Swapping

1.It allows the memory management at the 1.It allows multiple program in contiguous memory

space of a process to be non-contiguous allocated in main memory

manner.

2.It is more flexible because page of a process 2.It is less flexible because it moves entire back from

Moves from one frame to another. to the backup memory vice versa

3.It occurs and error when pages are skip in 3.There are no any message is generated in a period of

Main memory. executed or program allocated a main memory not a

Part of process.

4.A process need number of page frame 4.There are no any pages required for allocation in main

Which is assigned by page map table there memory but it works either static or fixed, variable,

-fore we can say that each process gives set partition for allocating each process from backup

Of pages declared by paging mechanism. the main memory during execution.

5.It follows the swapping mechanism because 5.Before execution of process the turn swap in

Page and page frame number are assigned into mains our program is allocated in memory form

page map table and allocated one by one into external memory into exact size of a process, this

required page frame number . process is done by memory management technique.

Page fault:- A page fault occurs when a program attempts to a access a block of memory that is not stored in
physical memory. The fault notify the operating system that it most allocate the data in virtual memory then
transfer it from the storage device such as and HDD to the system memory.
A page is a fixed length memory block which is equivalent to the size of frame it is the smallest unit of a process
when a process is a spited into the size of frame therefore we can say that a process need a lot of operating
system send one by one page the requirement page frame number if it is skips in page map table and operating
system generates and error due to occurs it is send to the page fault.

Page hit:- The term page hit mains a page is available in the period of booting is called page hit of a process.

Demand paging
In paging system large process or program is spited into the different block in external memory and want to
execute through CPU, In this situation operating system called one by one segmented part from back of to the
main memory on demand not in advance called demand paging.

It is more implemented tools for executing bulk program through single frame in paging system.

This process is total true for the maximum utilization in main memory and CPU also. We know that the size of
process is greater than the total size of memory, in this situation paging system is validated because a single frame
is capable for executing bulk process by the way of segmentation and demand process processor.

Page replacement
The page replacement is a process of swapping out and existing page frame the frame of a main memory and
replacing it with the required page replacement required when all the frame are main memory are all read
occupied. A page to be replace to create a block

Algorithm of page replacement


It helps to decide which page must be swapped out from the main memory to create a block for the incoming
page.

There are several page replacement algorithm available in operating system.

 FIFO Page replacement algorithm


 LIFO Page replacement algorithm
 LUR Page replacement algorithm
 Optimal Page replacement algorithm

FIFO Page replacement algorithm

 As the name of algorithm, it works with first in first out


 It replaces oldest page that has for the largest time.
 It is implemented by keeping all the track in a same page.

LIFO Page replacement algorithm

 It LIFO stands for last in first out


 It replaces the new page that arrived at the last in main memory
 It is implement by keeping track of all page in a stack.

LUR Page replacement algorithm

 The LUR stands for list recently use.


 It replaces the page that has not been referred by CPU for the longest time.
 For replacing a page through LRU, operating system replaces that page which waiting time is longer than
other

Optimal Page replacement algorithm

 This algorithm replaces the page that will not be referred by the CPU in feature for the longest time.
 It is based non-algorithm and gives the list number of page fault occurs.
 It is use as a preformation based replacement when it is occurred by page replacement tool given by
operating system.

A system uses three page frame for storing process page in main memory it uses the first in first out page
replacement policy assumed that all the page frame are initially empty. What is the total, number of page fault
that will be occurred while processing the page given below:-

4, 7, 6, 1, 7, 6, 1, 2, 7, 2

Solution:- Page fault-

Page hit-

Page fault-6

Page hit - 4

Reasons of page fault:-

 The page is skip from page map table therefore it is not loaded in main memory
 Before working paging mechanism the page map table is created. Operating system is assigned frame
number is not updated currently then, It occurs an error known as page fault.

A system uses three page frame for storing process page in main memory it uses the first in first out page
replacement policy assumed that all the page frame are initially empty. What is the total, number of page fault
that will be occurred while processing the page given below:-

4, 7, 6, 1, 7, 6, 1, 2, 7, 2

Solution:- Page fault-

Page hit-
Page fault-8 page hit-2

Vous aimerez peut-être aussi