Join Our 4-Week Free Gen AI Course with select Programs.

Request a callback

or Chat with us on

Contiguous Memory Allocation in OS (Operating System)

Basics of Python
Basics of Python
icon
5 Hrs. duration
icon
9 Modules
icon
1800+ Learners
logo
Start Learning

Memory allocation is a critical concept in computer science. It involves allocating storage space for data and programs in computer memory. It plays a key role in how applications and operating systems efficiently manage the available resources. In computers, memory is classified into two types: contiguous and non-contiguous. This article explains contiguous memory allocation.

What is Contiguous Memory Allocation in OS?

Contiguous memory allocation is a memory management technique used by an operating system in which a process is allocated a single, continuous block of memory. This means that all the memory the process requires is in one unbroken block, making memory access straightforward and efficient. The memory is typically divided into partitions, and each process is loaded into a contiguous partition that fits its needs.  This approach can lead to issues like external fragmentation, where free memory is broken into small, non-contiguous blocks, making it challenging to find suitable space for new processes.

DevOps & Cloud Engineering
Internship Assurance
DevOps & Cloud Engineering

Types of the Contiguous Memory Allocation Techniques

Two main contiguous memory allocation techniques can be used to allocate the contiguous memory.

 

  • Fixed-Size Partition schema
  • Variable-size partition schema

 

Fixed-Size Partition Schema

The contiguous memory allocation is a schema technique in contiguous memory allocation by dividing the available memory memory partitions or segments of fixed size.  Each partition has a fixed size and can be allocated to a single process. Typically, the operating system decides on the partition size based on the amount of physical memory available and the size of processes expected.

Fixed-Size Partition Schema

Advantages of the Fixed-Size Partition Schema

 

  • Simplicity: The simple partition schema is a simple technique for memory allocation. It is easy to implement, and the operating system can easily allocate and manage memory using this technique.

 

  • Predictable behaviour: The fixed-size partition schema is predictable since the partition size is fixed.  The operating system can easily determine how much memory is available and allocate it accordingly.

 

  • Easy to manage: The fixed-size partition schema is easy to manage because the operating system can keep track of the start and end addresses of each allocated partition. It makes it easy to free up memory when a process terminates.

 

  • Efficient allocation: The fixed-size partition schema is an efficient technique for memory allocation. The operating system can quickly find a free partition of the appropriate size and allocate it to the process, reducing the overhead involved in memory allocation.

Disadvantages of the Fixed-size Partition Schema

 

  • Limited Flexibility: This fixed-size partition schema is rigid since the size of each partition is fixed. This is a disadvantage of systems based on varying memory requirements or processes of different sizes. Disadvantage in systems with varying memory requirements or processes of different sizes. This technique cannot accommodate processes that require more memory than partition size to do.

 

  • Internal fragmentation: The major disadvantage of the fixed-size partition schema is internal fragmentation. It happens when a process doesn’t use all the memory allocated to it but still has some free memory in that partition. If this unused memory is never freed over time, it can accumulate and, over time, make the memory management system less efficient overall.

 

  • Unequal partition sizes: If the size of memory is not divisible by the size partition, fixed size partition schema may result in unequal partition sizes.  This may result in inefficiency in memory utilisation, since some partitures could be unused.

Variable-size Partition Schema

The variable-size partition schema is a memory management approach where the operating system divides memory into partitions of varying sizes based on the memory requirements of individual processes. Unlike fixed-size partitions, this technique allows each process to be allocated exactly the amount of memory it needs, leading to efficient utilisation and reduced internal fragmentation. The fragmentation makes it difficult to find large enough contiguous blocks for new processes even if sufficient memory is available overall.

Variable-size Partition Schema

