Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

RK Osy 2

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 16

MEMORY MANAGEMENT

INTRODUCTION

Memory Management is the process of controlling and


coordinating computer memory, assigning portions known as blocks to various
running programs to optimize the overall performance of the system. It is the
most important function of an operating system that
manages primary memory. It helps processes to move back and forward betwee
n themain memory and execution disk. It helps OS to keep track of every
memory location, irrespective of whether it is allocated to some process or it
remains free.
It checks how much memory is to be allocated
to processes. It decides which process will get memory at what time. It tracksw
henever some memory gets freed or unallocated and correspondingly it updates
the status.
Memory management moves processes between
storage drives and memory. It controls which processes
get priority in your computer's main memory and which
are sent to alternate storage areas.

ACS’S DIET ASHTI Page 1


MEMORY MANAGEMENT

Aims/Benefits of Micro Project :

 Efficient memory usage: The goal is to use a computer's memory resources


efficiently.
 Prevent crashes: Memory management prevents conflicts and crashes by
keeping track of which parts of memory are in use and which are available.
 Optimize memory usage: Memory management optimizes memory usage to
avoid wastage.
 Make processes more efficient: Memory management makes computer
processes more efficient by allocating memory to processes that need more and
releasing memory from applications or programs that may no longer use it.
 Enable multitasking: Proper memory management enables seamless
multitasking.

 makes computer processes more efficient by allocating memory to


processes that need more and releasing memory from applications or
programs that may no longer use it.

 Improves performance
Memory management reduces memory access operations, which are CPU-heavy
tasks. This improves computer speed and stability.
 Protects data and processes
Memory management ensures that processes only use the memory they are
given and enforces access permissions.

ACS’S DIET ASHTI Page 2


MEMORY MANAGEMENT

What is memory ?

The main memory is central to the operation of a modern computer. Main


Memory is a large array of words or bytes, ranging in size from hundreds of
thousands to billions. Main memory is a repository of rapidly available
information shared by the CPU and I/O devices. Main memory is the place
where programs and information are kept when the processor is effectively
utilizing them. Main memory is associated with the processor, so moving
instructions and information into and out of the processor is extremely fast.
Main memory is also known as RAM (Random Access Memory). This memory
is a volatile memory. RAM lost its data when a power interruption occurs.
memory refers to the computer hardware and management mechanisms used to
store data and programs while they are being used or processed by the CPU.
This includes both primary memory (such as RAM) and secondary memory
(such as hard drives or SSDs), though the focus in operating system design is
typically on managing primary memory, since it directly impacts performance.

 Primary Memory (RAM - Random Access Memory): This is the


temporary storage used by the system to store data that is actively being used or
processed. RAM is fast but volatile, meaning it loses its contents when the
system is powered off.
 Secondary Memory: Non-volatile storage such as hard drives (HDDs),
solid-state drives (SSDs), and other long-term storage devices. These devices
store data permanently or until explicitly deleted by the user or system.

ACS’S DIET ASHTI Page 3


MEMORY MANAGEMENT

ACS’S DIET ASHTI Page 4


MEMORY MANAGEMENT

Fig:- Memory Management

WHAT IS MEMORY MANGEMENT ?

The main memory is central to the operation of a modern computer. Main Memory is a
large array of words or bytes, ranging in size from hundreds of thousands to
billions. Main memory is a repository of rapidly available information shared
by the CPU and I/O devices. Main memory is the place where programs and
information are kept when the processor is effectively utilizing them. Main
memory is associated with the processor, so moving instruction and information into
and out of the processor is extremely fast. Main memory is also known as RAM
(Random Access Memory). This memory is a volatile memory. RAM lost its
data when a power interruption occurs.

The operating system must manage the allocation and deallocation of memory
to different processes running on the system. Key tasks include:

 Memory Allocation: Assigning portions of memory to various processes


or programs.
 Memory Protection: Preventing one process from accessing the memory
space allocated to another, ensuring data integrity and security.
 Memory Swapping: When the system runs low on RAM, it may move
some of the data from RAM to secondary storage in a process called
swapping or paging, allowing the system to continue running while
freeing up memory.
 Virtual Memory: A technique that creates an "illusion" of a larger
amount of RAM than physically exists by using part of the secondary
storage (disk space) to extend the available memory. This allows
programs to run even if they require more memory than is physically
available.

ACS’S DIET ASHTI Page 5


MEMORY MANAGEMENT

ACS’S DIET ASHTI Page 6


MEMORY MANAGEMENT

Why Memory Management is Required :

Allocate and de-allocate memory before and after process execution.

 To keep track of used memory space by processes.

 To minimize fragmentation issues.

 To proper utilization of main memory.

 To maintain data integrity while executing of process.

