for (int i = 0; i < 4; i++)
{
if (bur[i] > 0) {
if (bur[i] > qtm) {
execOrder.add(i + 1);
bur[i] = bur[i] -qtm;
flagClounter++;
} else {
execOrder.add(i + 1);
bur[i] = 0;
flagClounter++;
}
}
}
Output:
the time quantum in milliseconds:-
40000
the burst_time of the respective machines:-
00:01:00
00:02:00
00:01:00
00:02:00
burst_time in milliseconds:-
60000
120000
60000
120000
jobs scheduled:-
1 2 3 4 1 2 3 4 2 4
the above code performs round robin algorithm.. the bur[i]
is the burst time array which is retrieved from database and stored it in the form of milliseconds qtm
is the time quantum stored in the form of milliseconds. the scheduling is working fine... I just want this to work taking the real time units..i.e, to say if I execute the code at the current time then its should start scheduling and wait for that much burst time to complete the first job then the second and so on.... but at present it just runs in a single shot. for this should I use any Timer class
?? the user requests for the schedule of job at a particular time so it should start from there... how can I perform it??please help me with this...