The US workforce has a reputation for working hard, and most workers depend on a computer with fast, reliable performance. Your computer system is a workhorse that performs complex functions that allow you to increase your productivity, efficiency, and work quality. Your computer’s operating system is the intermediary that manages your system’s workload. It is the resource manager that works to make sure each system component has what it needs to work correctly.

Segmentation in OS is one of several memory management techniques available that helps resolve a specific system performance issue.

What Is Segmentation in OS?

Some Advantages of Segmentation in OS

Segmentation in OS is a management technique that helps your computer system manage its memory use efficiently. Segmentation does not work in a silo nor is it an all-encompassing memory management solution. It is the appropriate solution for specific system performance issues. Understanding the different computer components will help you determine what memory management strategy is right for your system.

Memory and Storage

Your computer needs memory to run the software programs installed on your machine and to access files stored on the external or internal computer storage units. When you turn on your system, the computer’s memory works with the computer processing unit (CPU) to perform system tasks.

Memory

The computer memory, also known as the random access memory, or RAM, is volatile and only stores system data, instructions, and processes long enough to perform computations and any system request it gets from your software programs. Unlike the RAM, your computer storage devices are permanent and stores all your files, executables, and other file components.

Central Processing Unit

Central Processing Unit

The central processing unit (CPU) is your computer’s brain. It executes the tasks you request via program execution. Some of these tasks may include running a complicated software program, creating a document, or writing an email. Every job, data, and instruction must go through the CPU.

The Operating System and Memory Management

If the CPU is your computer’s brain, then the operating system is the heart. It is your system’s resource manager. It ensures that the computer components work together to process all computer jobs.

  • It translates your request to the computer’s native language
  • It makes sure the CPU gets the data, instruction, and memory it needs to execute your programs
  • It manages the physical and logical memory to make sure your system can run multiple applications at one time

Memory Management

Memory Management

The operating system manages your system’s memory. It allocates memory to execute your computer programs. It also maintains each memory’s status and location. Most users have multiple programs running at one time. There are different strategies your computer can use to manage your computer memory.

Dynamic Loading and Dynamic Linking

While the system can load an entire program into memory, it is not always necessary. Dynamic loading and dynamic linking are two ways your system can improve your system performance. Dynamic loading is a memory management process that does not require a program to load all its components into memory for it to run. Instead, it divides the computer program processes into segments and loads the portion it needs to execute.

Some programs use other program processes to complete a job. The system can use dynamic linking to make better use of its memory. When a software program uses dynamic linking, the system loads the associated programs only when it needs it to perform a task. Both these memory management techniques increase performance by sharing memory space and only loading processes when they are needed.

Swapping

Sometimes your computer may have more active computer programs than it can run at one time. Swapping is a memory management process where the computer runs take turns running the active programs. It runs some of the active programs and then swaps them out for other system processes in the queue. Swapping allows your computer to process multiple programs. It also uses the CPU since it completes the jobs based on priority.

Contiguous Memory Allocation

Memory Allocation

Contiguous memory allocation is a memory management method where the system partitions the memory in consecutive blocks. Each block holds one process. Free memory blocks are called holes. As the blocks become available, the system loads other active operations in the holes. Though contiguous memory allocation is easy to implement, it does not maximize memory usage.

Memory Protection

You can restrict programs from running outside their designated memory location. This memory management schema help isolate an infected program from affecting other programs.

Memory Allocation

You can also use a memory technique where you can allocate memory to program processes using one of the three allocation types. When you use the first fit memory allocation strategy, the system stores in the program when it finds the first hole big enough to store it. The best-fit searches each allocation list to find the smallest memory location that can execute the process unless it comes to an exact fit. The final allocation type makes for the worst fit, by looking for the biggest space available and storing the process there.

The last second type of fit usually leaves large holes and small useless holes. The first fit performs the best of all three since the holes are typically average–they are neither extremely big or extremely small. Lastly, the final type of fit is the worst of the three since it grossly misuses the holes.

Is There a Need for Segmentation in OS?

Woman in polo

There are pros and cons to each memory method. Your computer may suffer from memory fragmentation depending on what technique the system uses. Memory fragmentation occurs when your system’s memory performance degrades. There are certain times where your system can benefit from segmentation. If you notice system slowing down or crashing, check to see if you have memory fragmentation. In some circumstances segmentation in OS can help.

Internal Fragmentation

Fragmentation

When your system uses a fixed-sized memory allocation strategy, it allocates the same amount of memory to each process. Some programs may not need to use all of its allocated memory; however, other processes cannot use the free memory when this happens. This memory management approach can cause internal fragmentation since other programs cannot use the unused memory. You fix internal fragmentation by allocating the exact amount of memory each process needs to complete the job.

External Fragmentation

External Fragmentation

On the other hand, external fragmentation occurs when you use a variable memory management approach. Instead of assigning fixed memory blocks, the system assigns exact-sized memory blocks, so each process only uses the amount of memory it needs to run its task. However, this memory management technique can leave memory holes too small to run process-intensive tasks, resulting in reduced system performance. One of the memory management solutions for external fragmentation is to allocate only same-sized memory blocks.

Fragmentation Solutions Strategies

Man holding cellphone while looking at the laptop

The fragmentation solution strategy you select depends on whether you need to solve for internal fragmentation or external fragmentation. Solving for one type of fragmentation can lead to other system performance issues. Segmentation in OS is useful for managing internal fragmentation, though it can cause external fragmentation.

Provide Information On How To Perform Segmentation In OS.

Segmentation in the OS begins when the system divides the program processes. It typically divides the process into three components (or segments): the program data, stack, and code. The system uses a memory allocation algorithm to determine how much memory each process needs and assigns it the exact amount. The system then loads each process into the designated memory location. These locations are non-contiguous.

Pagination in OS

Pagination a system-controlled memory management scheme used to manage fragmentation. The system divides the physical and logical memory locations into equal-sized blocks. The frames are the physical memory and the pages are the logical memory blocks. When a process needs to run, the system loads the pages into the frame location. The page table manages the logical and physical address for each process.

Pagination in OS Advantages and Disadvantages

Pagination

Pagination in OS is easy to implement. Since the pages are all the same size, memory swapping is simple. However, pagination takes up more space and can affect performance. Since all the pages are the same size, pagination can cause internal fragmentation. Furthermore, the pagination process is not visible, and the user cannot see how much memory is available or how much a specific process cost.

Segmentation in OS

Segmentation in OS

Segmentation in OS works similar to pagination with a few differences. First, the user manages segmentation, and the segment size is variable. The segments are identified by name and its length. When a program executes, it loads the logical memory into the associated physical memory block.

Segmentation in OS Advantages and Disadvantages

Segmentation minimizes internal fragmentation since it allocates memory blocks efficiently. It also consumes less space and efficiently uses memory. It does, though, cause external fragmentation. Lastly, it does not work with swapping since the storage sizes are variable.

Conclusion

Man in headset working in laptop

Segmentation in OS is a memory management solution that helps you minimize internal fragmentation. Still, memory management strategies are not mutually exclusive. You can use multiple memory management techniques to optimize your system’s performance.