0% found this document useful (0 votes)
82 views4 pages

Name: Shawal Ahammed Prince STUDENT ID: SUKD1902646 Tutorial 3 Memory Management - Virtual Memory

This document contains a student's responses to 7 questions about memory management techniques including internal vs external fragmentation, page table functions, thrashing detection, page replacement algorithms like FIFO and MRU, and calculations regarding page and fragmentation sizes. The student demonstrates understanding of these concepts and can perform related calculations to analyze page faults, failure and success ratios, and identify sources of internal vs external fragmentation.

Uploaded by

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

Name: Shawal Ahammed Prince STUDENT ID: SUKD1902646 Tutorial 3 Memory Management - Virtual Memory

This document contains a student's responses to 7 questions about memory management techniques including internal vs external fragmentation, page table functions, thrashing detection, page replacement algorithms like FIFO and MRU, and calculations regarding page and fragmentation sizes. The student demonstrates understanding of these concepts and can perform related calculations to analyze page faults, failure and success ratios, and identify sources of internal vs external fragmentation.

Uploaded by

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

NAME: SHAWAL AHAMMED PRINCE

STUDENT ID: SUKD1902646

TUTORIAL 3
MEMORY MANAGEMENT – VIRTUAL MEMORY
1. Compare and contrast internal fragmentation and external fragmentation. Explain the
circumstances where one might be preferred over the other.

Answer:

Internal fragmentation External fragmentation


1. Internal fragmentation takes place as the 1. External fragmentation happens where the
device or process is larger than memory. instrument or process is removed.

2. The internal solution for fragmentation is 2. The solution to external fragmentation are
the most suitable block. compaction, paging and segmentation.
3. This occurs as the memory is separated 3. External fragmentation takes place where
into fixed-size partitions. the memory is separated into variable size
partitions based on the size of the operation.

External fragmentation can be easier since compaction (defragmentation) can reuse the waste
space, even if it is merely a reaction. Any comprehensive answer is appropriate.

2. Describe how the function of the Page Map Table (PMT) differs in paged vs.
segmented/demand paging memory allocation.

Answer: The PMT in paged memory allocation correlates the page frame number for each of
the work pages. The PMT is similar to the paged memory allocation in the segmented / demand
memory, but also incorporates the updated (whether or not modified) and references (whether
or not recently referenced).

3. Describe how the operating system detects thrashing. Once thrashing is detected, explain
what the operating system can do to stop it.

Answer: As an operation becomes ineffective, it detects thrashing through unnecessarily wide


page swaps between primary and secondary storage (cause of the page erased from the
memory but called back shortly after that). This is avoided by the page substitution policy. Two
of the most well-known are the first-in-first-out protocol (the longest-in-memory deletion page)
and the least-used protocol (the less-accessed page that can be exchanged).

Tutorial 3 Chapter 3
4. Given that main memory is composed of three page frames for public use and that a seven-
page program (with pages a, b, c, d, e, f, g) requests pages in the following order:

a, b, a, c, d, a, e, f, g, c, b, g

a) Using the FIFO page removal algorithm, do a page trace analysis indicating page faults
with asterisks (*). Then compute the failure and success ratios.

Answer:

Page a B a C d a e F g c b g
request
Page * * * * * * * * * *
fault
Page a A a A d d d F f f b b
Frame 1
Page B b B b a a A g g g g
Frame 2
Page C c c e E e c c c
Frame 3
(The First-In First-Out page, the oldest swappable page, is shown in bold format)

Failure ratio = (10/12)*100=83.3333%


Success ratio = (2/12)*100=16.6667%

b) Increase the size of memory so it contains four page frames for public use. Using the
same page requests as above and FIFO, do another page trace analysis and compute the
failure and success ratios.

Answer:

Page request A b a C d a e f G c b g
Page fault * * * * * * * * *
Page Frame 1 a a a A a a e e e e b b
Page Frame 2 b b B b b b f f f f f
Page Frame 3 C c c c c g g g g
Page Frame 4 d d d d d c c c

(The First-In First-Out page, the oldest swappable page, is shown in bold format)

Failure ratio = (9/12)*100=75%


Success ratio = (3/12)*100=25%

Tutorial 3 Chapter 3
5. Let us define “most-recently-used” (MRU) as a page removal algorithm that removes from
memory the most recently used page. Perform a page trace analysis using three page
frames and the page requests from the previous exercise. Compute the failure and success
ratios and explain why you think MRU is, or is not, a viable memory allocation system.

Answer:

Page a d b a F b e c g f b g
request
Page fault * * * * * * * *
Page a a a a F f f f f f b b
Frame 1
Page d d d d d d d d d d d
Frame 2
Page b b b b e c g g g g
Frame 3

(The Most Recently Used page is shown in bold format)

Failure ratio = (8/12)*100=67%

Success ratio = (4/12)*100=33%

6. To implement LRU, each page needs a referenced bit. If we wanted to implement a least
frequently used (LFU) page removal algorithm, in which the page that was used the least
frequently would be removed from memory, what would we need to add to the tables?
What software modifications would have to be made to support this new algorithm?

Answer: The LRU page deletion algorithm looks into the page map table to track the changed
bit of each pages as well as the status bit. For the new interval, the ones that are changed and
referenced are not swapped, the same goes for pages that were not changed but referenced.
Two program’s modifications that are required for the LRU to correctly assess which pages have
recently been referenced or not to decide the page swap are clock replacement variation and
Bit Shifting variation.

Tutorial 3 Chapter 3
7. Using a paged memory allocation system with a page size of 2,048 bytes and an identical
page frame size, and assuming the incoming data file is 25,600 bytes, calculate how many
pages will be created by the file. Calculate the size of any resulting fragmentation. Explain
whether this situation will result in internal fragmentation, external fragmentation, or both.

Answer:
Page size = 2,048 bytes.
Page frame size = 2,048 bytes.
Data file = 25,600 Bytes.
Number of pages = 25,600 / 2,048 = 12.5 = 13. 

There would be 12 full Pages of 2,048 bytes, and a 13th Page with a size of 2,048 bytes but only
1,024 bytes occupying it, therefore there is a fragmentation of 1,024 bytes.  This would be an
internal fragmentation in the last page of the job.  External fragmentation is eliminated in
paged memory because an empty page frame can be used by any page of any job.
 
This reflects my ability to think in a quantitative context because I have demonstrated an
outstanding command of numerical use or understanding, have applied the requisite and
enough logical rules and have regularly used maths to solve mathematical problems.

Tutorial 3 Chapter 3

You might also like