Johnson's Rule in Sequencing Problems
Last Updated :
01 Sep, 2022
The sequencing problem deals with determining an optimum sequence of performing a number of jobs by a finite number of service facilities (machine) according to some pre-assigned order so as to optimize the output. The objective is to determine the optimal order of performing the jobs in such a way that the total elapsed time will be minimum.
Consider there are jobs 1,2,3,.......,n to be processed through m machines. (Machine A, Machine B, Machine C, ......, Machine n). The objective is to find a feasible solution, such that the total elapsed time is minimum. We can solve this problem using Johnson's method. This method provides solutions to n job 2 machines, n job 3 machines, and 2 jobs m machines.
Johnson's Algorithm:
Johnson's rule in sequencing problems is as follows:
- Find the smallest processing time on Machine 1 and Machine 2.
- a) If the smallest value is in Machine 1 process that job first.
b) If the smallest value is in the Machine 2 process that job last. - a) if the minimum time for both Machine 1 and Machine 2 is equal, then perform the job of Machine 1 first and then the job of Machine 2.
b) if there is a tie for a minimum time among jobs in Machine 1, select the job corresponding to the minimum of Machine 2 and process it first.
c) if there is a tie for a minimum time among jobs in Machine 2, select the job corresponding to the minimum of Machine 1 and process it last. - And then calculate the total elapsed time( the time interval between starting the first job and completing the last job) and Idle time( the time during which the machine remains idle during the total elapsed time.
In this article, we will understand this problem through n job 2 machines. We have to find the sequence of jobs to be executed in different machines to minimize the total time.
Example:
Jobs | Machine 1 | Machine 2 |
---|
J1 | 9 | 7 |
---|
J2 | 5 | 4 |
---|
J3 | 10 | 9 |
---|
J4 | 1 | 5 |
---|
J5 | 3 | 2 |
---|
Solution: The smallest time is 1 for Machine 1, process it first.
Next, the smallest time is 2 for Machine 2, process it last
The next smallest time is 3 of job 5 but Job 5 is already being processed by Machine 2. Discard it.
Next, the smallest time is 4 for Machine 2, process it last just before J5.
The next smallest time is 5 for job 2 but job 2 is already being processed by Machine 2. Discard it.
Next, the smallest value is 7 for Machine 2, process it last just before J2.
Next, the smallest value is for Machine 1 & Machine 2, J1 of Machine 1 is already being processed on Machine 2 . So, take J3 of Machine 2 and process it last just before J3.
So, the final sequence of processing the jobs is J4, J3, J1, J2, and J5.
Job | Machine 1 | Machine 2 |
---|
In Time | Out Time | In Time | Out Time |
---|
J4 | 0 | 0+1=1 | 1 | 1+5=6 |
---|
J3 | 1 | 1+10=11 | 6 | 6+9=15 |
---|
J1 | 11 | 11+9=20 | 15 | 15+7=22 |
---|
J2 | 20 | 20+5=25 | 22 | 22+4=26 |
---|
J5 | 25 | 25+3=28 | 26 | 26+2=28 |
---|
Total Elapsed Time = 28
Idle time of Machine 1 = 0
Idle time of Machine 2 = 1 (Machine 2 has to wait for Machine 1 for 1 unit during the execution of Job 4.
Similar Reads
Shortest Job Next (SJN) in Operating System
In Shortest Job Next(SJN), when choosing the next job to run, look at all the processes in the ready state and dispatch the one with the smallest service time. In this case, we need to know the service times at any given point in time. It is a non-preemptive algorithm. A new job will not be given a
6 min read
Test configuration generation in Combinatorial testing - Example | Set-2
We have discussed the algorithm used for test configuration generation in the article Test Configuration Generation in Combinatorial Testing. Let's understand the algorithm in-depth with a solved example given below. Example Consider an application that works on any of the three browsers: Safari, In
5 min read
Bakery Algorithm in Process Synchronization
Prerequisite - Critical Section, Process Synchronization, Inter Process Communication The Bakery algorithm is one of the simplest known solutions to the mutual exclusion problem for the general case of N process. Bakery Algorithm is a critical section solution for N processes. The algorithm preserve
13 min read
LRU Approximation (Second Chance Algorithm)
If you are not familiar with Least Recently Used Algorithm, check Least Recently Used Algorithm(Page Replacement)This algorithm is a combination of using a queue, similar to FIFO (FIFO (Page Replacement)) alongside using an array to keep track of the bits used to give the queued page a "second chanc
15+ min read
Find the order of execution of given N processes in Round Robin Scheduling
Given an array arr[] representing burst time of N processes scheduled using the Round Robin Algorithm with given quantum time Q. Assuming that all the process arrive at time t = 0, the task is to find the order in which the process execute. Examples: Input: arr[] = {3, 7, 4}, q = 3Output: 0 2 1Expla
12 min read
Sequence Step Algorithm in Operating System
A Discrete Event Simulation models operation of a system as a series of events in time. Each event occurs at a particular instant in time and between these instances the system is assumed to be unchanged. The Sequence Step Algorithm is implemented in a discrete event simulation system to maximize re
2 min read
Last Minute Notes (LMNs) - Probability and Statistics
Probability refers to the likelihood of an event occurring. For example, when an event like throwing a ball or picking a card from a deck occurs, there is a certain probability associated with that event, which quantifies the chance of it happening. this "Last Minute Notes" article provides a quick
11 min read
Cache Hits in Memory Organization
The user has a memory machine. It has one layer for data storage and another layer for the cache. The user has stored an array with length N in the first layer. When the CPU needs data, it immediately checks in cache memory whether it has data or not. If data is present it results in CACHE HITS, els
8 min read
Flow Graph in Code Generation
A basic block is a simple combination of statements. Except for entry and exit, the basic blocks do not have any branches like in and out. It means that the flow of control enters at the beginning and it always leaves at the end without any halt. The execution of a set of instructions of a basic blo
4 min read
Find time taken to execute the tasks in A based on the order of execution in B
Given two queues A and B, each of size N, the task is to find the minimum time taken to execute the tasks in A based on the order of execution in B where: If the task found at the front of queue B is at the front of queue A, then pop this task and execute it.If the task found at the front of queue B
10 min read