SlideShare a Scribd company logo
1 of 34
Storage Management

• Fragmentation
• Paging concepts




                            1
HOME     PREVIOUS TOPIC NEXT
PREVIOUS QUESTION PAPERS FOR OS
CPP TUTORIALS




                                  2
Recap


In the last class, you have learnt

 Multiple partition allocation

 Allocation of memory




                                     3
Objectives

    On completion of this class, you will be able to
    know
•     Fragmentation
       - External
       - Internal

•     Paging concepts
                                                       4
Multiprogramming with Fixed Partitions
                          Memory
                                   0k
• Divide memory into n
                            OS
                                   4k
  (possible unequal)
                             P1
  partitions
                                   16k
• Problem:                  P2

  – Fragmentation                  64k
                                          Free Space
                            P3
                                   128k
                                               5
External Fragmentation
                            Memory
• Enough total memory                   0k
                            Operating
  exists to satisfy a        System
                                        400k
  request
                               P1
• But not contagious
                                        1000k
• Results in external
                              P4
  fragmentation                         1700k
                                        2000k   Free Space
• Ex: Process size             P3
                                        2300k     560K
  P1=600K, P4= 700K,                    2560k
  P3=300K, P5= 500K                                  6
Fixed Partitions
                            Memory
 Ex. A Hole Size is
                                      18,464   Free Space
  18,464 bytes               OS
                                       Bytes

 Process P3 request
  is 18,462 bytes            P1

 Allocate the request
                                      Internal
 Hole of two bytes is       P3       fragmentation
  left (Internal
                                      (cannot be
  Fragmentation)              P2
                                      reallocated)


                                                     7
Fragmentation

• Disadvantage
  – Block of free memory between two process can not
    be used for executing the process
  – Which end of the free block is allocated (top or
    bottom)
  – If all free blocks of memory were together several
    more process can be executed



                                                         8
How Bad Is Fragmentation?


• Statistical arguments - Random sizes

• First-fit, Best-fit, Worst-fit

• Given N allocated blocks

• 0.5∗N blocks will be lost because of fragmentation

• Known as 50% RULE

                                                 9
Solution to External Fragmentation

Compaction
 Shuffle memory contents to place all free memory
 together in one large block as shown in slide no. 11
 Compaction is not always possible
 If relocation is static and is done at assembly or
 load time compaction is not possible


                                                 10
Solution to External Fragmentation

 Compaction is possible only if relocation is
 dynamic and is done at execution time
 I/O problem
  Latch job in memory while it is involved in I/O
  Do I/O only into OS buffers




                                                     11
Solution to External Fragmentation
• Compaction

5 Monitor Job 7   Job 5       Job 3      Job 8       Free
                                                    Job 6

6 Monitor Job 7 Job 5         Job 3      Job 8       Free
                                                    Job 6

7 Monitor Job 7 Job 5 Job 3              Job 8       Free
                                                    Job 6

8 Monitor Job 7 Job 5 Job 3      Job 8               Free
                                                    Job 6

9 Monitor Job 7 Job 5 Job 3      Job 8      Job 6   Free


                                                            12
Internal fragmentation


Want to also avoid internal fragmentation?

 Memory is handed out in some fixed way (Power

  of 2 for instance)

 and requesting program doesn't use it all




                                              13
Storage Management Problems

• Fixed partitions suffer from
   – Internal fragmentation

• Variable partitions suffer from
   – External fragmentation

• Compaction suffers from
   – Overhead



                                    14
Paging

• Possible solution to the external fragmentation is
  use of Paging scheme
• Paging avoids the problem of fitting varying-sized
  memory chunks on to backing store
• We don’t need to assign contiguous memory
  chunks
• Internal fragmentation can only occur on the last
  page assigned to a process
                                                   15
Paging
• Logical address space of a process can be
  noncontiguous
• Process is allocated to physical memory whenever
  the latter is available
• Divide physical memory into fixed-sized blocks called
  frames
  – Ex: size is power of 2, between 512 bytes and 8,192 bytes

• Divide logical memory into blocks of same size
  called pages
                                                        16
Paging

• Keep track of all free frames

• To run a program of size n pages, need to find n
  free frames and load program

• Set up a page table to translate logical to
  physical addresses

• Internal fragmentation


                                                 17
Paging Hardware




                  18
Address Translation Scheme
• Address generated by CPU is logical address
    – is divided into two parts as shown in next slide
    – Page number (p) – used as an index into a page table
        which contains base address of each page in physical
        memory
    – Page offset (d) – combined with base address to
        define the physical memory address that is sent to the
        memory unit
    –   for given logical address space 2m and page size 2n
page number    page offset
        p        d
    m-n           n                                           19
Paging Hardware


                                         Physical
      Logical                            address    Physical
      address
                                                    Memory
           p    d                    f   d
CPU




                    p




                        Page table
                                                               20
Paging Model of Logical and Physical
             Memory




                                       21
Paging Model of Logical and Physical
               Memory
• Example: mapping of user view of memory to
  physical memory
  – Page size of 4 bytes
  – Physical memory of 32 bytes ( 8 pages )
  – Logical address 0, page 0, offset 0
  – Indexing into page table, we get page 0 is in frame 5
  – Logical address 0 maps to physical address
    20(=(5X4)+0)


                                                            22
Paging Example




32-byte memory and 4-byte pages
                                  23
Summary

 In this class, you have learnt

• Fragmentation

• Paging concepts




                                  24
Frequently Asked Questions


1. What is external fragmentation?

2. What is internal fragmentation?

3. Define a page and a frame

4. Explain the paging hardware with a neat

   diagram

                                             25
Quiz

1. Enough total memory exists to satisfy a
 request but not contagious results in
 a) External fragmentation
 b) Internal fragmentation
 C) None




                                             26
Quiz

2.Shuffling memory contents to place all free
 memory together in one large block is called
  a) Fragmentation
  b) Hole
  c) Compaction
  d) None




                                                27
Quiz

3. Fixed partitions suffer from

a) External fragmentation

b) Internal fragmentation

c) Compaction

d) None


                                  28
Quiz

4. Variable partitions suffer from

a) External fragmentation

b) Internal fragmentation

c) Compaction

d) None



                                     29
Quiz

5. Possible solution to the external fragmentation is
 to use
 a) Compaction
 b) Paging scheme
 C) None




                                                   30
Quiz

6. ___________used as an index into a page
  table
  a) Page offset
  b) Hole
  c) Page number (p)
 d) None



                                             31
Other subject materials

•   Web designing
•   Micro processors
•   C++ tutorials
•   java

home
Quiz

7. ______________combined with base address to
   define the physical memory address

a) Page number

b) Page offset (d)

c) Compaction

d) None

                                            33
Quiz

8. Divide physical memory into fixed-sized blocks
   called
   a) External fragmentation
   b) Frames
   c) Compaction
   d) None



                                                    34

More Related Content

What's hot

Unix Memory Management - Operating Systems
Unix Memory Management - Operating SystemsUnix Memory Management - Operating Systems
Unix Memory Management - Operating SystemsDrishti Bhalla
 
Paging and Segmentation in Operating System
Paging and Segmentation in Operating SystemPaging and Segmentation in Operating System
Paging and Segmentation in Operating SystemRaj Mohan
 
31 address binding, dynamic loading
31 address binding, dynamic loading31 address binding, dynamic loading
31 address binding, dynamic loadingmyrajendra
 
Memory Management in Windows 7
Memory Management in Windows 7Memory Management in Windows 7
Memory Management in Windows 7Naveed Qadri
 
Ch9 OS
Ch9 OSCh9 OS
Ch9 OSC.U
 
Combined paging and segmentation
Combined paging and segmentationCombined paging and segmentation
Combined paging and segmentationTech_MX
 
memory management of windows vs linux
memory management of windows vs linuxmemory management of windows vs linux
memory management of windows vs linuxSumit Khanka
 
Chapter 8 : Memory
Chapter 8 : MemoryChapter 8 : Memory
Chapter 8 : MemoryAmin Omi
 
Process' Virtual Address Space in GNU/Linux
Process' Virtual Address Space in GNU/LinuxProcess' Virtual Address Space in GNU/Linux
Process' Virtual Address Space in GNU/LinuxVarun Mahajan
 
Presentation on Segmentation
Presentation on SegmentationPresentation on Segmentation
Presentation on SegmentationPriyanka bisht
 
VM and IO Topics in Linux
VM and IO Topics in LinuxVM and IO Topics in Linux
VM and IO Topics in Linuxcucufrog
 
Introduction of Memory Management
Introduction of Memory Management Introduction of Memory Management
Introduction of Memory Management Maitree Patel
 
Os solaris memory management
Os  solaris memory managementOs  solaris memory management
Os solaris memory managementTech_MX
 

What's hot (20)

Unix Memory Management - Operating Systems
Unix Memory Management - Operating SystemsUnix Memory Management - Operating Systems
Unix Memory Management - Operating Systems
 
Paging and Segmentation in Operating System
Paging and Segmentation in Operating SystemPaging and Segmentation in Operating System
Paging and Segmentation in Operating System
 
OS_Ch9
OS_Ch9OS_Ch9
OS_Ch9
 
31 address binding, dynamic loading
31 address binding, dynamic loading31 address binding, dynamic loading
31 address binding, dynamic loading
 
Memory Management in Windows 7
Memory Management in Windows 7Memory Management in Windows 7
Memory Management in Windows 7
 
Ch9 OS
Ch9 OSCh9 OS
Ch9 OS
 
Combined paging and segmentation
Combined paging and segmentationCombined paging and segmentation
Combined paging and segmentation
 
Swapping | Computer Science
Swapping | Computer ScienceSwapping | Computer Science
Swapping | Computer Science
 
memory management of windows vs linux
memory management of windows vs linuxmemory management of windows vs linux
memory management of windows vs linux
 
Chapter 8 : Memory
Chapter 8 : MemoryChapter 8 : Memory
Chapter 8 : Memory
 
Memory management
Memory managementMemory management
Memory management
 
Process' Virtual Address Space in GNU/Linux
Process' Virtual Address Space in GNU/LinuxProcess' Virtual Address Space in GNU/Linux
Process' Virtual Address Space in GNU/Linux
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Presentation on Segmentation
Presentation on SegmentationPresentation on Segmentation
Presentation on Segmentation
 
Memory management
Memory managementMemory management
Memory management
 
Main Memory
Main MemoryMain Memory
Main Memory
 
Opetating System Memory management
Opetating System Memory managementOpetating System Memory management
Opetating System Memory management
 
VM and IO Topics in Linux
VM and IO Topics in LinuxVM and IO Topics in Linux
VM and IO Topics in Linux
 
Introduction of Memory Management
Introduction of Memory Management Introduction of Memory Management
Introduction of Memory Management
 
Os solaris memory management
Os  solaris memory managementOs  solaris memory management
Os solaris memory management
 

Viewers also liked

38 paged segmentation
38 paged segmentation38 paged segmentation
38 paged segmentationmyrajendra
 
File management53(1)
File management53(1)File management53(1)
File management53(1)myrajendra
 
35. multiplepartitionallocation
35. multiplepartitionallocation35. multiplepartitionallocation
35. multiplepartitionallocationmyrajendra
 
40 demand paging
40 demand paging40 demand paging
40 demand pagingmyrajendra
 
Thrashing allocation frames.43
Thrashing allocation frames.43Thrashing allocation frames.43
Thrashing allocation frames.43myrajendra
 
Types of memory 10 to11
Types of memory 10 to11Types of memory 10 to11
Types of memory 10 to11myrajendra
 
Types of memory
Types of memoryTypes of memory
Types of memorymyrajendra
 
Hibernate example1
Hibernate example1Hibernate example1
Hibernate example1myrajendra
 
