Question: How would you write this in C? Segmentation: Write a segmentation based allocator which allocates three segments for each process: text, data, and heap. The

 How would you write this in C? Segmentation: Write a segmentation

How would you write this in C?

Segmentation: Write a segmentation based allocator which allocates three segments for each process: text, data, and heap. The memory region within each segment must be contiguous, but the three segments do not need to be placed contiguously. Instead, you should use either a best fit, first fit, or worst fit memory allocation policy to find a free region for each segment. The policy choice is yours, but you must explain why you picked that policy in your README. When a segment is allocated within a hole, if the remaining space is less than 16 bytes then the segment should be allocated the full hole. This will cause some internal fragmentation but prevents the memory allocator from having to track very small holes. You should consider the following issues while designing your memory manager 1. Efficiency of your search algorithms: First-fit, worst-fit, and best-fit all require you to search for an appropriate hole to accommodate the new process. You should pay careful attention to your data structures and search algorithms. For instance, keeping the list of holes sorted by size and using binary search to search for a hole might improve efficiency of your best-fit algorithms. We do not require you to use a specific algorithm/data structure to implement the selected policy you have the flexibility of using any search algorithm/data structure that is efficient. We'll give you 10 points for any design that is more efficient that a brute-force linear search through an unsorted list of holes. Similarly. use an efficient search algorithm when deallocating a process from the processList. Explain all design decisions, the data structures and search algorithms used clearly in the README o Free block coalescing: When a process terminates, the memory allocated to that process is returned to the list of holes. You should take care to combine (coalesce) holes that are adjacent to each other and form a larger contiguous hole. This will reduce the degree of fragmentation incurred by your memory manager o 2. Paging: Next write a paging based memory allocator. This should split the system memory into a set of fixed size 32 byte pages, and then allocate pages to each process based on the amount of memory it needs. Paging does not require free block coalescing, but you should explain in your README your choice of algorithm and data structure for tracking free pages

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!