-
Notifications
You must be signed in to change notification settings - Fork 0
/
FileAllocationSimulation.java
31 lines (25 loc) · 1.18 KB
/
FileAllocationSimulation.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package OS;
import java.util.ArrayList;
import java.util.List;
public class FileAllocationSimulation {
public static void main(String[] args) {
SequentialAllocation sequentialAllocation = new SequentialAllocation(1000);
IndexedAllocation indexedAllocation = new IndexedAllocation(1000);
LinkedAllocation linkedAllocation = new LinkedAllocation(1000);
FileAllocation file1 = new FileAllocation("file1.txt", 200);
FileAllocation file2 = new FileAllocation("file2.txt", 400);
FileAllocation file3 = new FileAllocation("file3.txt", 300);
sequentialAllocation.allocateFile(file1);
sequentialAllocation.allocateFile(file2);
sequentialAllocation.allocateFile(file3);
indexedAllocation.allocateFile(file1);
indexedAllocation.allocateFile(file2);
indexedAllocation.allocateFile(file3);
linkedAllocation.allocateFile(file1);
linkedAllocation.allocateFile(file2);
linkedAllocation.allocateFile(file3);
sequentialAllocation.printAllocatedFiles();
indexedAllocation.printAllocatedFiles();
linkedAllocation.printAllocatedFiles();
}
}