Download presentation
Presentation is loading. Please wait.
Published byGervais Ross Modified over 9 years ago
1
MEMORY MANAGEMENT Operating System
2
Memory Management Memory management is how the OS makes best use of the memory available to it Remember that the OS takes up memory space of its own When there are many programs sharing the same memory in a computer, there is always the potential for addresses to become ‘mixed-up’ and hence cause the program(s) to crash This memory management can be done in a couple of different ways
3
Fixed Partitioning In this scenario the available memory space is ‘partitioned’ into appropriate fixed length sizes These could be all of the same size or of differing sizes Programs are then simply loaded into the appropriate partition when one becomes available This is a relatively simple algorithm for the OS to deal with
4
Disadvantages The disadvantage however is that long queues can build-up and memory wasted as programs don’t always fit into a particular partition and hence can’t be started directly – needing to wait for a larger partition to become available Also programs that are using a partition maybe wasteful of memory as they are unlikely to require the full amount of space available The partitioning of the memory in the first place also sets an arbitrary limit on the number of programs that can be run at one time
5
Memory Management
6
Memory Management & Buffering The memory has been divided into 5 partitions 2 with 300MB of memory 2 with 200MB of memory 1 with 100MB of memory Limitation therefore of a maximum of 5 programs running at the same time
7
Memory Management & Buffering Assuming the following programs need to be run - how efficient is the current partitioning of the memory?
8
Memory Management & Buffering ProgramSizeActionMemory Used Program 1300Run300 / 1100
9
Memory Management & Buffering ProgramSizeActionMemory Used Program 1300Run300 / 1100 Program 2300Run600 / 1100
10
Memory Management & Buffering ProgramSizeActionMemory Used Program 1300Run300 / 1100 Program 2300Run600 / 1100 Program 3200Wait600 / 1100
11
Memory Management & Buffering ProgramSizeActionMemory Used Program 1300Run300 / 1100 Program 2300Run600 / 1100 Program 3200Wait600 / 1100 Program 4200Run800 / 1100
12
Memory Management & Buffering ProgramSizeActionMemory Used Program 1300Run300 / 1100 Program 2300Run600 / 1100 Program 3300Wait600 / 1100 Program 4200Run800 / 1100 Program 5200Run1000 / 1100
13
Memory Management & Buffering ProgramSizeActionMemory Used Program 1300Complete0 / 1100 Program 2300Run300 / 1100 Program 3300Run600 / 1100 Program 4200Run800 / 1100 Program 5200Run1000 / 1100
14
Memory Management & Buffering ProgramSizeActionMemory Used Program 1300Complete0 / 1100 Program 2300Run300 / 1100 Program 3300Run600 / 1100 Program 4200Run800 / 1100 Program 5200Run1000 / 1100 Program 6200Wait1000 / 1100
15
Memory Management & Buffering ProgramSizeActionMemory Used Program 1300Complete0 / 1100 Program 2300Run300 / 1100 Program 3300Complete300 / 1100 Program 4200Run500 / 1100 Program 5200Run700 / 1100 Program 6200 (300)Run1000 / 1100
16
Memory Management & Buffering ProgramSizeActionMemory Used Program 1300Complete0 / 1100 Program 2300Run300 / 1100 Program 3300Complete300 / 1100 Program 4200Run500 / 1100 Program 5200Run700 / 1100 Program 6200 (300)Run1000 / 1100
17
Memory Management & Buffering Using variable partitioning is a much more complex process This allows for partitions to be created dynamically as and when required This may seem to be the perfect solution BUT…there are problems When a program completes it obviously releases that partition(memory) for use by another program
18
Memory Management & Buffering However the new program is unlikely to be exactly the same size as the one that finishes This will mean that the next program either requires more or less memory than was in the previous partition If more is required the partition will then have to link two separate parts of memory to create a fragmented partition If less space is required, the ‘left over’ memory will itself become fragmented The longer this process goes on, the more fragmented partitions will be created
19
Memory Management & Buffering This will lead to a decrease in efficiency as the algorithms required to allocate the memory space will become increasingly more complex From time-to-time the memory will need to be defragmented to enable the system to continue working efficiently
20
Memory Management & Buffering Buffering is used to convert the physical blocks (of data) into the logical records used by the application software The OS usually carries out this process The area in main memory into which the physical blocks are loaded initially is known as the buffer This process of changing the physical blocks to logical records is usually transparent to the user
21
Memory Management & Buffering Physical Block 1 Physical Block 2 Physical Block 3 OS Software Secondary storage hardware Physical blocks on tape, disc, CD etc Physical Block 2 Physical block in main memory BUFFER OS Software Logical Rec 1 Logical Rec 2 Logical Rec 3 Logical Rec 4 Logical records in main memory Application Software Field 1 Field 2 Field 3 Field 4 Field 5 Data interpreted by application
22
Memory Management & Buffering The diagram makes use of just a single buffer, but if a faster speed of response is required it is usual to make use of two buffers – double buffering This means that while one physical block is being interpreted, another can be being loaded – leading to a more efficient and hence quicker response time
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.