Bab 4
Bab 4Bab 4
Bab 4n k
 
Contiguous Memory Allocation-R.D.Sivakumar
Contiguous Memory Allocation-R.D.SivakumarContiguous Memory Allocation-R.D.Sivakumar
Contiguous Memory Allocation-R.D.SivakumarSivakumar R D .
 
Deleting structure.56
Deleting structure.56Deleting structure.56
Deleting structure.56myrajendra
 
Set model and page fault.44
Set model and page fault.44Set model and page fault.44
Set model and page fault.44myrajendra
 
File directory definition 54(2)
File directory definition 54(2)File directory definition 54(2)
File directory definition 54(2)myrajendra
 
Files concepts.53
Files concepts.53Files concepts.53
Files concepts.53myrajendra
 
Operating Systems 1 (9/12) - Memory Management Concepts
Operating Systems 1 (9/12) - Memory Management ConceptsOperating Systems 1 (9/12) - Memory Management Concepts
Operating Systems 1 (9/12) - Memory Management ConceptsPeter Tröger
 
Disk scheduling.49
Disk scheduling.49Disk scheduling.49
Disk scheduling.49myrajendra
 

Viewers also liked (20)

38 paged segmentation
38 paged segmentation38 paged segmentation
38 paged segmentation
 
File management53(1)
File management53(1)File management53(1)
File management53(1)
 
35. multiplepartitionallocation
35. multiplepartitionallocation35. multiplepartitionallocation
35. multiplepartitionallocation
 
40 demand paging
40 demand paging40 demand paging
40 demand paging
 
Thrashing allocation frames.43
Thrashing allocation frames.43Thrashing allocation frames.43
Thrashing allocation frames.43
 
OS ASSIGNMENT 2
OS ASSIGNMENT 2OS ASSIGNMENT 2
OS ASSIGNMENT 2
 
Types of memory 10 to11
Types of memory 10 to11Types of memory 10 to11
Types of memory 10 to11
 
Types of memory
Types of memoryTypes of memory
Types of memory
 
Hibernate example1
Hibernate example1Hibernate example1
Hibernate example1
 
Bab 4
Bab 4Bab 4
Bab 4
 
Contiguous Memory Allocation-R.D.Sivakumar
Contiguous Memory Allocation-R.D.SivakumarContiguous Memory Allocation-R.D.Sivakumar
Contiguous Memory Allocation-R.D.Sivakumar
 
Data type
Data typeData type
Data type
 
main memory
main memorymain memory
main memory
 
Fundamentals
FundamentalsFundamentals
Fundamentals
 
Deleting structure.56
Deleting structure.56Deleting structure.56
Deleting structure.56
 
Set model and page fault.44
Set model and page fault.44Set model and page fault.44
Set model and page fault.44
 
File directory definition 54(2)
File directory definition 54(2)File directory definition 54(2)
File directory definition 54(2)
 
Files concepts.53
Files concepts.53Files concepts.53
Files concepts.53
 
Operating Systems 1 (9/12) - Memory Management Concepts
Operating Systems 1 (9/12) - Memory Management ConceptsOperating Systems 1 (9/12) - Memory Management Concepts
Operating Systems 1 (9/12) - Memory Management Concepts
 
Disk scheduling.49
Disk scheduling.49Disk scheduling.49
Disk scheduling.49
 

Similar to 36 fragmentaio nnd pageconcepts

C++ Advanced Memory Management With Allocators
C++ Advanced Memory Management With AllocatorsC++ Advanced Memory Management With Allocators
C++ Advanced Memory Management With AllocatorsGlobalLogic Ukraine
 
Memory Management in Apache Spark
Memory Management in Apache SparkMemory Management in Apache Spark
Memory Management in Apache SparkDatabricks
 
Fabian Hueske – Juggling with Bits and Bytes
Fabian Hueske – Juggling with Bits and BytesFabian Hueske – Juggling with Bits and Bytes
Fabian Hueske – Juggling with Bits and BytesFlink Forward
 
