Professional Documents
Culture Documents
REFLECTIVE ESSAY OF OPERATING SYSTEM
REFLECTIVE ESSAY OF OPERATING SYSTEM
REFLECTIVE ESSAY
MEMORY MANAGEMENT
Memory management in an operating system (OS) is the process of managing
primary memory, or random-access memory, to improve concurrency, memory
utilization, and system performance. It keeps track of available memory, memory
allocation, and unallocated memory, and moves processes between primary and
secondary memory.
Role of Memory management
Following are the important roles of memory management in a computer system:
• Memory manager is used to keep track of the status of memory locations,
whether it is free or allocated. It addresses primary memory by providing
abstractions so that software perceives a large memory is allocated to it.
• Memory manager permits computers with a small amount of main memory
to execute programs larger than the size or amount of available memory. It
does this by moving information back and forth between primary memory
and secondary memory by using the concept of swapping.
• The memory manager is responsible for protecting the memory allocated
to each process from being corrupted by another process. If this is not
ensured, then the system may exhibit unpredictable behavior.
• Memory managers should enable sharing of memory space between
processes. Thus, two programs can reside at the same memory location
although at different times.
Memory Management Techniques:
The memory management techniques can be classified into following main
categories:
• Contiguous memory management schemes
• Non-Contiguous memory management schemes
Contiguous memory management schemes:
In a Contiguous memory management scheme, each program occupies a single
contiguous block of storage locations, i.e., a set of memory locations with
consecutive addresses.
• Single contiguous memory management schemes:
The Single contiguous memory management scheme is the simplest memory
management scheme used in the earliest generation of computer systems. In this
scheme, the main memory is divided into two contiguous areas or partitions. The
operating systems reside permanently in one partition, generally at the lower
memory, and the user process is loaded into the other partition.
Non-Contiguous memory management schemes:
In a Non-Contiguous memory management scheme, the program is divided into
different blocks and loaded at different portions of the memory that need not
necessarily be adjacent to one another. This scheme can be classified depending
upon the size of blocks and whether the blocks reside in the main memory or not.
PAGING
Paging is a technique that eliminates the requirements of contiguous allocation of
main memory. In this, the main memory is divided into fixed-size blocks of
physical memory called frames. The size of a frame should be kept the same as
that of a page to maximize the main memory and avoid external fragmentation.
Advantages of paging:
• Pages reduce external fragmentation.
• Simple to implement.
• Memory efficient.
• Due to the equal size of frames, swapping becomes very easy.
• It is used for faster access of data.
Paging is a storage mechanism used in OS to retrieve processes from secondary
storage to the main memory as pages. The primary concept behind paging is to
break each process into individual pages. Thus, the primary memory would also
be separated into frames.
Advantages of Paging
• It is one of the easiest Memory Management Algorithms.
• Paging helps in storing a process at non-contagious locations in the main
memory.
• Paging removes the problem of External Fragmentation.
Disadvantages of Paging
• It may cause Internal Fragmentation.
• More Memory is consumed by the Page Tables.
• It faces a longer memory lookup time.
VIRTUAL MEMORY
Virtual memory is a memory management technique that uses hardware and
software to create the illusion of a large memory on a computer. It's a common
technique used in operating systems (OS) to compensate for physical memory
shortages. For example, when an application is in use, data from that program is
stored in a physical address using RAM. If the RAM space is needed for
something more urgent, data can be swapped out of RAM and into virtual
memory.
Demand Paging is a popular method of virtual memory management. In demand
paging, the pages of a process which are least used, get stored in the secondary
memory.
A page is copied to the main memory when its demand is made or page fault
occurs. There are various page replacement algorithms which are used to
determine the pages which will be replaced.
SEGMENTATION
Shared pages are memory pages that can be used by multiple processes
simultaneously in an operating system (OS). They can be used instead of physical
RAM when more memory is needed, and the main advantage is that only one
copy of a shared file exists in memory. This reduces the overhead of pages and
allows for more efficient use of RAM.
A memory-mapped file is a file that stores its contents in virtual memory, which
allows an application to modify the file by reading and writing directly to the
memory. The operating system transparently loads parts of the file into physical
memory as the application access them, and releases them again if not needed
anymore.
Virtual memory is a memory management technique that allows a computer to
use secondary memory like the hard disk as if it were part of the main
memory. This helps when the physical memory is insufficient to handle the
tasks. Virtual memory uses both hardware and software to enable this.
In Unix, virtual memory managers create a virtual address space in secondary
memory, which determines which part of address space to load into physical
memory at any given time. This allows processes to access a large amount of
memory even if the physical memory is limited.
Virtual memory segmentation is a memory management technique in computer
systems that divides processes into multiple segments. The number of segments
is represented by "n", and not all segments are divided
simultaneously. Segmentation may or may not take place at the run time of the
program.
There are three different ways to implement virtual memory:
• Paging: Uses fixed-size pages to move between main memory and
secondary storage
• Segmentation: Uses varying-sized segments
• Segmented paging: Combines paging and segmentation
The Unix file system is a hierarchical file system that consists of the root file
system and all the file systems that are added to it. Files are members of a
directory, and each directory is in turn a member of another directory at a higher
level.
The root directory is the top-level directory in the Unix file system. It is
represented by a forward slash (/). All other directories and files are located below
the root directory.