Skip to main content

Posts

Showing posts with the label HEAP

Setting JVM Heap size at runtime

To set the JVM heap size, compile the program normally. For example, consider Runtime.java program. Compilation: javac Runtime.java Now, to set minimum heap size(let, 16 MB) required by JVM, run the program as follows : java -Xms16m Runtime  We can also restrict maximum size(let 512 MB) utilized by JVM: java -Xmx512m Runtime  Both these options can also be combined to specify upper and lower bounds of JVM heap size: java -Xms16m -Xmx512m Runtime Now you can run a program that requires huge computational space.

Shortest Job First Scheduling using HEAP

// Input is from the file "input.txt" in the form (a1,t1),(a2,t2),(a3,t3)  (arrival time, time to complete ie, burst time) import java.io.*; import java.util.*; public class SJFHeap {     static class point {         double time;         double run;         int no;         double total;         point(int i, double a, double b) {             no = i;             time = a;             run = b;             total = 0;         }     }     static class MHeap {         private point[] Heap;         p...