Monday, July 5, 2010

Shortest Job First Scheduling Algorithms

Name Process       Arrival   Long Process
A
B
C
D
E
0
0
0
0
0
7
10
2
4
8
Preview Case I - a queue of five process with arrival = 0
 Name Process       Arrival   Long Process
A
B
C
D
E
0
1
8
2
5
7
10
2
4
8
Preview Case II - a queue of five different process arrival

The technique is also known as Shortest Dipertamakan (PTD). SJF is priority scheduling without preempsi. Basic priority is the short process. Short increasingly higher priority process.
This algorithm is implemented in two steps. First step: determining the order of priority based on the short process of being served. Step two: determining at a given time, a process which needs to be served by the processor.
Although the process has determined the order of priority in the first step, but there are still issues that could hinder the implementation process according to the sequence. the problem is a problem when arriving from every process. If at the time the processor is ready to accept progress, and the shortest process has come, then that's the shortest process undertaken by the processor according to the settings in the first step. But if at the time the processor is ready to receive the process. While the process of obtaining a turn at that time had not yet arrived, then we need to have the provisions about which process will be done by the processor.
Conditions were: when the processor is ready to receive the process while the process of obtaining the shortest turn at that time had not yet arrived, then see all the processes that have been arrived at that time. Process that has been completed ignored. Of the process that has arrived but not yet processed it selected the shortest process, and that's the shortest process when it is done by the processor.
If the determination of this process sequence, found in two or more processes that have the same priority, then the service is based on the sequence of queues between same-priority processes.
See examples of case I at the top of this post which shows a set of processes A, B, C, D, and E which had arrived the same time is 0. However long they are different processes. By the duration of these different processes, in the first step, we set priorities based on the short process, then the sequence of process changes to C, D, A, E, and B. Since all processes have arrived, then the second step no trouble. As shown in Figure below is the order changed so that the appropriate queue in the order of priority.
Seems here that the SJF algorithm causes the average response time of all the process it became 14.6 units of time. The mean is becoming shorter when compared with the average response time for FCFS scheduling.

Name Process Arrival Long Process     Start      Finish  Time futile Long Perceptive
C
D
A
E
B
0
0
0
0
0
2
4
7
8
10
0
2
6
13
21
2
6
13
21
31
0
2
6
13
21
2
6
13
21
31




   Average 42
8,4
73
14,6
 Picture For processors work with SJF algorithm for the case I

See further examples II to a set of processes with arrival is not the same as in Fig most of these posts (case II) we first sort the order of the process based on priorities.
In doing so, we start from the moment = 0. At time = 0 is, the shortest C process has not arrived. Even the only one who has arrived is the process A. Therefore, when = 0, A process that was done. For more details, note the time line below. A process is completed when time = 7. When that process is a process that has reached B, D, and E, and the shortest of them is D, so that the next process is to D. When D is done when = 11, and the process that has come in ready queue is B, C and E. And the shortest of the three is C, then C is done first. When C has been processed by the CPU, time = 13 means the rest of the waiting process is B and E, and the shortest of the two is E, then E comes first, then B after being processed. This difference occurs if the SJF algorithm is applied in some processes which have not the same arrival time.
Thus it was found that A is processed from the time = 0 to 7, starting at D = 7 to 11, C from now = 11 to 13, E start time = 13 to 21, and B from now = 21 to 31.

Name Process    Arrival Long Process     Start     Finish   TimeFutile Long Perceptive
A
D
C
E
B
0
2
8
5
1
7
4
2
8
10
0
7
11
13
21
7
11
13
21
31
0
5
3
8
20
7
9
5
16
30




Average 36
7,2
67
13,4
  Picture For processors work with SJF algorithm for case II
 

No comments: