0% found this document useful (0 votes)
120 views2 pages

Exam Answers Memory Management

Uploaded by

Meregulwa Allan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
120 views2 pages

Exam Answers Memory Management

Uploaded by

Meregulwa Allan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

3.

Describe how the following are used in memory management (10 marks):

a) Fragmentation:

Fragmentation refers to the inefficient use of memory, where either internal or external

fragmentation can occur.

- Internal Fragmentation happens when a memory block allocated to a process is larger than what

the process needs, resulting in unused space within the allocated block.

- External Fragmentation occurs when free memory is scattered in small, non-contiguous blocks,

making it difficult to allocate large contiguous spaces to new processes.

b) Multiple-Partition Allocation:

In this method, memory is divided into fixed or variable-sized partitions, where each partition can

hold exactly one process. A process is loaded into a partition that is big enough to hold it. The

method may suffer from fragmentation and partitioning inefficiencies, as small processes may

occupy large partitions, leaving wasted memory.

c) Contiguous Allocation:

Contiguous allocation assigns a single contiguous block of memory to a process. This method is

simple to implement and allows for fast sequential and direct access. However, it leads to external

fragmentation over time as processes are loaded and removed. Memory compaction can be used to

mitigate this problem by rearranging free blocks together.

d) Segmentation:

Segmentation divides a program into different logical units called segments (e.g., code, data, and

stack). Each segment can grow independently. The segments can be of variable sizes, based on

the nature of the program, and they are stored in different parts of memory. This method allows

better management of memory but may suffer from external fragmentation.

e) Paging:

Paging is a memory management scheme that eliminates the need for contiguous allocation by
dividing memory into fixed-size blocks called pages and the corresponding physical memory into

frames of the same size. A page table is used to map pages to frames. This method solves external

fragmentation but introduces some overhead due to the page table.

4. Differentiate between the following (7 marks):

a) Demand Paging and Pure Demand Paging (3 marks):

- Demand Paging: In demand paging, pages are brought into memory only when they are required

during execution. If a process references a page that is not currently in memory, a page fault occurs,

and the page is loaded into memory.

- Pure Demand Paging: In pure demand paging, none of the pages of a process are loaded into

memory at the start. Pages are loaded only when they are explicitly referenced for the first time,

meaning no pages are preloaded.

b) Page Table and Segment Table (2 marks):

- Page Table: A page table is used in paging and maps logical pages to physical frames in memory.

It manages fixed-size pages and stores their addresses.

- Segment Table: A segment table is used in segmentation and maps logical segments of varying

sizes to physical memory addresses. Each entry in the table corresponds to a segment and contains

its base address and limit.

c) First-Fit Placement and Best-Fit Placement (2 marks):

- First-Fit Placement: In this method, memory is allocated by finding the first available free block of

memory that is large enough to satisfy the request. It is a simple and fast approach.

- Best-Fit Placement: Best-fit searches the entire list of free blocks to find the smallest block that is

large enough to accommodate the request. This method minimizes wasted space but may lead to

small leftover fragments that are difficult to use.

You might also like