Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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];

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

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions

Question

Explain the various methods of job evaluation

Answered: 1 week ago

Question

Differentiate Personnel Management and Human Resource Management

Answered: 1 week ago

Question

Describe the functions of Human resource management

Answered: 1 week ago

Question

=+What kinds of problems need to be overcome?

Answered: 1 week ago

Question

=+Describe an important trade-off you recently faced

Answered: 1 week ago