2. HOME PREVIOUS TOPIC NEXT
PREVIOUS QUESTION PAPERS FOR OS
CPP TUTORIALS
http://raj-os.blogspot.in 2
3. Recap
In the last class, you have learnt
• Concepts of page replacement
• LRU page replacement algorithm
• Optimal page replacement algorithm
http://raj-os.blogspot.in 3
4. Objective
On completion of this period, you would be
able to know
• Thrashing
• Allocation of frames
http://raj-os.blogspot.in 4
5. Thrashing
• Swapping out a piece of a process just before
that piece is needed
• The processor spends most of its time swapping
pieces rather than executing user instructions
• This activity is called the thrashing
http://raj-os.blogspot.in 5
6. Thrashing
If a process does not have “enough” pages, the
page-fault rate is very high. This leads to:
• Low CPU utilization
• Operating system thinks that it needs to
increase the degree of multiprogramming
• Another process added to the system
http://raj-os.blogspot.in 6
7. Thrashing
• A process is busy swapping pages in and out
• This high paging activity is called Thrashing
• More paging and less CPU utilization
http://raj-os.blogspot.in 7
8. Thrashing
Disadvantages
• Increases the degree of multiprogramming
• System throughput decreases
• Page fault rate increases
• Effective access time increases
• This phenomenon is shown in next slide
http://raj-os.blogspot.in 8
10. Thrashing
• We can reduce the effect of thrashing by using
the local replacement algorithm
• To prevent thrashing provide as many frames as
it needs
• To know the number of frames use working set
strategy
http://raj-os.blogspot.in 10
11. Thrashing
Why does paging work?
Locality model
Process migrates from one locality to another
Localities may overlap
Why does thrashing occur?
Σ size of locality > total memory size
http://raj-os.blogspot.in 11
12. Principle of Locality
• Program and data references within a process
tend to cluster
• Only a few pieces of a process will be needed
over a short period of time
• Possible to make intelligent guesses about
which pieces will be needed in the future
• This suggests that virtual memory may work
efficiently
http://raj-os.blogspot.in 12
13. Locality In A Memory-Reference Pattern
http://raj-os.blogspot.in 13
14. Allocation of Frames
• Each process needs minimum number of
pages
• Consider a single OS with 128K memory,
with page size of 1K
• OS takes 35K, Leaving 93 frames for the user
process
http://raj-os.blogspot.in 14
15. Allocation of Frames
• The first 93 page faults would get free frames
from the free frame list
• When the free frame list is exhausted a page
replacement algorithm is used to allocate the
frame
http://raj-os.blogspot.in 15
16. Allocation of Frames
Constraints
• Can not allocate more than the total no. of
available frames
• Only a minimum no. of frames that can be
allocated
• This no. is defined by the instruction set
architecture
• As the no. of frames allocated decreases the
page fault increases
• Slows down the process execution
http://raj-os.blogspot.in 16
17. Summary
In this class, you have learnt
• Concept of Thrashing
-High paging activity is called Thrashing
• Allocation of frames
http://raj-os.blogspot.in 17
18. Frequently Asked Questions
1. Explain the concept of thrashing ?
2. Write the disadvantages of thrashing ?
3. Explain the allocation of frames ?
http://raj-os.blogspot.in
9CM402.43 18
18
19. Quiz
1. ___________Increases the degree of multiprogramming
a) FIFO
b) LRU
c) Thrashing
d) None
2. High paging activity is called __________
a) FIFO
b) LRU
c) Thrashing
d)None
http://raj-os.blogspot.in 19
20. Quiz
3. Each process needs ________number of pages
a) Minimum
b) LRU
c) FIFO
d) None
4. We can reduce the effect of thrashing by using the
a) LRU
b) Local replacement algorithm
c) FIFO
d) None
http://raj-os.blogspot.in 20
20
21. Other subject materials
• Web designing
• Micro processors
• C++ tutorials
• java
home
http://raj-os.blogspot.in 21