Memory Management Updated
Memory Management Updated
Memory
Memory
Computer has 2 types of memory:
Free
P3 finishes its execution P5 require 25Mb space
So space is free
Partition Allocation
One method of allocating contiguous memory is to divide all available
memory into equal sized partitions, and to assign each process
to their own partition.
Partition Allocation
Algorithms:
a) First Fit:
– Checks all partitions
serially
– When partition with size
= or > encounters, it is
allocated for storage.
Partition Allocation Algorithms
b) Best Fit: This approach will check all the free partitions and
will allocate that free partition to a process which leads to
minimum internal fragmentation.
Disadvantage:
1) Complexity is more
2) Overhead to check all the partitions to find best suitable
space
2^2 x 2^20 = 4M
4M x 2Byte= 8MB
Translation of Address to memory
Translate n bit address to memory
A. 16GB
B. 8 GB
C. 32 GB
D. 14 GB
Translation of Address to memory
a) 210 means 1K i.e 1Kilo (1024)
Ans: 64KB/1B
= 64K
26 x 210= 216
Ans: 32KB/1B
= 32K
25 x 210= 215
Ans:
Total 28 bits are required to rep. memory of 256MB
Address Translation
How to break logical address into page number and page
offset?
Effective access time = hit ratio x time taken for TLB hit +
miss ratio x time taken for TLB miss
Example
Explanation:
- TLB hit takes 120 nanoseconds total ( 20 to find the
frame number and then another 100 to go get the data )
- TLB miss takes 220 ( 20 to search the TLB, 100 to go
get the frame number, and then another 100 to go get
the data.
What will be the maximum size of memory required to load and run this program?
Overlays
Segmentation
• It is a memory management scheme in which the memory
allocated to the process is non contiguous
• Logical address space is divided into number of small blocks
called segments
• Segments are of variable sized.
1. The code
2. Global variables
3. The heap, from which memory is allocated
4. The stacks used by each thread
5. The standard C library
Segmentation
• Users view memory as a collection of variable size segments.
With no necessary ordering of these segments
1
4
1
2
3 2
4
3
c) logical address
MCQ
2. Memory management technique in which system stores and
retrieves data from secondary storage for use in main
memory is called
a) fragmentation
b) paging
c) mapping
d) none of the mentioned
MCQ
2.
b) paging
MCQ
3. The address of a page table in memory is pointed by
a) stack pointer
b) page table base register
c) page register
d) program counter
MCQ
3.
b) page table base register
MCQ
4. Program always deals with
a) logical address
b) absolute address
c) physical address
d) relative address
MCQ
4.
a) logical address
MCQ
5.
The page table contains
a) base address of each page in physical memory
b) page offset
c) page size
d) none of the mentioned
MCQ
5.
a) each process
MCQ
7. Locality of reference implies that the page reference being made
by a process
a. will always be to the page used in the previous page reference.
b. will always be to the page used in the previous page reference.
c. will always be to one of the pages existing in memory.
d. will always lead to a page fault.
MCQ
Ans 7: b