Q1. Consider a memory of size 16KB. This memory is allocated in increments of 1KB and the memory is initially empty. Use the various contiguous allocation schemes (First-fit, Best-fit, and Worst-fit) for satisfying the memory allocation/deallocation requesting the sizes shown in the table below. requests for processes Process Requested size (in KB) A B C D E F G H I 4.2 7.2 2.5 4.5 3 2.7 1.5 2 3.6 Allocate(P) represents an allocation request by process P for the size shown in the above table Deallocate(P) is used to indicate deallocating the memory allocated to process P To represent memory, in square brackets, we use P to indicate a memory segment allocated to P and we use an integer to indicate a contiguous free part of memory. For example, after the following sequence of requests: Allocate(B), Allocate(G), Allocate(H), Deallocate(G) memory will look like this: B 8KB We represent this memory by [B,2,H,4]. free H 2KB 2KB For each of the following sequence of requests, apply the First-fit, Best-fit, and Worst-fit allocation schemes. Assume that for each algorithm, you always start at the beginning of the list and if there are multiple possible equal-size holes that can be selected by an algorithm, the first one is selected. Show the following: If X is requesting 6 KB the answer will be: [B,2,H,4] and Allocate(X) cannot be satisfied i. If all the requests can be satisfied, indicate the memory representation at the end of the sequence. If a request cannot be satisfied by an algorithm, indicate which request is this and the memory representation at this point. For example, consider adding the request Allocate(X) to the previous example. The following are answer examples If X is requesting 3 KB, the answer will be [B,2,H,X,1] First-fit free 4KB ii. Which method is the best for this particular sequence, and the amount (in KB) of internal fragmentation at the end of the sequence for this best method. Enter your answers in the tables below. J 1 c) Request Sequence: Allocate(1), Allocate(G), Allocate (H), Allocate(C), Allocate (A), Deallocate (1), Deallocate (H), Deallocate (A), Allocate(J), Allocate (E), Allocate(H), Allocate(D) Worst-fit Best-fit The best algorithm for this sequence of requests is: The amount of internal fragmentation (in KB) for this algorithm is

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter12: Points, Classes, Virtual Functions And Abstract Classes
Section: Chapter Questions
Problem 19SA
icon
Related questions
Topic Video
Question
Q1. Consider a memory of size 16KB. This memory is allocated in increments of 1KB and the
memory is initially empty. Use the various contiguous allocation schemes (First-fit, Best-fit,
and Worst-fit) for satisfying the memory allocation/deallocation requests for processes
requesting the sizes shown in the table below.
Process
Requested size (in
KB)
A
B
C
D
E
F
G
H
4.2 7.2 2.5 4.5 3 2.7 1.5 2
Allocate(P) represents an allocation request by process P for the size shown in the above table
Deallocate(P) is used to indicate deallocating the memory allocated to process P
B
8KB
We represent this memory by [B,2,H,4].
To represent memory, in square brackets, we use P to indicate a memory segment allocated
to P and we use an integer to indicate a contiguous free part of memory. For example, after
the following sequence of requests: Allocate(B), Allocate(G), Allocate(H), Deallocate(G)
memory will look like this:
free H free
2KB 2KB 4KB
I
3.6
If X is requesting 6 KB the answer will be:
[B,2,H,4] and Allocate(X) cannot be satisfied
For each of the following sequence of requests, apply the First-fit, Best-fit, and Worst-fit
allocation schemes. Assume that for each algorithm, you always start at the beginning of the
list and if there are multiple possible equal-size holes that can be selected by an algorithm,
the first one is selected. Show the following:
i. If all the requests can be satisfied, indicate the memory representation at the end of
the sequence. If a request cannot be satisfied by an algorithm, indicate which request
is this and the memory representation at this point. For example, consider adding the
request Allocate(X) to the previous example. The following are answer examples
If X is requesting 3 KB, the answer will be
[B,2,H,X,1]
J
1
ii. Which method is the best for this particular sequence, and the amount (in KB) of
internal fragmentation at the end of the sequence for this best method.
Enter your answers in the tables below.
c)
Request Sequence: Allocate(1), Allocate(G), Allocate (H), Allocate(C), Allocate(A),
Deallocate (1), Deallocate(H), Deallocate(A), Allocate (J), Allocate(E), Allocate(H),
Allocate(D)
First-fit
Best-fit
Worst-fit
The best algorithm for this sequence of requests is:
The amount of internal fragmentation (in KB) for this algorithm is
Transcribed Image Text:Q1. Consider a memory of size 16KB. This memory is allocated in increments of 1KB and the memory is initially empty. Use the various contiguous allocation schemes (First-fit, Best-fit, and Worst-fit) for satisfying the memory allocation/deallocation requests for processes requesting the sizes shown in the table below. Process Requested size (in KB) A B C D E F G H 4.2 7.2 2.5 4.5 3 2.7 1.5 2 Allocate(P) represents an allocation request by process P for the size shown in the above table Deallocate(P) is used to indicate deallocating the memory allocated to process P B 8KB We represent this memory by [B,2,H,4]. To represent memory, in square brackets, we use P to indicate a memory segment allocated to P and we use an integer to indicate a contiguous free part of memory. For example, after the following sequence of requests: Allocate(B), Allocate(G), Allocate(H), Deallocate(G) memory will look like this: free H free 2KB 2KB 4KB I 3.6 If X is requesting 6 KB the answer will be: [B,2,H,4] and Allocate(X) cannot be satisfied For each of the following sequence of requests, apply the First-fit, Best-fit, and Worst-fit allocation schemes. Assume that for each algorithm, you always start at the beginning of the list and if there are multiple possible equal-size holes that can be selected by an algorithm, the first one is selected. Show the following: i. If all the requests can be satisfied, indicate the memory representation at the end of the sequence. If a request cannot be satisfied by an algorithm, indicate which request is this and the memory representation at this point. For example, consider adding the request Allocate(X) to the previous example. The following are answer examples If X is requesting 3 KB, the answer will be [B,2,H,X,1] J 1 ii. Which method is the best for this particular sequence, and the amount (in KB) of internal fragmentation at the end of the sequence for this best method. Enter your answers in the tables below. c) Request Sequence: Allocate(1), Allocate(G), Allocate (H), Allocate(C), Allocate(A), Deallocate (1), Deallocate(H), Deallocate(A), Allocate (J), Allocate(E), Allocate(H), Allocate(D) First-fit Best-fit Worst-fit The best algorithm for this sequence of requests is: The amount of internal fragmentation (in KB) for this algorithm is
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 17 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning