Operating System

You might also like

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

Operating system

Name:Laiba Rasheed
Roll no:SU72-BSCSM-F22-030
program:BSCS
Submitted to:Prof. Ali Imran
 Non-contiguous memory allocation
Operating systems use a memory management approach called non-contiguous
memory allocation. This method allocates memory to a process in a non-contiguous
way, which means that the process's memory may be divided into several non-
adjacent parts. The operating system can efficiently manage memory and assign it to
processes as needed . But it can also result in memory fragmentation, in which the
free memory blocks break up into tiny pieces that may not be used by more complex
operations. All things considered, non-contiguous memory allocation is a crucial
operating system approach that makes memory management effective.

Contiguous memory allocation is another method that operating systems utilize to


manage memory. This method allots memory to a process in a contiguous fashion,
giving it access to a single neighboring block of memory. There are benefits to this
strategy, like decreased fragmentation and enhanced performance for specific kinds of
activities. It does have certain disadvantages, though, like requiring more
sophisticated management algorithms and restricting the amount of memory that can
be used for larger operations. In general, modern operating systems need both
contiguous and non-contiguous memory allocation mechanisms for effective memory
management.

Paging vs Segmentation in Operating Systems


Operating systems use different techniques like paging and segmentation. Both
techniques have their advantages and disadvantages, and it's important to understand
their differences for your system.

 Paging

By using paging, the logical memory is divided into matching blocks called page
frames and the physical memory is divided into fixed-sized blocks called pages. To
maintain track of the mapping between the logical and physical memory address
regions, the operating system utilizes a page table. The page table converts a virtual
address, which a process uses whenever it wants to access memory, into a physical
address.
Two benefits of paging are its dynamic resource allocation and its ability to facilitate
effective memory management. Because every page has the potential to have unique
access privileges, it also offers memory protection.
One of paging's negatives is that it may result in internal fragmentation, wherein
certain pages are poorly utilized. In addition, it may result in page thrashing, a
situation in which the computer spends more time rotating pages in and out of
memory than running applications.

 Segmentation

1
Logical memory is segmented into variable-sized chunks called segments, which
might correspond to various software components. Better memory protection is made
possible by allowing each segment to have its own set of permissions. To maintain
track of the mapping between logical and physical memory addresses, the operating
system uses a segment table.
One of segmentation's benefits is that it lessens external fragmentation, which occurs
when memory sections are allocated but have tiny gaps between them. Additionally,
because each segment can have its size determined by its requirements, it can enhance
memory use.
Due to the requirement to track numerous segment tables, it may not be as efficient as
paging. Additionally, if the system is unable to locate a large enough block of
memory to allocate the desired segment, it may result in memory fragmentation.

Conclusion
Operating systems can manage memory effectively with both paging and
segmentation, but each has advantages and disadvantages. The sort of programs that
are going to operate on the system, its memory capacity, and its system requirements
all play a role in selecting the best technique.

 The implementation of paging and page address


translation

Paging and page address translation are essential for effective memory management
in contemporary computer systems. The operating system may partition physical
memory into manageable, uniformly sized chunks known as pages thanks to paging.
By using this method, the system can maximize the utilization of physical memory
and reduce fragmentation in memory management. The process of translating logical
addresses to physical addresses is known as page address translation. A page table
that associates logical addresses with physical addresses is kept up to date by the
operating system. Every time a program accesses a memory region, the operating
system converts the logical address to a physical address using the page table. In
conclusion, effective memory management in contemporary computer systems
requires the use of paging and page address translation. It helps the system to reduce
fragmentation and maximize the utilization of physical memory. In addition, virtual
memory usage is now a common feature of contemporary computer systems. By
utilizing a piece of the hard drive as an extension of physical memory, virtual memory
enables the development of additional memory space.System performance is
enhanced by this technology, which allows programs to access more memory than is
physically available. To prevent excessive switching between physical and virtual
memory, which can slow down the system, virtual memory must be managed
carefully. As a result, successful virtual memory management depends even more on
effective paging and page address translation. All things considered, effective
memory management is essential to modern computer systems' maximum speed and
stability.

2
 Page tables and paging with TLB

To enable memory management and effective resource use, operating systems must
include page tables and paging with TLB. To guarantee optimal operation and avoid
problems like fragmentation and memory leaks, these procedures must be
implemented with extreme attention to detail.To put it simply, paging with TLB
(Translation Look-aside Buffer) creates a cache for frequently used page table entries,
and page tables are used to convert virtual addresses to physical locations. The
structure of the page table and a technique for mapping virtual addresses to physical
addresses must first be defined in order to implement page tables and paging with
TLB. This entails allocating memory for the page table, determining the page size,
and choosing a replacement policy for the TLB cache. Although it is possible to
implement these methods in software as well, hardware implementation is more
common. Effective memory management depends on well thought out algorithms and
data structures in both scenarios. In order to ensure correct operation and efficient
resource usage, the implementation of page tables and paging with TLB is a crucial
component of operating system design. Following the implementation of the page
table and paging with TLB, it's critical to regularly assess their effectiveness and
make any required modifications. This may entail modifying the TLB cache
replenishment policy or changing the page size to better suit the system's
requirements. It's also crucial to take into account how these methods work with other
operating system elements like the file system and process scheduler.

 Page Table Structure and Hierarchical Page Tables


When it comes to operating systems and memory management, page tables play a
crucial role in the translation of virtual memory addresses to physical memory
addresses. Essentially, a page table is a data structure that stores the mapping between
virtual addresses and corresponding physical addresses.

1. A flat page table, which is a straightforward list of all virtual and physical address
mappings, is one kind of page table structure. However, hierarchical page tables
are frequently utilized in current computer systems due to the requirement for
greater memory and more advanced address spaces.
2. There are several levels to hierarchical page tables; the root level points to a
group of second-level page tables, which point to third-level page tables, and so
forth. By just allocating and mapping the memory pages that are required at each
level, as opposed to allocating all acceptable pages at once, this enables more
effective memory management.

Overall, the use of hierarchical page tables leads to more efficient and faster memory
management within operating systems.

3
Hashed Page Tables and Inverted Page Tables
Hashed Page Tables and Inverted Page Tables are two different mechanisms for
memory management in operating systems.

Hashed Page Tables

The operating system uses a data structure called a hashed page table to track which
physical memory locations are being used by the system at any one time. It functions
by creating an index into the table, which holds details about the pages that are
currently in use, using a hashing function. Because the hashing function makes it
possible to search through a list more quickly than through linear searching, this
method is efficient both in terms of using memory and access speed.

Inverted Page Tables

Some operating systems utilize an Inverted Page Table data structure to track the
virtual memory locations that the system is currently using. Every virtual page has an
entry in the table that corresponds to the position of the page in physical memory.
Because the page table requires less memory, this approach is memory-efficient; but,
because it requires a linear scan of the table, lookup speed is slower.

Conclusion

Hashed page tables and inverted page tables are efficient memory management
techniques. The specific needs of the operating system will determine which approach
is best.

You might also like