Advantages of the Variable-size Partition Schema

 

  • Efficient Memory utilisation: Fixed-size partitions can lead to internal fragmentation, while variable-size partitions allocate memory more closely aligned to the actual needs of processes, minimising unused space.

 

  • Flexibility in Allocation: Processes can be allocated exactly the amount of memory they require, allowing for better handling of processes of varying sizes and demands. This makes it ideal for systems with different sizes.

 

  • Reduced internal fragmentation: The variable-size partition schema can reduce internal fragmentation since the operating system can allocate the required amount of memory for each process. It reduces the amount of unused memory in the system and can improve overall performance.

Disadvantages of the Variable size Partition Schema

 

The variable-size partition schema, while offering several advantages also, comes with its own set of disadvantages.

 

  • Memory Gaps: Variable size partitions are allocated and deallocated, and free memory can become fragmented into small, non-contiguous blocks, making it difficult to allocate larger memory requests later on.
  • Complexity in Management: Managing variable-sized partitions requires more complex algorithms for memory allocation and deallocation increasing the overhead for the operating system.
  • Allocation Time: Finding a suitable partition for a new process can take longer due to the need to search for a free block that fits the process’s requirements, potentially slowing down process startup.

Conclusion

In this article, you learned that contiguous memory allocation is a simple and efficient memory management technique that is most efficient when dealing with quick access to sequential data. It has challenges since it leads to memory fragmentation, and we cannot change the size property once we increase or decrease the size. These challenges are addressed using defragmentation and memory allocation planning. It’s simple, it’s fast. Non-contiguous allocation offers more freedom, and it depends on which allocation strategy will meet the criteria of an application or a system.

FAQs
Contiguous memory allocation is a memory management scheme in which a process is allocated a single block of contiguous memory addresses. It ensures that the entire data or program resides in one continuous segment of physical memory.
Contiguous memory allocation is often used in systems where fast access to memory is crucial, such as real-time operating systems or embedded systems that require predictable response time.
No, a virtual memory system often uses non-contiguous allocation strategies like paging or segmentation. Contiguous memory allocation lacks flexibility, essential for managing virtual memory in modern operating systems.
Yes,  a process can be relocated to a different memory block, especially during memory compaction, to reduce fragmentation. However, relocating requires updating all addresses used by the process, which can be complex.

Deploying Applications Over the Cloud Using Jenkins

Prashant Kumar Dey

Prashant Kumar Dey

Associate Program Director - Hero Vired

Ex BMW | Google

19 October, 12:00 PM (IST)

Limited Seats Left

Book a Free Live Class

left dot patternright dot pattern

Programs tailored for your success

Popular

Management

Data Science

Finance

Technology

Future Tech

Upskill with expert articles

View all
Hero Vired logo
Hero Vired is a leading LearnTech company dedicated to offering cutting-edge programs in collaboration with top-tier global institutions. As part of the esteemed Hero Group, we are committed to revolutionizing the skill development landscape in India. Our programs, delivered by industry experts, are designed to empower professionals and students with the skills they need to thrive in today’s competitive job market.

Data Science

Accelerator Program in Business Analytics & Data Science

Integrated Program in Data Science, AI and ML

Accelerator Program in AI and Machine Learning

Advanced Certification Program in Data Science & Analytics

Technology

Certificate Program in Full Stack Development with Specialization for Web and Mobile

Certificate Program in DevOps and Cloud Engineering

Certificate Program in Application Development

Certificate Program in Cybersecurity Essentials & Risk Assessment

Finance

Integrated Program in Finance and Financial Technologies

Certificate Program in Financial Analysis, Valuation and Risk Management

Management

Certificate Program in Strategic Management and Business Essentials

Executive Program in Product Management

Certificate Program in Product Management

Certificate Program in Technology-enabled Sales

Future Tech

Certificate Program in Gaming & Esports

Certificate Program in Extended Reality (VR+AR)

Professional Diploma in UX Design

Blogs
Reviews
Events
In the News
About Us
Contact us
Learning Hub
18003093939     ·     hello@herovired.com     ·    Whatsapp
Privacy policy and Terms of use

© 2024 Hero Vired. All rights reserved