MEMORY MANAGEMENT

 

Flynn and McHoe talk about these types of memory as does Davis.  Each was/is a type of structure that was used in the past.  Not all machines today use some of these.  Some older programs may  not work becasue they are coded in older structure.

 

1.     Single User Contiguous Scheme

-          Each program to be processed is loaded in its entirety and is Contiguous.

-          If the program is too large and cannot be fitted into available space then it is not executable.

-          Earlier the problem was that the main memory needed was erased. Hence, the program needed to be modified.

 

2.      Fixed Partitions / Static Partitions

 

-          First attempt to allow multi-programming.

-          Fixed Partition with main memory

-          One for each job

-          In order to reconfigure its size shut down or start up was required.

-          There was protection of memory space

-          More flexible than single user scheme

-          It allows more than one program at the same time.

-          However it still requires that the entire program be stored “contiguously” and “in memory” from beginning to end of its execution.

-          Memory Manager must keep a table consisting of Partition Size, address, access instructions and its current status i.e. whether it is free or busy.

-          When the job terminates the status changes from busy to free and can be assigned to an incoming job.

-          However this type of memory had certain problems such as

  1. The partition size resulted in wasted memory
  2. There was a longer turnaround time waiting for the space. Wasted space was called Internal Fragmentation.

 

3.      Dynamic Partitions

 

-          The memory is still in contiguous blocks however the jobs are given only as much memory as they request when they are loaded for processing.

-          This was a significant improvement since there was not Internal Fragmentation. However this did not solve the problems.

-          The only time the memory is fully loaded is when the first jobs are loaded.

-          New jobs are not the same size as the jobs which just vacated the memory.

-          They fit into the available spaces on a priority basis such as First Come First Served

-          It creates fragments of free memory between blocks of allocated memory. This is known as External Fragmentation, which basically implies wasted memory.

 

4.      Relocatable Dynamic Partitions

 

-          Compaction occurs, i.e. garbage collection of de-fragmented memory space.

 

5.      Paged Memory

 

-          This is a more recent system.

-          The compaction scheme is eliminated.

-          The incoming jobs are divided into Pages of equal size.

-          The sections of Main Memory are called Page Frames.

-          The disk is divided into blocks called Sectors.

-          Its consists of the Page Map Table, Memory Map Table.

-          The Memory Manager in this case

  1. determines the number of pages in each program
  2. locates enough empty page frames in main memory
  3. Loads all program pages with them. These need not be contiguous.

-          Memory is used more efficiently since page frames can use any size of any job.

-          However this system generates more overheads and hence when the Operating System is more complex a new mechanism is required to keep track of the page-frames.

 

6.      Demand Paging

 

-          Loads only a part of the program into memory for processing.

-          There is no need for the entire job to be loaded into memory.

-          It is divided into equal sized pages in the Secondary Memory

-          When needed the program is brought into memory.

-          This system made Virtual Memory widely available. It gives the appearance of an almost infinite amount of memory.

-          The pages are Swapped In and Swapped Out i.e. they go from Secondary storage to main memory when needed at high speed.

-          It needs a Job Table, a Page Map Table and a Memory Table.

-          The Page Replacement policy it follows is that of First In First Out or Least Recently Used.

 

7.      Segmented Memory Allocation

 

-          Programs are divided into Modules based on logical grouping of code.

-          Each job is divided into several segments of different sizes depending on the number of modules. There is one segment for each module.

-          There are no Page Frames in memory since each segment is of a different size.

-          Memory is allocated in a dynamic manner.

-          When programs are compiled or assembled segments are set up according to the programs structured modules.

-          There is a Segment Map Table, a Job Table and a Memory Map Table.

-          There is a Segment Map Table for each segment. It contains the segment ID, the length of the segment, the access rights to the segment, the status and location  of the segment.

-          Segmentation allows for sharing of files among users.

 

8.      Segmented  Demand Paged Memory Allocation

 

-          Each segment is subdivided into pages of equal size.

-          Smaller than most segments.

-          Easier to manipulate than whole segments.

-          Compaction, External Fragmentation, Secodndary storage handling is removed because pages are of a fixed length.

-          There are 4 tables viz. Job Table Segment Map Table, Page Map Table and Memory Map Table. The MMT monitors allocation of the page frames in main memory.