Now we are discussing the concept of logical address space and


Physical address space:

Logical and Physical Address Space:

ACS’S DIET ASHTI Page 7


MEMORY MANAGEMENT

Logical Address space:


An address generated by the CPU is known as a “Logical Address”. It
is also known as a Virtual address. Logical address space can be
defined as the size of the process. A logical address can be changed.

Physical Address space:


An address seen by the memory unit (i.e the one loaded into the
memory address register of the memory) is commonly known as a
“Physical Address”. A Physical address is also known as a Real
address. The set of all physical addresses corresponding to these
logical addresses is known as Physical address space. A physical
address is computed by MMU. The physical address always remains
constant.

Static and Dynamic Loading:


ACS’S DIET ASHTI Page 8
MEMORY MANAGEMENT

To load a process into the main memory is done by a loader. There


are two different types of loading

Static loading:-loading the entire program into a fixed address. It


requires more memory space.

Dynamic loading:-

The entire program and all data of a process must be in physical


memory for the process to execute. So, the size of a process is limited
to the size of physical memory. To gain proper memory utilization,
dynamic loading is used. In dynamic loading, a routine is not loaded
until it is called. All routines are residing on disk in a re locatable load
format. One of the advantages of dynamic loading is that unused
routine is never loaded. This loading is useful when a large amount of
code is needed to handle it efficiently .

ACS’S DIET ASHTI Page 9


MEMORY MANAGEMENT

Static and Dynamic linking:

To perform a linking task a linker is used. A linker is a program that


takes one or more object files generated by a compiler and combines
them into a single executable file.

Static linking:

In static linking, the linker combines all necessary program modules


into a single executable program. So, there is no runtime dependency.
Some operating systems support only static linking, in which system
language libraries are treated like any other object module.

Dynamic linking:

The basic concept of dynamic linking is similar to dynamic loading.


In dynamic linking, “Stub” is included for each appropriate library
routine reference. A stub is a small piece of code. When the stub is
executed, it checks whether the needed routine is already in memory
or not. If not available then the program loads the routine into
memory.

ACS’S DIET ASHTI Page 10


MEMORY MANAGEMENT

Fragmentation:
Fragmentation is defined as when the process is loaded and removed
after execution from memory, it creates a small free hole. These holes
cannot be assigned to new processes because holes are not combined
or do not fulfill the memory requirement of the process. To achieve a
degree of multiprogramming, we must reduce the waste of memory or
fragmentation problems.

In the operating systems two types of fragmentation:

a. Internal Fragmentation
b. External Fragmentation

ACS’S DIET ASHTI Page 11


MEMORY MANAGEMENT

Paging :

Paging is a memory management scheme that eliminates


the need for contiguous allocation of physical memory.
This scheme permits the physical address space of a
process to be non-contiguous.

 Logical Address or Virtual Address (represented in bits): An


address generated by the CPU

 Logical Address Space or Virtual Address Space (represented in


words or bytes): The set of all logical addresses generated by a
program

 Physical Address (represented in bits): An address actually available


on a memory unit

 Physical Address Space (represented in words or bytes): The set of


all physical addresses corresponding to the logical addresses

ACS’S DIET ASHTI Page 12


MEMORY MANAGEMENT

Advantages of Memory Management:-

Memory management keeps track of each and every


memory location, regardless of either it is allocated to
some process or it is free.

It checks how much memory is to be allocated to


processes.

It decides which process will get memory at what time.

It manages swap spaces, which store inactive pages of


memory

It enhance multitasking

Prevent crashes and errors due to memory conflict

ACS’S DIET ASHTI Page 13


MEMORY MANAGEMENT

Disadvantages of memory management:-

Availability of external fragmentation.

Algorithms of memory managements are costly.

Segmentation discovers free memory areas sufficiently


large.

Paging keeps rundown of free pages.

Segments of inconsistent size not fit also for trading.

ACS’S DIET ASHTI Page 14


MEMORY MANAGEMENT

CONCLUSION

Memory management ensure that blocs of memory space are properly manage
and allocated , so the operating system (OS) , applications and other running
processes have the memory they need to carry out their operation.

Memory management keep track of each and every memory location,


regardless of either it is allocated to some process or it is free. It checks how
much memory is to be allocated to processes. It decides which process will get
memory at what time. It tracks whenever some memory gets freed or
unallocated and correspondingly It updates the status.

ACS’S DIET ASHTI Page 15


MEMORY MANAGEMENT

REFERANCE

1) Third year Operatin System book


2) Figures are download from www.msbte.com
3) www.google.com
4) www.geeksforgeeks.com
5) For this project we used a MS-word

ACS’S DIET ASHTI Page 16

You might also like