Operating System Fundamentals



Download 2.34 Mb.
View original pdf
Page40/66
Date06.03.2023
Size2.34 Mb.
#60834
1   ...   36   37   38   39   40   41   42   43   ...   66
OperatingSystemFundamentals
best answers from c, Lesson 2 C# Windows Forms
Memory
First Fit
Worst Fit
Best Fit

Figure 4.1
Using memory allocation strategies to assign
12KB of memory

Operating System Fundamentals
57
Fragmentation
The use of particular memory allocation strategies may result in wasting valuable free memory. That is because using either the best fit or first fit strategies may leave small chunks of free memory that are not large enough to be useful for any other processes (like parking a motorcycle in a parking space, and not having enough space left for another vehicle. The allocation and de- allocation of memory creates a condition called
fragmentation. This means that there are lots of small fragments (or holes) of free memory that cannot be used by any other process. This results in a reduction in the amount of total available memory. The worst fit memory allocation strategy attempts to minimize fragmentation by finding the largest chunk of free memory available to allocate to a process. By doing this, the memory manager tries to ensure that the unused memory holes it leaves areas large as possible. The goal is to leave as many big chunks of memory as possible so that as many fragments as possible are large enough to be used by other processes.
Relocation
Another task that must be handled by the Memory Manager is the relocation of applications in memory. Applications have certain memory requirements when they are loaded. However, it is not possible for the application to know in advance which memory range it will be allocated, because the application itself does not know what other processes will be running, how much physical memory the system will have available to it, and whether or not some of its required memory will be comprised of virtual
memory pages (see next topic. For this reason, the application will only make reference to
relative‖ or ―logical‖ address ranges. When the application is compiled to load a process into memory, the operating system will allocate the actual address range based upon the relative ranges provided by the application, and the actual memory resources available. As demonstrated in Figure 4.3 (right, the process that is loaded will provide a logical address, which is combined with a base address provided by the operating system, to determine its actual location in memory. The application itself will be unaware of its location in memory. However, once a process has been started, it is not possible for the Memory Manager to relocate that process in memory unless it is aware of the relocation, and the new base address.

Download 2.34 Mb.

Share with your friends:
1   ...   36   37   38   39   40   41   42   43   ...   66




The database is protected by copyright ©ininet.org 2024
send message

    Main page