Urgenthomework logo
UrgentHomeWork
Live chat

Loading..

CPT304 Week 3 The Memory Allocation Algorithms

CPT304: Operating Systems Theory & Design

Dynamic memory manages system memory. The operating system gives a block of main memory. Usually the purpose is to add a node to a data structure. Dynamic memory allocation can be used to get the memory for a new object.

First fit, the partition is allocated which is first sufficient from the top of Main Memory.

It takes data and scans from beginning of memory to the end until the first free space that is at least big enough to accept the data. Once a space that is big enough is located it is the allocated to the data whatever that is left over becomes smaller, separate free space. If there is data to be allocated that is bigger than the available space, then an error is shown.

Here we will have an example of the first fit algorithm. The first free partition is selected in this manner. We have chosen the first available partition and also calculated what is left over. Here we will initialize the memory blocks and if the memory block is greater than or equal to the memory process, we will then allocate the job to the first available partition. We will repeat this until there is a memory process that cannot be allocated or fit the specifications. This type of algorithm can lead to external fragmentation. This is where there are various holes being made in the memory. You also find that we first fit there is a reduction in time spent on analyzing available space

CPT304 Week 3 The Memory Allocation Algorithms Image 1

Best fit portioning deals with allotting the smallest free partition that will meet the needs of the requesting process. During this process the all of the free partitions are search and the one with the smallest partition that has adequate space is chosen. The goal is to find a space that is close to the actual size needed. Decidedly to build this chart correctly we have chosen the partition that are closest in size to the size of the memory. Here we will initialize the memory blocks and if the memory process that we find that is less than or equal to the block, we will then allocate the job to the first partition that is closest is size. We will repeat this process until there is a memory process that cannot be allocated or fit the specifications. This type of algorithm can lead to some external fragmentation. This also can slow down the speed of the allocation of memory however it is the best in utilizing and making the most efficient use of memory

CPT304 Week 3 The Memory Allocation Algorithms Image 2

The worst fit algorithm will only look for free space in which the information can be stored in memory. In this scenario generally the space that is chosen is much larger than the size of the information that will be stored. Below we have only chosen the partition that is the largest in comparison to the memory process that has been provided. This process we begin by initializing the memory block and we will verify if the process is greater than or equal to the memory block after this, we will assign the memory process to the largest partition. This will continue until we have memory process’s that can longer satisfy the specifications needed for the worst fit. This particular algorithm is wasteful in the efficiency of space and it makes it hard to allocate large partitions.

CPT304 Week 3 The Memory Allocation Algorithms Image 3

Each of these algorithms has its advantage. First-fit has better speed because it is not taking the time to analyze each block. Best-fit is more efficient with memory space because its main objective is to make sure that the memory process is in a memory block closest to it size. Worst-fit could have an advantage if all the memory process are close to the same size and remain consistent.

Bibliography

Memory Management. (n.d.). Retrieved from Tutorialspoint: https://www.tutorialspoint.com/Memory-Management

Operating System - Memory Management. (n.d.). Retrieved from Tutorials Point: https://www.tutorialspoint.com › operating_system › os_memory_management

Operating System - Multi-Threading. (n.d.). Retrieved from Tutorials Point: http://www.tutorialspoint.com/operating_system/os_multi_threading.htm

Silberschatz, A. G. (2014). Operating system concepts essentials . Retrieved from https://redshelf.com/

What is Dynamic Memory Allocation? (n.d.). Retrieved from Geeks for Geeks: https://www.geeksforgeeks.org/what-is-dynamic-memory-allocation/

Resources

  • 24 x 7 Availability.
  • Trained and Certified Experts.
  • Deadline Guaranteed.
  • Plagiarism Free.
  • Privacy Guaranteed.
  • Free download.
  • Online help for all project.
  • Homework Help Services

Testimonials

Urgenthomework helped me with finance homework problems and taught math portion of my course as well. Initially, I used a tutor that taught me math course I felt that as if I was not getting the help I needed. With the help of Urgenthomework, I got precisely where I was weak: Sheryl. Read More

Copyright © 2009-2023 UrgentHomework.com, All right reserved.