Operating Systems 2 - Memory Manager
Summary
TLDRSean's tutorial explores various memory management schemes, starting with the inefficient single user contiguous allocation, moving to fixed and dynamic partitions, and then to the more efficient paged memory allocation. He discusses demand paging, segmented memory allocation, and their combination, emphasizing virtual memory's ability to extend beyond physical RAM limits. The tutorial highlights the evolution of memory management, aiming to improve CPU efficiency and job processing times.
Takeaways
- đ The tutorial introduces three old memory management schemes: single user contiguous, fixed partitions, and dynamic partitions.
- đ Single user contiguous memory management was inefficient as it required the entire memory space for a single job and was impractical for modern systems.
- đ Fixed partitions allowed multiple jobs to be stored in memory but had static sizes, requiring a system reboot to change, leading to inefficiency.
- đ Dynamic partitions improved on fixed partitions by allocating memory based on job requests, but still required contiguous blocks and efficient allocation strategies.
- đ The script discusses allocation strategies like first fit and best fit, which have different trade-offs in terms of memory waste and processing speed.
- đïž Virtual memory is introduced as a solution to overcome the limitations of contiguous memory storage, allowing for more efficient memory usage.
- đ Paged memory allocation divides jobs into equal-sized pages, which can be stored in any available page frame, simplifying memory management.
- đșïž Demand paging is a variation of paged allocation where pages are loaded into memory only when needed, improving efficiency further.
- đ Page replacement policies like FIFO, LRU, LFU, and MRU are crucial for managing which pages to keep in memory and which to swap out.
- đ Segmented memory allocation breaks jobs into variable-sized segments based on the program's structure, allowing for more logical memory usage.
- đ Combined segmentation and paging allocation offers the benefits of both approaches, with the addition of segment map and page map tables for better control.
- đŸ Virtual memory allows systems to exceed physical RAM capacity by using the hard drive as backup memory, albeit at a slower speed but with increased flexibility.
Q & A
What was the first memory management scheme discussed in the tutorial?
-The first memory management scheme discussed was single user contiguous memory management, which was not very efficient as it required a single job to reserve the entire memory space.
Why was the single user contiguous memory management scheme considered impractical for modern operating systems?
-It was considered impractical because it would be very slow to process all of the jobs on demand, and if the job size was larger than the available RAM, it could not be executed.
What is the main advantage of fixed partitions over single user contiguous memory management?
-Fixed partitions allow allocated partitions to contain more than a single job at one time, improving efficiency over single user contiguous memory management.
What is the main disadvantage of fixed partitions in memory management?
-The main disadvantage is that the sizes of these partitions are static, meaning they cannot be changed unless the system is rebooted, which is not ideal for dynamic job processing.
How does dynamic partitioning improve upon fixed partitioning?
-Dynamic partitioning improves by allocating only as much memory as jobs request when they are loading for processing, thus avoiding memory waste and not requiring a system reboot to change partition sizes.
What are the two methods for allocating jobs to available partitions in fixed and dynamic partitions?
-The two methods are first fit, which finds the first partition with sufficient storage space, and best fit, which looks for the smallest partition to minimize memory waste.
What is the purpose of the paged memory allocation scheme?
-The purpose of paged memory allocation is to divide the job into equal-sized parts, allowing these parts to be stored in any available page frame in the main memory, improving efficiency over contiguous block storage.
What are the three tables used to keep track of page locations in paged memory allocation?
-The three tables are the job table, the page map table, and the memory map table, which keep track of various aspects of page locations and statuses.
How does demand paging differ from paged memory allocation?
-Demand paging is similar to paged memory allocation, but the main difference is that pages are loaded on demand, meaning they are only brought into memory when they are actually needed.
What is the role of a page replacement policy in demand paging?
-A page replacement policy determines which pages to replace when the memory is full, using algorithms such as first-in first-out, least recently used, least frequently used, and most recently used.
What is the main idea behind segmented memory allocation?
-Segmented memory allocation splits the job into separate segments that reflect the nature and structure of the code, allowing for more logical and efficient memory usage compared to paged allocation.
How does the final memory allocation scheme combine the benefits of segmentation and paging?
-The final scheme is a mixture of segmented and demand paging memory allocation, using both the segment map table and page map table, along with additional authority information, to offer the logical benefits of segmentation and the physical benefits of paging.
Why is virtual memory considered beneficial despite the increased processing cost?
-Virtual memory is beneficial because it allows the system to exceed the physical memory capacity by using the hard drive as a backup memory, acting as an extension to the RAM and providing a more efficient service to the CPU for handling jobs.
Outlines
đŸ Memory Management Evolution
Sean introduces various memory management schemes, starting with the single user contiguous method, which was inefficient due to the need for a job to occupy the entire memory space. This was followed by fixed partitions, allowing multiple jobs to be stored but with static sizes, leading to inefficiencies. Dynamic partitions improved on this by allocating memory based on job requests, but both required complex allocation strategies. The script then delves into virtual memory concepts, starting with paged memory allocation, which divides jobs into equal-sized pages and uses page frames in memory, simplifying the process but adding complexity in tracking page locations through various tables. The explanation covers job table, page map table, and memory map table functions.
đ Advanced Memory Allocation Techniques
The script continues with an exploration of demand paging, where pages are loaded into memory only when needed, and introduces the page replacement policies that determine how pages are managed in memory. It then discusses segmented memory allocation, which breaks jobs into segments reflecting the code's structure, and uses a segment map table for allocation. The final scheme combines segmented allocation with demand paging, offering logical and physical benefits but at the cost of increased complexity. The advantages of virtual memory, such as extending beyond physical RAM capacity using the hard drive as backup memory, are highlighted. The script concludes with a teaser for the next episode on process management and a call to action to subscribe to the S MKS Channel.
Mindmap
Keywords
đĄMemory Management
đĄSingle User Contiguous Memory
đĄFixed Partitions
đĄDynamic Partitions
đĄFirst Fit
đĄBest Fit
đĄPaged Memory Allocation
đĄDemand Paging
đĄSegmented Memory Allocation
đĄSegmentation and Paging
đĄVirtual Memory
Highlights
Introduction to memory management schemes and their evolution.
Single user contiguous memory management was inefficient and impractical for modern systems.
Fixed partitions allowed for multiple jobs in memory but had static sizes.
Dynamic partitions improved upon fixed partitions by allocating memory based on job requests.
Allocation schemes such as first fit and best fit were introduced for partition allocation.
Paged memory allocation divides jobs into equal-sized parts, improving efficiency.
Demand paging loads pages into memory only when needed, optimizing memory usage.
Page replacement policies like FIFO, LRU, LFU, and MRU are crucial for system efficiency.
Segmented memory allocation breaks jobs into segments reflecting the code's structure.
Segment map tables are used to manage the allocation of variable-sized segments.
Combined segmented and demand paging offers logical and physical memory management benefits.
Virtual memory allows exceeding RAM capacity by using the hard drive as backup memory.
The operating system's increased processing cost provides more efficient CPU job handling.
Sean's tutorial series will continue with the process manager in the next episode.
Importance of subscribing to the SMKS Channel for further educational content.
Overview of memory management's impact on performance and efficiency in operating systems.
Transcripts
hello my name is Sean and in this
tutorial we shall begin with the memory
manager and look at three old schemes of
memory management single user contiguous
was the first scheme of memory
management and it wasn't very efficient
in terms of performance a single job
would reserve the entire memory space
this job would be processed and then the
memory was cleared allowing the next job
to be loaded if the job size was larger
than the space available in the RAM it
could simply not be executed this scheme
is considered impractical for today's
modern operating systems as it would be
very slow to process all of the jobs on
demand but what if you wanted to store
two or three jobs in the memory this is
when fixed partitions came along
allowing allocated partitions to contain
more than a single job at one time all
of the partitions were stored in a
partition memory table to keep track of
partition usage the sizes of these
partitions were static
meaning they could not be changed unless
the system was rebooted so you could see
how this would be a problem a dynamic
solution was necessary to avoid having
to reboot the computer every time you
wanted to process a job a dynamic
partitions available memory is still
kept in contiguous blocks but jobs are
only given as much memory as they
request when they are loading for the
processing this has proven a significant
improvement over fixed partitions
because memory is not wasted in the
partition unfortunately this is not a
complete solution both fixed and dynamic
partitions need some way to allocate
jobs to the available partitions there
are two ways to do this the first fit
quite simply finds the first partition
that has sufficient storage space not
taking into account how much memory
could be wasted in the allocated
partition the best fit first looks for
the smallest partition was
putting in more space for other jobs
resulting in slower performance but
better efficiency so when a job has
completed processing it is then removed
from memory also known as D allocation
with a fixed partition this is fine it
is simply cleared but when using a
dynamic partition it gets more complex
to free up memory as it tries to join
together adjacent blocks so looking at
these simple allocation schemes we can
see there are still problems each one
required the memory manager to store the
entire program in the main memory at
contiguous locations we need to find a
way to avoid having to keep the whole
program in memory to run and the
restriction of storing the program's
contiguously what if we could divide the
jobs into separate smaller chunks we can
virtual memory is the solution and we
shall look at the evolution of four
memory allocation schemes let us start
with paged memory allocation allowing us
to divide the job into equal sized parts
the sections of a disk are known as
sectors or blocks and the sections of
main memory are known as page frames
before executing a program the memory
manager makes some preparations first it
determines how many pages are in the
program and then it locates enough empty
page frames in the main memory so that
it can pass all the pages into them the
adjacent memory blocks do not have to be
loaded in as adjacent memory blocks they
can be stored in any available page
frame in the main memory now this is a
more efficient scheme but it does come
with complications we need a way to keep
track of all the page locations which
increases complexity in the operation
through the use of three tables stored
in the part of the main memory we can
keep an eye and locations of various
jobs the job table is a dynamic list
that contains two values
the size of the job and the page map
table location of that job the page map
table contains important information for
each of the pages the page number and
its corresponding page frame memory
address
finally the memory map table has one
entry for each page frame listing both
its location and a status informing
whether it is in a busy or free State
now that we have an understanding of
paged map allocation we can now see how
demand paging works it's very similar to
the previous concept but the main
difference is that pages are loaded on
demand meaning that pages are only
brought into memory when they are
actually needed the page map table we
looked at before increases with three
more columns one to determine if the
page is already in memory known as the
status the second to check if the page
has been modified and a third to check
if the page has been referenced recently
how do we determine replacement of pages
by using a page replacement policy
first-in first-out least recently used
least frequently used and most recently
used our replacement policies used to
change pages based on a specific
algorithm these are all pretty
self-explanatory and are crucial to the
efficiency of the system so we have
looked at page map allocation and demand
paging but what else is there well we
have looked at separating the jobs into
pages what if we could break it down
even further we can segmented memory
allocation splits the job into separate
segments that reflect the nature and
structure of the code usually
when you view a script it is separated
into individual functions or subroutines
that can be called one at a time you may
have a function called add then makes a
calculation of two numbers and a
function called
divide we can call these one after the
other and they will run in the chose
in order now take all of these functions
and label them as segments instead of
using a page map table
we now have a segment map table that
makes a list of all of the varied sized
segments that need to be put in the main
memory to process now we move on to the
final scheme it is a mixture of
segmented and demand paging memory
allocation it offers the logical
benefits of the segmentation idea as
well as the physical benefits of paging
there is no new logic involved but there
are some minor modifications to point
out it makes use of both the segment map
table and page map table plus additional
information of authority to read write
and execute a file a major disadvantage
of this is the overheads and complexity
of adding in more tables to handle the
load
why is virtual memory a good thing well
let's say we currently have RAM that is
fully occupied and has no time for jobs
waiting to be slotted into it because we
use segmentation and paging we can
exceed memory capacity by turning to the
backup memory the hard drive and
although it's a slower alternative it
can act as an extension to the RAM we
have come a long way in memory but at an
increased processing cost the operating
system can provide a more efficient
service to allow the CPU the central
processing unit to handle jobs with
better timeframes and effectiveness this
has been Shawn and in the next episode
we will move on to the process manager
please
do not forget to subscribe to the S MKS
Channel
Voir Plus de Vidéos Connexes
L-5.2: Memory management Techniques | Contiguous and non-Contiguous | Operating System
L-5.8: Need of Paging | Memory Management | Operating System
14. OCR A Level (H046-H446) SLR4 - 1.2 Paging, segmentation and virtual memory
L-5.1: Memory Management and Degree of Multiprogramming | Operating System
L-5.3: Internal Fragmentation | Fixed size Partitioning | Memory management | Operating System
Basics of Dynamic Memory Allocation
5.0 / 5 (0 votes)