Why the Address Translation Scheme Matters?
Why the Address Translation Scheme Matters?Why the Address Translation Scheme Matters?
Why the Address Translation Scheme Matters?Jiaqing Du
 
Accelerating HBase with NVMe and Bucket Cache
Accelerating HBase with NVMe and Bucket CacheAccelerating HBase with NVMe and Bucket Cache
Accelerating HBase with NVMe and Bucket CacheNicolas Poggi
 
Memory management in operating system | Paging | Virtual memory
Memory management in operating system | Paging | Virtual memoryMemory management in operating system | Paging | Virtual memory
Memory management in operating system | Paging | Virtual memoryShivam Mitra
 
Tachyon_meetup_5-28-2015-IBM
Tachyon_meetup_5-28-2015-IBMTachyon_meetup_5-28-2015-IBM
Tachyon_meetup_5-28-2015-IBMShaoshan Liu
 
Spark Summit EU talk by Qifan Pu
Spark Summit EU talk by Qifan PuSpark Summit EU talk by Qifan Pu
Spark Summit EU talk by Qifan PuSpark Summit
 
Presentation by TachyonNexus & Intel at Strata Singapore 2015
Presentation by TachyonNexus & Intel at Strata Singapore 2015Presentation by TachyonNexus & Intel at Strata Singapore 2015
Presentation by TachyonNexus & Intel at Strata Singapore 2015Tachyon Nexus, Inc.
 
Top 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applicationsTop 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applicationshadooparchbook
 
9 virtual memory management
9 virtual memory management9 virtual memory management
9 virtual memory managementDr. Loganathan R
 
Ph.D. thesis presentation
Ph.D. thesis presentationPh.D. thesis presentation
Ph.D. thesis presentationdavidkftam
 
Colvin exadata mistakes_ioug_2014
Colvin exadata mistakes_ioug_2014Colvin exadata mistakes_ioug_2014
Colvin exadata mistakes_ioug_2014marvin herrera
 

Similar to 36 fragmentaio nnd pageconcepts (20)

C++ Advanced Memory Management With Allocators
C++ Advanced Memory Management With AllocatorsC++ Advanced Memory Management With Allocators
C++ Advanced Memory Management With Allocators
 
Memory Management in Apache Spark
Memory Management in Apache SparkMemory Management in Apache Spark
Memory Management in Apache Spark
 
Fabian Hueske – Juggling with Bits and Bytes
Fabian Hueske – Juggling with Bits and BytesFabian Hueske – Juggling with Bits and Bytes
Fabian Hueske – Juggling with Bits and Bytes
 
Os4
Os4Os4
Os4
 
Os4
Os4Os4
Os4
 
Why the Address Translation Scheme Matters?
Why the Address Translation Scheme Matters?Why the Address Translation Scheme Matters?
Why the Address Translation Scheme Matters?
 
cache memory management
cache memory managementcache memory management
cache memory management
 
Accelerating HBase with NVMe and Bucket Cache
Accelerating HBase with NVMe and Bucket CacheAccelerating HBase with NVMe and Bucket Cache
Accelerating HBase with NVMe and Bucket Cache
 
Extlect03
Extlect03Extlect03
Extlect03
 
Chap4
Chap4 Chap4
Chap4
 
Memory management in operating system | Paging | Virtual memory
Memory management in operating system | Paging | Virtual memoryMemory management in operating system | Paging | Virtual memory
Memory management in operating system | Paging | Virtual memory
 
Tachyon_meetup_5-28-2015-IBM
Tachyon_meetup_5-28-2015-IBMTachyon_meetup_5-28-2015-IBM
Tachyon_meetup_5-28-2015-IBM
 
Spark Summit EU talk by Qifan Pu
Spark Summit EU talk by Qifan PuSpark Summit EU talk by Qifan Pu
Spark Summit EU talk by Qifan Pu
 
Presentation by TachyonNexus & Intel at Strata Singapore 2015
Presentation by TachyonNexus & Intel at Strata Singapore 2015Presentation by TachyonNexus & Intel at Strata Singapore 2015
Presentation by TachyonNexus & Intel at Strata Singapore 2015
 
Top 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applicationsTop 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applications
 
Caching in
Caching inCaching in
Caching in
 
Lect14
Lect14Lect14
Lect14
 
9 virtual memory management
9 virtual memory management9 virtual memory management
9 virtual memory management
 
Ph.D. thesis presentation
Ph.D. thesis presentationPh.D. thesis presentation
Ph.D. thesis presentation
 
Colvin exadata mistakes_ioug_2014
Colvin exadata mistakes_ioug_2014Colvin exadata mistakes_ioug_2014
Colvin exadata mistakes_ioug_2014
 

More from myrajendra

More from myrajendra (20)

Jdbc workflow
Jdbc workflowJdbc workflow
Jdbc workflow
 
2 jdbc drivers
2 jdbc drivers2 jdbc drivers
2 jdbc drivers
 
3 jdbc api
3 jdbc api3 jdbc api
3 jdbc api
 
4 jdbc step1
4 jdbc step14 jdbc step1
4 jdbc step1
 
Dao example
Dao exampleDao example
Dao example
 
Sessionex1
Sessionex1Sessionex1
Sessionex1
 
Internal
InternalInternal
Internal
 
3. elements
3. elements3. elements
3. elements
 
2. attributes
2. attributes2. attributes
2. attributes
 
1 introduction to html
1 introduction to html1 introduction to html
1 introduction to html
 
Headings
HeadingsHeadings
Headings
 
Forms
FormsForms
Forms
 
Css
CssCss
Css
 
Views
ViewsViews
Views
 
Views
ViewsViews
Views
 
Views
ViewsViews
Views
 
Starting jdbc
Starting jdbcStarting jdbc
Starting jdbc
 
Properties
PropertiesProperties
Properties
 
Java.sql package
Java.sql packageJava.sql package
Java.sql package
 
Interface callable statement
Interface callable statementInterface callable statement
Interface callable statement
 

