L-5.18: Overlay | Memory Management | Operating system
Summary
TLDRThe video script delves into the concept of overlay, a technique used to manage large processes in limited main memory by dividing them into smaller, manageable partitions. It explains the process of dividing and loading only the necessary functionality at a time, which is particularly useful in embedded systems with fixed functionalities and limited memory. The script also discusses the challenges of manual partition division and the lack of an operating system driver to support overlays. It contrasts overlay with virtual memory, a more common approach in PCs, and provides an example calculation for determining the minimum partition size required for a two-pass assembler.
Takeaways
- 📚 Overlay is a technique used to load large processes into a main memory smaller than the process size by dividing the process into smaller, manageable parts.
- 🔍 The concept of fixed partitioning has a constraint where the maximum process size cannot exceed the largest partition size in the main memory.
- 🔄 Overlay allows for the dynamic loading and unloading of process segments into the main memory based on the functionality needed at a given time.
- 🛠️ In overlay systems, there is no operating system support for managing the process segments, so users must manually divide the process appropriately.
- 🔧 The division of a process in an overlay system should be independent to avoid dependencies between segments that could lead to errors during execution.
- 📱 Overlay is commonly used in embedded systems where functionality is fixed and predictable, allowing for easier manual division of processes.
- 🏗️ In embedded systems, the limited main memory size necessitates the use of overlay to bring in one functionality at a time as needed.
- 💡 The concept of overlay is not typically used in modern PCs and desktops, where virtual memory and demand paging are preferred for managing memory.
- 🔢 The minimum partition size required for an overlay system can be calculated by considering the largest memory requirement when loading a single pass of a process along with other necessary components.
- 🔧 In the example of a two-pass assembler, the partition size should be large enough to accommodate the pass with the highest memory requirement, which includes the assembler pass, symbol table, common routine, and overlay driver.
- 📈 The overlay technique is particularly useful in situations where the main memory is limited and processes are larger than the available memory space.
Q & A
What is the concept of overlay in memory management?
-Overlay is a memory management technique used to accommodate large processes that exceed the size of the main memory. It involves dividing the process into smaller segments or partitions and loading only the necessary segment into the main memory at a time.
How does the overlay technique work when the process size is more than the main memory size?
-In the overlay technique, the process is divided into smaller parts, and only the part that is needed at the moment is loaded into the main memory. Once the task of the loaded part is completed, it is swapped out, and another part is loaded in its place.
What is the constraint of fixed partitioning in memory management?
-Fixed partitioning limits the size of the process that can be loaded into the main memory to the size of the largest partition. If a process is larger than the largest partition, it cannot be loaded entirely into the main memory.
Why is the overlay technique commonly used in embedded systems?
-The overlay technique is commonly used in embedded systems because these systems typically have fixed functionalities and limited main memory. Users can manually divide the process into independent, functional segments that can be loaded sequentially as needed.
What is the problem with the overlay technique when it comes to process division?
-The problem with the overlay technique is that it requires the user to manually divide the process into independent segments. If the segments are not independent, it can lead to issues where the CPU cannot find the necessary data or code to continue execution.
Why is the overlay technique not commonly used in modern PCs?
-Modern PCs do not commonly use the overlay technique because they rely on virtual memory and demand paging, which allows for more efficient use of the main memory by swapping in and out pages as needed, rather than requiring manual segmentation of processes.
What is a two-pass assembler and how does it relate to the overlay concept?
-A two-pass assembler is a type of assembler that requires two passes over the source code to generate the object code. It relates to the overlay concept because each pass can be considered a separate segment that can be loaded into memory as needed, demonstrating the overlay technique in practice.
What is the minimum partition size required for a two-pass assembler with an overlay driver of 10kb size?
-The minimum partition size required is 150kb, which is the size needed to load pass 2 along with the symbol table, common routine, and overlay driver, as this is the larger of the two scenarios when only one pass is in use at a time.
How does the overlay technique handle the symbol table and common routine in a two-pass assembler scenario?
-In the overlay technique for a two-pass assembler, the symbol table and common routine are loaded along with the active pass. When one pass is completed and swapped out, the other pass, along with the necessary components, is loaded into the main memory.
What is the significance of the overlay driver in the context of the two-pass assembler example?
-The overlay driver is a component that facilitates the loading and unloading of different segments in the overlay technique. In the context of the two-pass assembler, it is necessary for managing the memory when switching between the two passes.
Why is the maximum partition size chosen for the overlay technique in the two-pass assembler scenario?
-The maximum partition size is chosen to ensure that the largest segment, which in this case is pass 2 with its associated components, can fit into the main memory. This prevents the issue of not being able to load a necessary segment because the memory is too small.
Outlines
💡 Understanding Overlay in Memory Management
This paragraph introduces the concept of overlay, a technique used to accommodate large processes in main memory that exceed its size. It explains how processes can be divided into partitions and loaded into memory as needed, overcoming the limitations of fixed partitioning. The discussion highlights the challenges of manually dividing processes and the suitability of overlays for embedded systems, where functionality is fixed and predictable. The paragraph also touches on the limitations of overlays in general-purpose computers, where processes vary in size and number, and the concept of virtual memory is more appropriate.
🔍 Calculating Partition Sizes for Overlays
The second paragraph delves into a practical example of using overlays, specifically in a two-pass assembler scenario. It outlines the process of calculating the minimum partition size required when the main memory is less than the total size of the assembler. The example includes the sizes of pass 1, pass 2, the symbol table, common routine, and overlay driver. The paragraph explains how to determine the maximum partition size needed to accommodate both passes and their associated components, emphasizing the importance of choosing the larger of the two partition sizes to ensure efficient memory usage.
📚 Overlays vs. Virtual Memory in Real-Time Systems
The final paragraph summarizes the use of overlays, emphasizing their application in systems with limited main memory, such as embedded systems. It contrasts the overlay technique with virtual memory, which is more commonly used in PCs and involves swapping pages in and out of memory. The paragraph concludes by reinforcing the concept that overlays are primarily used when the main memory is insufficient to hold the entire process, and virtual memory techniques are employed in systems where memory is more abundant and processes are more dynamic.
Mindmap
Keywords
💡Overlay
💡Main memory
💡Partition
💡Embedded system
💡Symbol table
💡Common routine
💡Assembler
💡Two-pass assembler
💡Virtual memory
💡Demand paging
Highlights
Overlay allows large processes to be accommodated in main memory by dividing them into smaller parts.
In fixed partitioning, the maximum process size is limited by the largest partition, which is a constraint.
Overlay is used when the main memory is smaller than the process size, requiring the process to be divided and loaded in parts.
The process is divided into partitions based on the functionality needed first, which is then loaded into main memory.
There is no built-in driver in the operating system for overlay, requiring users to manually decide how to divide the process.
The concept of overlay is particularly useful in embedded systems where functionality is fixed and predictable.
In embedded systems, the process can be divided into functions that are executed sequentially, fitting the limited main memory.
Division of the process in overlay must be independent to avoid dependencies between partitions, which could lead to errors.
Overlay is less suitable for PCs and desktops where processes vary in size and number, making manual division impractical.
Virtual memory is used in PCs instead of overlay, involving swap-in and swap-out of pages.
A two-pass assembler example is used to illustrate the concept of overlay, where only one pass is in use at a time.
The minimum partition size required for the assembler example is calculated based on the size of the passes, symbol table, common routine, and overlay driver.
The partition size must be the maximum of the two scenarios (pass 1 or pass 2 loaded) to ensure all necessary components fit in memory.
The concept of overlay is primarily used in embedded systems due to their fixed functionality and limited main memory.
In real-time systems like PCs, virtual memory is preferred over overlay for managing memory with larger and varying process sizes.
The calculation of partition size in overlay involves adding the sizes of all components needed for a single pass of the process.
The overlay technique is less common in modern systems, being replaced by virtual memory and demand paging.
Transcripts
- Overlay- Overlay is a method by which a large size process can be put into the main memory, means
- if the size of my process is more than the size of memory, then I can make that process accommodate in the main memory by using the concept of overlay
- How? Let say, I've 4 partitions in main memory, 2mb, 4mb, 8mb and 16mb
- Now, what is the size of maximum partition, 16mb, here what constraint comes in fixed partitioning
- that I cannot make process bigger than 16mb enter. But if we use overlay
- then I can accommodate the process even more than 16mb. So where do we use overlay?
- Where the size of our main memory is less than the size of process. So in that case we bring that process in main memory
- and how we allocate memory to it, this is a point. Now how does overlay use this
- when we, the process whose size is more than main memory, we cannot bring in all that directly because obviously main memory size is smaller and process size is bigger
- so in process, what we'll have to do, we'll have to divide the process, what it meant to say, that we will divide the process/program/object code
- and the code/functionality that is needed first we will load the functionality in main memory.
- when the work of that functionality will be done then we will bring it out and bring in another partition, and third after the second, we have to bring in the partitions like this
- so overlay is creating a problem here that there is no driver in the operating system which support the overlay
- means, here user have to decide on it's own how to divide that process/program so that whenever I bring in the partition
- I could execute it's functionality properly. Then bring it out and then bring in another program
- so like this, there can be a very big problem, it may happen that the work I have to do first, I didn't bring in that partition first - so actually this concept of overlay is used in embedded system because in embedded
- because user is dividing here. Now user divides manually on it's end, it can divide however it wants
- embedded system are those where my functionality is fixed, means those circuits that perform only fixed type of functionality
- like my washing machine, in that I know it only works on a fixed functionality.
- so what can I do there, I can divide that process and creat 2-3 different functions
- and main memory, obviously my main memory is limited in embedded system. So I'll bring in one functionality
- when it's work will be completed, I'll bring in second functionality, when it's work will be completed, I'll bring it out and I'll bring in third
- but the problem here is, that when the user will divide those functionality/process
- then that division should be independent. Independent means if I bring in this partition.
- So it should not be like some codes in this partition is depending upon that partition. Otherwise a problem can be created there that the data CPU is searching, it can't find that
- but this doesn't create a problem in embedded system because the function/process in embedded system is fixed
- but in computers, the PCs, desktops, there our processes are of different size, there are different no. of process
- so there I cannot leave the functionality here on user that it divides itself , how should we divide that, how we should create it
- so that's why this concept of overlay is used in embedded system. It is still used in many embedded systems.
- but we don't use this in our computers, here we use the concept of virtual memory.
- we will discuss the concept of virtual memory or demand paging in further videos. So let's discuss a question about how we actually use overlay
- like we have, consider a two pass assembler, pass 1 80 kb, pass 2 90 kb
- symbol table is of 30kb, common routine 20kb, at a time only one pass is in use. What is the min. partition size required if the overlay driver is of 10kb size
- means, here they are talking about, that I have a assembler here, why do we use assembler?
- Assembler is used to convert source code into object code
- and for that here I'm using 2 pass assembler, means it's working in 2 passes
- when we'll use pass 1 then there is no need of using pass 2 and when we'll use pass 2 then there is no need of using pass 1
- So if I look at the total size here, then size of pass 1 is 80kb, size of pass 2 is 90kb
- Symbol table, which is mandatory, 30kb. Common routine 20kb and how we have to bring in pass 1 in main memory
- and then bring it out and then again bring in pass 2 and bring it out from main memory, for that here is a overlay driver
- and the size of that driver is 10kb
- 10 kb
- So what's the total here
- it's, 200.., 220.., 230
- 230 kb
- means the all here, the size of the whole program became 230 kb. Means, if the size of my memory is 230 kb.
- Then, there's no problem, you can directly work with this full function/process because your memory size is 230 kb
- but, that's where we are using the concept of overlay. Let say, the size of my memory is not 230kb, it is less than 230kb.
- So when the size is less than 230kb, then I cannot keep the whole process/assembler in the main memory at a same time because we're assuming main memory size is less than 230kb
- So here it is asked in question that, the partition or how much should be the size of main memory so that I can use overlay there and use the passes properly
- so it's already mentioned in the question that at a time only 1 pass is in use. Means, if we use pass 1, it's size is 80kb
- if we load pass 1 first so that means we have a requirement of 80kb plus 30kb symbol table
- 20kb for common routine and 10kb for overlay driver
- that means, what the total is?
- 140
- 140 kb
- Means if I load pass 1 first, along with the symbol table, common routine. Then I need 140 kb of memory here.
- So can I take 140 kb of memory, will this 140 kb memory be enough for my work? Wait,
- We haven't calculated pass 2 yet. If we bring out
- pass 1 from main memory after loading it and then load pass 2,
- then the size of pass 2 is 90kb
- and when we'll load pass 2, symbol table is also needed, common routine is also needed and drive is also needed.
- so here my total is, 150 kb
- 150kb. If I load pass 1, 140kb and if I load pass 2, 150kb
- means if I keep size of one partition in the memory
- 150kb
- Then, when that size will be of 150kb, means, there's a empty space of 150kb
- when I'll load pass 2, then my full 150kb will be filled
- pass 1 isn't needed at that time because when we load pass 2, at a time only 1 pass is used, means, only 1 pass is in use.
- then I'll load pass 2 at that time. And when pass 2 will get out of here then I'll load pass 1
- when pass 1 will come in, it's occupying the memory 140kb. So 140kb can easily be accommodated in 150kb.
- so that's the point here that you have to choose the one which is max. out of these two. Means, if we're using pass 1, our total requirement is of 140kb
- and if we load pass 2, our total requirement is of 150kb
- so if I keep a partition of 140kb, then the problem still exists. The partition is of 140kb, when the pass 2 of 150kb will come
- then how will you fit that? 150kb won't fit in 140kb. So the best thing is that choose the partition of size which is larger or which has maximum no.
- So that means, the answer of this question can be 150kb
- So this was about partition. Even if you're asked normally that what should be size of main memory? If the size of my main memory is 230 kb
- then there is no need of using overlay. We use overlay where the main memory is limited and processes are quite larger.
- we use overlay in that case. So that's why, if you're asked this type of question, then simply calculate it first, and out of those values the one with maximum value is the size of partition
- or we can say that will be the size of main memory. It can be asked in any of these terms, it maybe possible they ask in terms of partition or they may ask in terms of main memory requirement, so you can calculate that
- so that's why we use the concept of overlay where my main memory is limited
- and most of time this happens in embedded system. In real time, we don't use this in our PCs. In real time, we use the concept of virtual memory, where is swap-in and swap-out the pages.
- how we do demand paging or how we use that, that we will see in the further videos.
- This is all about the concept of overlay. Thank you.
Browse More Related Video
L-5.8: Need of Paging | Memory Management | Operating System
L-5.3: Internal Fragmentation | Fixed size Partitioning | Memory management | Operating System
L-5.19: Virtual Memory | Page fault | Significance of virtual memory | Operating System
Sistemas Computacionais - Técnica de memória virtual: paginação e segmentação
39. OCR GCSE (J277) 1.5 Operating systems 1
L-5.9: What is Paging | Memory management | Operating System
5.0 / 5 (0 votes)