@@ -25,16 +25,25 @@ public abstract ArrayList<Integer> fitProcess(
25
25
int [] sizeOfBlocks ,
26
26
int [] sizeOfProcesses
27
27
);
28
+
29
+ /**
30
+ * A constant value used to indicate that an allocation has not been made.
31
+ * This value is used as a sentinel value to represent that no allocation has been made
32
+ * when allocating space in an array or other data structure.
33
+ * The value is -255 and is marked as protected and final to ensure that it cannot be modified
34
+ * from outside the class and that its value remains consistent throughout the program execution.
35
+ *
36
+ * @author: Ishan Makadia (github.com/intrepid-ishan)
37
+ * @version: April 06, 2023
38
+ */
39
+ protected static final int NO_ALLOCATION = -255 ;
28
40
}
29
41
30
42
/**
31
43
* @author Dekas Dimitrios
32
44
*/
33
45
class BestFitCPU extends MemoryManagementAlgorithms {
34
46
35
- private static final int NO_ALLOCATION = -255 ; // if a process has been allocated in position -255,
36
-
37
- // it means that it has not been actually allocated.
38
47
39
48
/**
40
49
* Method to find the maximum valued element of an array filled with
@@ -115,10 +124,6 @@ public ArrayList<Integer> fitProcess(
115
124
*/
116
125
class WorstFitCPU extends MemoryManagementAlgorithms {
117
126
118
- private static final int NO_ALLOCATION = -255 ; // if a process has been allocated in position -255,
119
-
120
- // it means that it has not been actually allocated.
121
-
122
127
/**
123
128
* Method to find the index of the memory block that is going to fit the
124
129
* given process based on the worst fit algorithm.
@@ -179,9 +184,6 @@ public ArrayList<Integer> fitProcess(
179
184
*/
180
185
class FirstFitCPU extends MemoryManagementAlgorithms {
181
186
182
- private static final int NO_ALLOCATION = -255 ; // if a process has been allocated in position -255,
183
-
184
- // it means that it has not been actually allocated.
185
187
186
188
/**
187
189
* Method to find the index of the memory block that is going to fit the
@@ -237,8 +239,6 @@ public ArrayList<Integer> fitProcess(
237
239
*/
238
240
class NextFit extends MemoryManagementAlgorithms {
239
241
240
- private static final int NO_ALLOCATION = -255 ; // if a process has been allocated in position -255,
241
- // it means that it has not been actually allocated.
242
242
private int counter = 0 ; // variable that keeps the position of the last registration into the memory
243
243
244
244
/**
0 commit comments