Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help me to create the repormemory method please complete my code import java.util.*; public class MemoryManagement { int MAX; int[] addresses; public MemoryManagement(int MAX)

please help me to create the repormemory method

please complete my code

import java.util.*;

public class MemoryManagement { int MAX; int[] addresses; public MemoryManagement(int MAX) { this.MAX = MAX; this.addresses = new int[MAX]; } public static void requestMemory(String process, int size, String flag) {

// allocate memory using one of the three approaches(first-fit, best-fit, worst-fit) } public static void releaseMemory(String process) { // keep track of which region of memory has been allocated to which process } public static void compactMemory() { // compact the set of holes into one larger hole } public static void reportMemory() { // report the regions of free and allocated memory } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter the inital size: "); int size = scanner.nextInt(); scanner.nextLine(); MemoryManagement memoryManagement = new MemoryManagement(size);

while (true) { System.out.print("allocator>"); String input = scanner.nextLine(); String processID = ""; String[] command = input.split(" "); switch (command[0]) { case "RQ": requestMemory(command[1], Integer.parseInt(command[2]), command[3]); break; case "RL": processID = (command[1]); // do something break; case "C": // do something break; case "STAT": // do something break; case "X": System.exit(0); break; default: System.out.println("Invalid command"); } } } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions