Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

my method dosent print the last procces please help me fix it public static void reportMemory() { int start = -1; int end = -1;

my method dosent print the last procces please help me fix it

public static void reportMemory() { int start = -1; int end = -1; int currentProcess = -1;

for (int i = 0; i < MAX; i++) { int address = addresses[i]; if (address != 0) { if (currentProcess == -1) { // First used address found start = i; currentProcess = address; } else if (address != currentProcess) { // New process found end = i - 1; System.out.printf("Addresses [%d, %d] Process P%d ", start, end, currentProcess - 1); start = i; currentProcess = address; } } else { if (currentProcess != -1) { // End of used address range found end = i - 1; System.out.printf("Addresses [%d, %d] Process P%d ", start, end, currentProcess - 1); currentProcess = -1; } } }

// Check if there's a range of unused addresses at the end if (currentProcess == -1) { System.out.printf("Addresses [%d, %d] Unused ", end + 1, MAX - 1); } }

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

6 Compute and interpret the inventory turnover ratio.

Answered: 1 week ago