Course Solutions Uncategorized (Solved) : Compiler Design Modify Code Memory Management Project Given Firstfit Please Finish Nextfit Q30130540 . . . .

(Solved) : Compiler Design Modify Code Memory Management Project Given Firstfit Please Finish Nextfit Q30130540 . . . .

 

Compiler Design – Modify Code:

Memory Management project

Given FirstFit, please finish NextFit and WorstFit.Follow the form of FirstFit! Please!

defragmentPrepareEnd and Front do not need tomodify.

!!!!!!!!!!!!!!!!!!!Do not provide code in differentform!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!Do not provide code in differentform!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!Do not provide code in differentform!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!Do not provide code in differentform!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!Do not provide code in differentform!!!!!!!!!!!!!!!!!!!!!!

————————————————————————————-

//FirstFit.hpp

#ifndef FIRSTFIT_HPP

#define FIRSTFIT_HPP

#include “Policy.hpp”

class FirstFit : public Policy

{

public:

void* onMalloc(int size);

void onFree(void* address);

};

#endif // !FIRSTFIT_HPP

————————————————————————————-

//FirstFit.cpp

#include “stdafx.h”

#include “FirstFit.hpp”

#include “MemoryStructure.hpp”

#include “ScheduleProcessor.hpp”

#include “defines.hpp”

#include <thread>

int defragmentPrepareEnd(int target_size);

int defragmentPrepareFront(int target_size);

void* FirstFit::onMalloc(int size)

{

MemoryStructure* ms = MemoryStructure::getInstance();

while(true)

{

void* prev_end = 0;

for(int i = 0; i < ms->getAllocationListSize(); i++)

{

Allocation alloc = ms->getAllocation(i);

if((int)alloc.addr – (int)prev_end >= size)

{

ASSERT(ms->allocate(prev_end, size));

return prev_end;

}

prev_end = (void*)((int)alloc.addr + (int)alloc.size);

}

if(MAX_MEMORY_CAP

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

(Solved) : Ex16xlch10graderml1hw Dow Jones 15 Project Description Intern Hicks Financial Small Tradin Q28863457 . . . .(Solved) : Ex16xlch10graderml1hw Dow Jones 15 Project Description Intern Hicks Financial Small Tradin Q28863457 . . . .

<p><strong>EX16_XL_CH10_GRADER_ML1_HW - Dow Jones 1.5</strong></p><p><strong>Project Description:</strong></p><p><em>You are an intern for Hicks Financial, a small tradingcompany located in Toledo, Ohio. Your intern supervisor wants youto create a report that details all