Memory management. Paging and segmentation explain principle of memory organization by segment and page 

Memory management. Paging and segmentation

-memory is divided into equal-sized units called page frames
-program/data file is divided into equal-size units called pages
-one or more pages may be loaded into memory at any one time
-Pages may be discontiguous
-Pages swapped in and out as required
-pages not in main memory are stored in virtual memory/backing store
-page table/Index of pages/processes kept
-absolute address is calculated by adding page address to relative address in instruction
-paging is transparent to the programmer
-Memory is divided into variable length blocks
-Programs can consist of many segments
-Segments normally match natural divide in jobs/logical blocks
-Index of segments stored which must...
   -store base address and length of segment
   -programmer will organise code modules into segments

  • Answer.

    Page tables
    The operating system manages the primary memory in a computer and one very important part of memory management is the management of virtual memory. This was described in the previous example. All the operating system has to do is keep track of all of the pages. Each application will have associated with it a page table. This will identify each page for each application and will contain information about where to find that page if it is on the hard disk in virtual memory. If a page is in RAM then the entry for that particular page will be blank. When a page is needed, the operating system looks up the page reference in the page table, finds out where it is in virtual memory and then transfers it from the hard disk to the primary memory.

    This, of course, all takes time and contributes to the computer slowing down. This kind of tracking system for pages is relatively simple to implement but there are some disadvantages.

    • Paging is a simple system to implement but may not be the most efficient. This is because the pages are of a fixed size. A page may only have a small amount of data in it but will require a whole page to store it in.
    • Pages are fixed sizes. They will contain code that may not be a logical group of code (for example, a logical block of code such as a function might run across 6 different pages). This means that to load that particular function will require 6 pages to be loaded up, which is not as efficient as loading e.g. one page for the whole function.
    • Page tables are typically large and accessing them slows down the computer.
  • Segmentation
    An alternative approach is to use segmentation. Instead of pages being a fixed size, they are a variable size. Because their size can vary, code can be logically grouped into one segment. You could have a segment per procedure, for example, and this would reduce the size of the tables needed to store the segment information. The downside to segmentation is that retrieving a segment is more complicated. You need to store both the start address of a segment and the size of the segment. Start addresses have to be calculated with care because the sizes of each segment varies. With paging, it is entirely predictable where each page starts and finishes.




Exam questions:


Категория: Secondary storage | Добавил: bzfar77 (25.01.2021)
Просмотров: 100 | Теги: Memory, Segment, paging, Page, segmentation | Рейтинг: 0.0/0
Всего комментариев: 0