whecyber.blogg.se

Round robin scheduling algorithm in java
Round robin scheduling algorithm in java






round robin scheduling algorithm in java

("Please enter the Burst Time for Process " + i + ": ") Int proc = new int //proc is the AT array, - RT, - WT, - TT ("Please enter the number of Processes: ") Public static void main(String args) throws IOExceptionīufferedReader br = new BufferedReader(new InputStreamReader(System.in)) Consider using constants ( static final fields) with appropriate names.On-campus and online computer science courses to Learn the basic concepts of Computer Science.This tutorial will cover c ,c++, java, data structure and algorithm,computer graphics,microprocessor,analysis of algorithms,Digital Logic Design and Analysis,computer architecture,computer networks,operating system. You have a few seemingly random 3s and 9s. You could refactor it to: timepassed += (entry.getValue() > 3) ? 3 : entry.getValue() Specifically this line: waitingTimeList.add(entry.getValue()>3?timepassed=timepassed+3: (timepassed=timepassed+entry.getValue())) Is easier to read than entry.getValue()>commonInt Fields should be declared as final if you do not expect them to change.Ĭonsider using it more liberally, especially between operators. Your fields can be private as they are not required outside of the class. Give it a more specific name.įields should be declared with the lowest access possible. It's not clear what the method mainL is supposed to do. You also have a few inconsistencies such as timepassed, which should be timePassed, and waitingMAp which should be waitingMap.

round robin scheduling algorithm in java

Variables should always be camel case to distinguish them from classes. If you are thinking of doing implementations of Round Robin, perhaps DefaultRoundRobin would be okay. It's also discouraged from using numbers in class names. The class Roundrobin1 should be Pascal case. Your variables, class and methods aren't very well named. How to scale up this algorithm for multiprocessor or multi-core systems I would like to add couple of questions hereĭo I need to take priorities of the process as well in the input.If yes how it going to solve starvation problem. WaitingMAp.put(entry.getKey(),entry.getValue()-commonInt) įirst row is order and second row is time elapsed. WaitingTimeList.add(entry.getValue()>3?timepassed=timepassed+3: (timepassed=timepassed+entry.getValue())) Process.addAll(this.getRoundRobin(waitingMAp)) it will call recursively till no process is waiting.

round robin scheduling algorithm in java

first time getting the list of process. I tried to implement round robin in java please check and help me to








Round robin scheduling algorithm in java