0% found this document useful (0 votes)
6 views

Tutorial Main Memory Management

The document discusses various memory management schemes in operating systems, including multiple variable partitions and simple paging, detailing the functions performed by the OS in each case. It also outlines fixed and variable partition memory management strategies, providing examples of memory allocation for different requests using first-fit, next-fit, best-fit, and worst-fit strategies. Additionally, it covers the significance of page sizes being powers of two and highlights the differences between segmentation and paging, along with examples of calculating physical addresses from logical addresses.

Uploaded by

nana
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)
6 views

Tutorial Main Memory Management

The document discusses various memory management schemes in operating systems, including multiple variable partitions and simple paging, detailing the functions performed by the OS in each case. It also outlines fixed and variable partition memory management strategies, providing examples of memory allocation for different requests using first-fit, next-fit, best-fit, and worst-fit strategies. Additionally, it covers the significance of page sizes being powers of two and highlights the differences between segmentation and paging, along with examples of calculating physical addresses from logical addresses.

Uploaded by

nana
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/ 3

CSC207 FUNDAMENTAL OF OPERATING SYSTEMS

TUTORIAL
Memory Management

1. In each of the listed memory management schemes, briefly describe the functions performed by the
operating system:

(a) Multiple variable partitions?

The operating system is responsible for dividing the physical memory into multiple variable-sized
partitions. Each partition can accommodate a program or a process, and the size of the partition is not
fixed.

(b) Simple paging?

The operating system manages the mapping between logical pages and physical frames through a page
table. It handles page faults, allocates and deallocates pages in physical memory, performs page
replacement when necessary, enforces memory protection and manages fragmentation to optimize
memory usage.

2. In a fixed partition memory management, assume that Suppose at time Tn, the free partition list is as
follows:

10K, 20K, 30K, 40K

Determine which partition will be assigned if the request for memory in the queue is as follows:

P1 - 12K
P2 - 10K
P3 - 18K
P4 - 15K

Answer the above if the following allocation strategy is used:

(a) First-fit
P1 (12K) will be assigned to the 20K partition
P2 (10K) will be assigned to the 10K partition
P3 (18K) will be assigned to the 20K partition
P4 (15K) will be assigned to the 20K partition

(b) Next-fit
P1 (12K) will be assigned to the 30K partition
P2 (10K) will be assigned to the 20K partition
P3 (18K) will be assigned to the 30K partition
P4 (15K) will be assigned to the 30K partition

(c) Best-fit
P1 (12K) will be assigned to the 20K partition
P2 (10K) will be assigned to the 10K partition
P3 (18K) will be assigned to the 20K partition
P4 (15K) will be assigned to the 20K partition

(d) Worst-fit
P1 (12K) will be assigned to the 40K partition
P2 (10K) will be assigned to the 40K partition
P3 (18K) will be assigned to the 40K partition
P4 (15K) will be assigned to the 40K partition

3. In a variable partition memory management, assume memory is allocated as specified in a diagram below:
Suppose the request for memory is as follows:

P1 (18K), P2 (12K), P3 (7K)

Redraw the diagram to show how memory would look after all requests has been allocated by using the
following memory allocation strategies:

(a) First fit

P3 P1 P2

(b) Next fit

P1 P2 P3

(c) Best fit

P3 P1 P2

(d) Worst fit

P1 P2 P3

4. Why is page size always in the power of 2?

It aligns well with the binary representation of addresses. This alignment simplifies the mapping of logical
addresses to physical addresses and vice versa.

5. What are the two major differences between segmentation and paging?
Segmentation Paging
Use variable-size addressing method Use fixed-length addressing method
Memory is divided into logical segments that Memory is divided into fixed-size sections known as
correspond to various components of a programme pages

6. On a system using simple segmentation, compute the physical address for each logical address stated
below, given the following segment table. If the address generates a segment fault, indicate so.
Segment Base Length/Limit

0 330 124

1 876 211

2 111 99

3 498 302

(a) 1, 265 (b) 3, 222 (c) 0, 111

(a) Segment 1, Offset 265: Physical Address


= 876 + 265 = 1141 (Segment Fault as offset > limit)

(b) Segment 1, Offset 222: Physical Address


= 498 + 222 = 720 (Segment Fault)

(c) Segment 1, Offset 111: Physical Address


= 330 + 111 = 441 (No Segment Fault)

You might also like