36 fragmentaio nnd pageconcepts

  • 2. HOME PREVIOUS TOPIC NEXT PREVIOUS QUESTION PAPERS FOR OS CPP TUTORIALS 2
  • 3. Recap In the last class, you have learnt  Multiple partition allocation  Allocation of memory 3
  • 4. Objectives On completion of this class, you will be able to know • Fragmentation - External - Internal • Paging concepts 4
  • 5. Multiprogramming with Fixed Partitions Memory 0k • Divide memory into n OS 4k (possible unequal) P1 partitions 16k • Problem: P2 – Fragmentation 64k Free Space P3 128k 5
  • 6. External Fragmentation Memory • Enough total memory 0k Operating exists to satisfy a System 400k request P1 • But not contagious 1000k • Results in external P4 fragmentation 1700k 2000k Free Space • Ex: Process size P3 2300k 560K P1=600K, P4= 700K, 2560k P3=300K, P5= 500K 6
  • 7. Fixed Partitions Memory  Ex. A Hole Size is 18,464 Free Space 18,464 bytes OS Bytes  Process P3 request is 18,462 bytes P1  Allocate the request Internal  Hole of two bytes is P3 fragmentation left (Internal (cannot be Fragmentation) P2 reallocated) 7
  • 8. Fragmentation • Disadvantage – Block of free memory between two process can not be used for executing the process – Which end of the free block is allocated (top or bottom) – If all free blocks of memory were together several more process can be executed 8
  • 9. How Bad Is Fragmentation? • Statistical arguments - Random sizes • First-fit, Best-fit, Worst-fit • Given N allocated blocks • 0.5∗N blocks will be lost because of fragmentation • Known as 50% RULE 9
  • 10. Solution to External Fragmentation Compaction  Shuffle memory contents to place all free memory together in one large block as shown in slide no. 11  Compaction is not always possible  If relocation is static and is done at assembly or load time compaction is not possible 10
  • 11. Solution to External Fragmentation  Compaction is possible only if relocation is dynamic and is done at execution time  I/O problem  Latch job in memory while it is involved in I/O  Do I/O only into OS buffers 11
  • 12. Solution to External Fragmentation • Compaction 5 Monitor Job 7 Job 5 Job 3 Job 8 Free Job 6 6 Monitor Job 7 Job 5 Job 3 Job 8 Free Job 6 7 Monitor Job 7 Job 5 Job 3 Job 8 Free Job 6 8 Monitor Job 7 Job 5 Job 3 Job 8 Free Job 6 9 Monitor Job 7 Job 5 Job 3 Job 8 Job 6 Free 12
  • 13. Internal fragmentation Want to also avoid internal fragmentation?  Memory is handed out in some fixed way (Power of 2 for instance)  and requesting program doesn't use it all 13
  • 14. Storage Management Problems • Fixed partitions suffer from – Internal fragmentation • Variable partitions suffer from – External fragmentation • Compaction suffers from – Overhead 14
  • 15. Paging • Possible solution to the external fragmentation is use of Paging scheme • Paging avoids the problem of fitting varying-sized memory chunks on to backing store • We don’t need to assign contiguous memory chunks • Internal fragmentation can only occur on the last page assigned to a process 15
  • 16. Paging • Logical address space of a process can be noncontiguous • Process is allocated to physical memory whenever the latter is available • Divide physical memory into fixed-sized blocks called frames – Ex: size is power of 2, between 512 bytes and 8,192 bytes • Divide logical memory into blocks of same size called pages 16
  • 17. Paging • Keep track of all free frames • To run a program of size n pages, need to find n free frames and load program • Set up a page table to translate logical to physical addresses • Internal fragmentation 17
  • 19. Address Translation Scheme • Address generated by CPU is logical address – is divided into two parts as shown in next slide – Page number (p) – used as an index into a page table which contains base address of each page in physical memory – Page offset (d) – combined with base address to define the physical memory address that is sent to the memory unit – for given logical address space 2m and page size 2n page number page offset p d m-n n 19
  • 20. Paging Hardware Physical Logical address Physical address Memory p d f d CPU p Page table 20
  • 21. Paging Model of Logical and Physical Memory 21
  • 22. Paging Model of Logical and Physical Memory • Example: mapping of user view of memory to physical memory – Page size of 4 bytes – Physical memory of 32 bytes ( 8 pages ) – Logical address 0, page 0, offset 0 – Indexing into page table, we get page 0 is in frame 5 – Logical address 0 maps to physical address 20(=(5X4)+0) 22
  • 23. Paging Example 32-byte memory and 4-byte pages 23
  • 24. Summary In this class, you have learnt • Fragmentation • Paging concepts 24
  • 25. Frequently Asked Questions 1. What is external fragmentation? 2. What is internal fragmentation? 3. Define a page and a frame 4. Explain the paging hardware with a neat diagram 25
  • 26. Quiz 1. Enough total memory exists to satisfy a request but not contagious results in a) External fragmentation b) Internal fragmentation C) None 26
  • 27. Quiz 2.Shuffling memory contents to place all free memory together in one large block is called a) Fragmentation b) Hole c) Compaction d) None 27
  • 28. Quiz 3. Fixed partitions suffer from a) External fragmentation b) Internal fragmentation c) Compaction d) None 28
  • 29. Quiz 4. Variable partitions suffer from a) External fragmentation b) Internal fragmentation c) Compaction d) None 29
  • 30. Quiz 5. Possible solution to the external fragmentation is to use a) Compaction b) Paging scheme C) None 30
  • 31. Quiz 6. ___________used as an index into a page table a) Page offset b) Hole c) Page number (p) d) None 31
  • 32. Other subject materials • Web designing • Micro processors • C++ tutorials • java home
  • 33. Quiz 7. ______________combined with base address to define the physical memory address a) Page number b) Page offset (d) c) Compaction d) None 33
  • 34. Quiz 8. Divide physical memory into fixed-sized blocks called a) External fragmentation b) Frames c) Compaction d) None 34