Placement algorithms

Because of the overheads involved in compaction, the OP system must be clever in deciding how to assign processes to memory.

Best –fit: Allocated the smallest hole that is big enough.

First-fit: Allocates the first hole that is big enough, starting from the beginning of memory.

Next-fit: Starts scan fromlast allocation and allocates the next hole big enough.

 
 

Deciding which placement algorithm is the best depends on the size of the processes and the exact sequence of process swapping that takes place. In general, the First-fit usually results in the best and fastest allocation. Next-fit usually results in the last block being allocated and is in general large in size. Best-fit results in compaction having to be carried out more frequently than the others – because it results in lots of small fragments scattered throughout memory.

The above diagram shows an example of memory configuration after a number of placement and swapping-out operations. The last operation was allocating a 14 Mb process to an used 22 Mb block. The left side shows how a 16 Mb request might be satisfied.

Paging

Introduced to alleviate problem of fragmentation.

Memory is divided into page frames all of equal size.

The logical address space divided into pages of equal size.

The memory manager determines

1. The number of pages in the program

2. Locates enough empty page frames to facilitate

3. Loads all of the pages into memory, pages need not be contiguous.

A number of tables need to be maintained for this system to operate:

1. Job Table - for each job holds the size of the job, the memory location of the Page table.

2. Page Table – For each active job the Page, page Frame memory address

3. Memory Map table – for each page Frame its location and whether free or busy.

Logical Address Is a reference to a memory location independent of the current assignment of data to memory – a translation must be made to a physical address before memory access can be achieved. (Mov Reg,8192)

Physical Address Is an actual location in main memory


Понравилась статья? Добавь ее в закладку (CTRL+D) и не забудь поделиться с друзьями:  



double arrow
Сейчас читают про: