Contiguous Memory Allocation . Contiguous Memory Allocation One of the simplest methods for...

12
Contiguous Memory Allocation www.eITnotes.com

Transcript of Contiguous Memory Allocation . Contiguous Memory Allocation One of the simplest methods for...

Page 1: Contiguous Memory Allocation . Contiguous Memory Allocation  One of the simplest methods for allocating memory is to divide memory into.

Contiguous Memory Allocation

www.eITnotes.com

Page 2: Contiguous Memory Allocation . Contiguous Memory Allocation  One of the simplest methods for allocating memory is to divide memory into.

Contiguous Memory Allocation

One of the simplest methods for allocating memory is to divide memory into several fixed-sized partitions. Each partition may contain exactly one process.

In this multiple partition method, when a partition is free, a process is selected from the input queue and is loaded into the free partition. When the process terminates, the partition becomes available for another process.

www.eITnotes.com

Page 3: Contiguous Memory Allocation . Contiguous Memory Allocation  One of the simplest methods for allocating memory is to divide memory into.

Contiguous Memory Allocation

Fixed partitioning

Variable or Dynamic partitioning

www.eITnotes.com

Page 4: Contiguous Memory Allocation . Contiguous Memory Allocation  One of the simplest methods for allocating memory is to divide memory into.

Fixed Partitioning

The Simplest scheme for memory management is to partition it into regions fixed boundaries

There are two alternatives to fixed partitioning:

a) Equal size partitions

b) Unequal size partitions

www.eITnotes.com

Page 5: Contiguous Memory Allocation . Contiguous Memory Allocation  One of the simplest methods for allocating memory is to divide memory into.

8 M

8 M

8 M

8 M

8 M

8 M

8 M

8 M

8 M

2 M

4 M

6 M

8 M

12 M

16 M

8 M

A) Equal Size Partition B) Unequal Size Partition

Example of Fixed partitioning of 64 MB memory

www.eITnotes.com

Page 6: Contiguous Memory Allocation . Contiguous Memory Allocation  One of the simplest methods for allocating memory is to divide memory into.

However, there are two difficulties with equal size partitioning:

a) A program may be too big to fit into partition. In this case overlays have to be used, so only a portion of program stays in memory at a given time.

b) Main memory utilization is extremely inefficient. Any program, no matter how small occupies the portion.

In which space is wasted inside a partition, is called internal fragmentation.

www.eITnotes.com

Page 7: Contiguous Memory Allocation . Contiguous Memory Allocation  One of the simplest methods for allocating memory is to divide memory into.

Placement Strategies:

i) With equal size partitions, the placement is very simple task. The memory manager just has to load the process into available partition.

ii) With unequal size partitions, there are two possible ways to assign processes:

a) Assign each process to smallest partition within which it will fit. A scheduling queue is needed for each partition. This helps in minimizing internal fragmentation.

b) The other approach uses single queue for all processes. When it is time to load a process into main memory, the smallest available partition that will hold the process is selected.

www.eITnotes.com

Page 8: Contiguous Memory Allocation . Contiguous Memory Allocation  One of the simplest methods for allocating memory is to divide memory into.

Dynamic Partitioning

1) As, the name suggests, this scheme allows for a variable length and number of partitions. A process is allocated exactly as much memory as it requires and no more. This eliminates internal fragmentation completely.

2) Three placement algorithms that are considered are:

Best Fit

First fit

Worst fit

www.eITnotes.com

Page 9: Contiguous Memory Allocation . Contiguous Memory Allocation  One of the simplest methods for allocating memory is to divide memory into.

First fit: Allocate the first hole that is big enough. Searching can start either

at the beginning of the set of holes or where the previous first-fit search ended.

We can stop searching as soon as we find a free hole that is large enough.

Best fit: It chooses the free block closet to the requested size. Rather than breaking up a big hole, it tries to find a hole close to actual size needed.

Worst fit: Allocate the largest hole. Again, we must search the entire list,unless it is sorted by size. This strategy produces the largest leftover hole.

www.eITnotes.com

Page 10: Contiguous Memory Allocation . Contiguous Memory Allocation  One of the simplest methods for allocating memory is to divide memory into.

DOS Command

www.eITnotes.com

Page 11: Contiguous Memory Allocation . Contiguous Memory Allocation  One of the simplest methods for allocating memory is to divide memory into.

Batch Files

A batch file is a standard text file containing a list of commands which

can be submitted to MS-DOS for automatic sequential execution. Use of

batch files helps you avoid unnecessary retyping of command sequences

which are commonly repeated, complex, or difficult to remember.

Batch File Names

When naming batch files, use the .BAT extension on the filename. This extension tells ROM-DOS to execute the batch file when its name is entered from the command line.

www.eITnotes.com

Page 12: Contiguous Memory Allocation . Contiguous Memory Allocation  One of the simplest methods for allocating memory is to divide memory into.

To execute the batch file, type the file name on the command line. You need not include the .BAT extension. When you press <Enter> batch file execution begins

Creating a Batch File

A batch file can be created using any word processor or text editor that will save output as unformatted text (pure ASCII). Batch files can also be created by typing directly from the keyboard into a file. This is done with the command:

COPY CON filename.BAT

www.eITnotes.com