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

Tutorial Chapter 2

This tutorial discusses different types of memory management systems and fragmentation. It compares and contrasts fixed, dynamic, and relocatable dynamic partition systems. It also explains best-fit, first-fit, and worst-fit allocation algorithms and calculates memory waste for different job and memory block scenarios using each algorithm.

Uploaded by

Voon Rou Ng
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views

Tutorial Chapter 2

This tutorial discusses different types of memory management systems and fragmentation. It compares and contrasts fixed, dynamic, and relocatable dynamic partition systems. It also explains best-fit, first-fit, and worst-fit allocation algorithms and calculates memory waste for different job and memory block scenarios using each algorithm.

Uploaded by

Voon Rou Ng
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

TUTORIAL 2

MEMORY MANAGEMENT – EARLY SYSTEM


_________________________________________________________________________________________________________

1. Explain the fundamental differences between internal fragmentation and external


fragmentation. For each of the four memory management systems explained in this chapter
(single user, fixed, dynamic, and re-locatable dynamic), identify which one causes each type
of fragmentation.

External fragmentation is total memory space exists to satisfy a request, but it is not
contiguous. Internal fragmentation means allocated memory may be slightly larger the
requested memory, this size difference is memory internal to a partition, but not being used.
Fixed partitions will cause internal fragmentation when the partition is too large and
dynamic partitions will cause external fragmentation while subsequent allocation.

2. Which type of fragmentation is reduced by compaction? Explain your answer.

External fragmentation is the type of fragmentation that is reduced by compaction.


Compaction gathers all the free memory and stores it in one location, making it available for
the next processes that require memory. Only dynamic and relocatable dynamic memory
systems can do this.

3. How often should relocation be performed? Explain your answer.

Before launching any application, it is necessary to execute reallocation. The executable is


usually generated using zero as the lower-most, starting address by compilers or
assemblers. These addresses should be modified before object code is executed so that they
denote the right runtime addresses. If you want to relocate the address, you should shut
down the computer to relocate.

4. Imagine an operating system that does not perform memory de-allocation. Name at least
three unfortunate outcomes that would result and explain your answer.

 Run out of memory. The computer will run out of memory because there is no extra
space to let other’s memory allocate.
 Fragmentation both internal and external. When an operating system doesn’t
perform memory de-allocation, the external and internal fragmentation will always
exist until the memory de-allocation.

Tutorial 2 Page 1
 The computer will get slower, and battery will drain. When computer’s memory gets
clogged up and the computer must work hard to find available memory, potentially
getting so clogged that it can’t run anything, and the computer will get slower.

5. Compare and contrast a fixed partition system and a dynamic partition system.

Fixed partition system Dynamic partition system


Main memory is partitioned at system Main memory is partitioned with jobs given
startup. memory requested when loaded.
Partition sizes remain static. Partition sizes based on the memory request.
Internal fragmentation External fragmentation
Memory waste large. Memory waste comparatively small.
Matching job size with partition sized. Full memory utilization only during loading of
first jobs.

6. Compare and contrast a dynamic partition system and a re-locatable dynamic partition

The main memory of dynamic partition system is partitioned. Jobs given memory requested
when loaded and one contiguous partition per job. It uses “First come, First Serve”
allocation method in allocating job and its memory waste is comparatively small. For
relocatable dynamic partition system, the memory manager relocates programs of which it
gathers together all empty blocks. Compact the empty blocks and make one block of
memory large enough to accommodate some or all of the jobs waiting to get in.

Tutorial 2 Page 2
7. Given the following information.

BLOCK 1
JOB 1
690 K 900 K

BLOCK 2
JOB 2
275 K 910 K

BLOCK 3
JOB 3 300 K
760 K

Indicate which memory blocks are allocated to each of the three arriving jobs.

a. Use the best-fit algorithm


Job 1: Block 1 (900K-690K=210K memory waste)
Job 2: Block 3 (300K-275K=25K memory waste)
Job 3: Block 2 (910K-760K=150K memory waste)
With using best-fit algorithm, total memory waste is 210K+25K+150K=385K

b. Use the first-fit algorithm


Job 1: Block 1 (900K-690K=210K memory waste)
Job 2: Block 2 (910K-275K=635K memory waste)
Job 3: Wait
With using first-fit algorithm, total memory waste is 210K+635K+300K=1145K

c. Use the worst-fit algorithm


Job 1: Block 2 (910K-690K=220K memory waste)
Job 2: Block 1 (900K-275K=625K memory waste)
Job 3: Wait
With using worst-fit algorithm, total memory waste is 220K+625K+300K=1145K

Tutorial 2 Page 3
Introduction to Operating Systems
_________________________________________________________________________________
_
8. Given the following information...

JOB 1 BLOCK 1
275 K
900 K

JOB 2 BLOCK 2
920 K
910 K

JOB 3
BLOCK 3
690 K
300 K

Indicate which memory blocks are allocated to each of the three arriving jobs.

a. Use the best-fit algorithm


Job 1: Block 3 (300K-275K=25K memory waste)
Job 2: Wait
Job 3: Block 1 (900K-690K=210K memory waste)
With using best-fit algorithm, total memory waste is 25K+920K+210K=1155K

b. Use the first-fit algorithm


Job 1: Block 1 (900K-275K=625K memory waste)
Job 2: Wait
Job 3: Block 2 (910K-690K=220K memory waste)
With using first-fit algorithm, total memory waste is 625K+920K+220K=1765K

c. Use the worst-fit algorithm


Job 1: Block 2 (910K-275K=635K memory waste)
Job 2: Wait
Job 3: Block 1 (900K-690K=210K memory waste)
With using best-fit algorithm, total memory waste is 635K+920K+210K=1765K

Tutorial 2 Page 4

You might also like