A new intuitionistic fuzzy rule-based decision-making system for an operating system process scheduler

We present a new intuitionistic fuzzy rule-based decision-making system based on intuitionistic fuzzy sets for a process scheduler of a batch operating system. Our proposed intuitionistic fuzzy scheduling algorithm, inputs the nice value and burst time of all available processes in the ready queue, intuitionistically fuzzify the input values, triggers appropriate rules of our intuitionistic fuzzy inference engine and finally calculates the dynamic priority (dp) of all the processes in the ready queue. Once the dp of every process is calculated the ready queue is sorted in decreasing order of dp of every process. The process with maximum dp value is sent to the central processing unit for execution. Finally, we show complete working of our algorithm on two different data sets and give comparisons with some standard non-preemptive process schedulers.

memory is the central processing unit (CPU). The responsibility of efficiently utilizing this important hardware resource and time multiplexing it among various processes lies on a kernel component called CPU scheduler. The CPU scheduler also called the process scheduler gets activated on every process switch. Once activated, the CPU scheduler selects a process from ready queue based on multiple attributes and also decides the duration for which this process will execute on the central processing unit.
The scheduling algorithm of UNIX operating system uses a simple formula to assign a priority value to every ready to run process. This per process attribute is calculated after every second and thus causes process priorities to change dynamically. When it is time for scheduling, the CPU is given to the process with the smallest priority number (Kerrisk 2010).
In the above formula, base priority is an integer usually having value of 60, while the default value of nice for a normal process is 0 and its range can be from −20 to 19. A user can change the priority of a process by changing its nice value using the UNIX nice(1) and renice(1) commands as shown below:

$ nice -val command [args] $ renice val pid
By increasing the nice value (Butt and Akram 2015) of a process the overall priority of a process decreases and vice versa. When a system tries to run too many high priority jobs at the same time, computer response time deteriorates. The UNIX renice(1) command is used to adjust scheduling priorities to avoid this problem. Scheduler in Linux kernel 2.6 onwards, is the piece of kernel code that inputs a list of runnable threads and decides which thread will be executed by the CPU next based on per process parameters like, scheduling policy, nice value, dynamic priority and CPU affinity (Kerrisk 2010).
Shortest job first (SJF), first-come-first-served (FCFS) are non-preemptive, while Round-robin (RR), shortest remaining time first (SRTF), and multi-level feed back queue are some of the preemptive versions of CPU scheudling algorithms (Galvin et al. 2013). CPU scheduling is a multiple-object decision making process with multiple factors like response, waiting and turn-around times, CPU utilization, and throughput (Butt and Akram 2015;Lin et al. 2007;Xu and Cai 2012).
Real world problems are often complex where information obtained are not always complete. In many decision making scenarios we have more than two options available and many a times complete information about those options are not available. These cases cannot be modeled using simple set theory and Boolean Logic. To handle such situations we cnormally use fuzzy set theory (Zadeh 1965) and fuzzy logic (Zadeh 1975). In spite of its vast applications, fuzzy sets suffer with the limitation of uncertainity element due to non-availability of complete information. Among extensions of fuzzy sets, Atanassovs intuitionistic fuzzy sets (IFSs; Atanassov 1986) provide an intuitive framework to deal vagueness from imprecise information by taking into account non-membership values in addition to membership values. More recently, fuzzy logic and its derivatives like Intuitionistic fuzzy logic have find its place in the areas of expert systems, robotics, Priority value = Base priority + Nice value + (Recent CPU usage)/2 computer networks, social sciences, management sciences, life sciences, and image processing. Early work in fuzzy decision making was motivated by the desire to mimic the control actions of an experienced human operator and to obtain smooth interpolation between discrete outputs that would normally be obtained (Atanassov 2015;Akram et al. 2014a, b;Ashraf et al. 2014a). A fuzzy controller is normally comprised of a fuzzification module, a rule base, an inference engine and a defuzzification system. Several fuzzy controller have been developed using fuzzy logic and fuzzy set theory (Liu et al. 2013;Shen et al. 2013;Boldbaatar and Lin 2015).
Applying different fuzzy models for decision-making problems inside an operating system is a hot area of research these days. CPU scheduler is one of the important kernel component that is responsible for selection of a process, the time quantum the selected process should execute on CPU and last but not the least, how frequently the OS should invoke the scheduler. Varshney and Akhtar (2012) gave the idea of achieving an ideal CPU time slice using fuzzy logic. The achieved time slice value is neither too large making it behave like FCFS nor too small and increasing the context switch overhead manifold. For multiprocessor systems, a fuzzy CPU scheduling system has been proposed by Hamzeh et al. (2007). Lim and Cho (2007) after differentiating bach, interactive and realtime processes have also proposed an intelligent fuzzy CPU scheduling system. They have used the CPU ticks a process executes and the sequence of system calls a process makes to differentiate between the three flavors of processes. A lot of research has been carried out in designing of fuzzy decision-making systems which takes input parameters like processes's response ratio, priority values, waiting and remaining burst time. The fuzzification of these input parameters and designing of inference engines that mimic behavior of human experts, their results have shown improved average waiting and turn around times (Ajmani and Sethi 2013;Alam et al. 2011;Behera et al. 2012).
The authors already proposed a novel fuzzy decision-making system for a multi-tasking CPU scheduler (Butt and Akram 2015) and have compared their improved results with Behra's IFCS (Behera et al. 2012) and Ajmain's PFCS (Ajmani and Sethi 2013). This is an extension of the same algorithm but using intuitionistic fuzzification techniques for a batch operating system. By applying intuitionistic fuzzy (IF) logic in the decisionmaking process for the selection of next runnable thread, we have incoorporated the features of shortest job first as well as priority based CPU scheduler. The nice value and the burst time are the two per process parameters, which are fuzzified intuitionistically. These intuitionistically fuzzified input parameters are given to the IF inference engine composed of nine rules. The IF inference engine fire the rules in the rule base and computes dynamic priority (dp). This dynamic priority (dp) is then defuzzified using TSK formula (Leekwijck and Kerre 1999). This procedure is repeated for every process in the run-queue and later the queue is sorted by the priority attribute of each process in decreasing order. When the scheduling decision is to be made, process at the head of the run-queue is selected for execution on the CPU.
Our paper has following sections. Main components of our proposed system and its algorithm are discussed in "Basic structure and algorithm" section. The intuitionistic fuzzifier, rule base and defuzzification techniques are discussed in "Components of IFS" section. The results generated using our proposed system are shown, discussed and compared in "Results and discussion" section. Finally we have concluded and given future research directions. We have used standard definitions and terminologies in this paper. For other notations, terminologies and applications not mentioned in the paper, the readers are referred to Akram et al. (2013), Ashraf et al. (2014b), Hsu (2015), Parvathi et al. (2013) and Xu and Liao (2015). Figure 1 describes the basic structure of our proposed intuitionistic fuzzy decision-making system (IFDMS). The two inputs of our decision-making system are the per process attributes, namely, burst time and nice value. These two attributes of all the processes in the run-queue are intuitionistically fuzzified. These two input values of each process then triggers the rules in the rule base and finally we get the defuzzified dynamic priority (dp) for each process. The run-queue is sorted according to the decreasing value of dynamic priority and when there is a scheduling decision is to be made the process at the head of the run-queue is selected and given to the CPU for execution.

Components of IFS
Our proposed IFIS uses the Mamdani-Larsen inference method (Mamdani 1974). The three major components are the intuitionistic fuzzifier, intuitionistic fuzzy inference engine (IFIE) and the defuzzifier.

Intuitionistic fuzzifier
The two per process attributes, namely the nice value and the burst time are intuitionistically fuzzified by this component. Figures 2 and 3 shows the membership funciton (MF) and non-membership function (NMF) for burst time of a process respectively. Similarly, Figs. 4 and 5 shows the MF and NMF for nice value of a process respectively. The output variable of our intuitionistic decision making system is the dynamic priority (dp) of a process. Figures 6 and 7 shows the MF and NMF for dynamic priority (dp) of a process respectively.

Fuzzy inference engine
This component is the actual brain as the logic of our algorithm resides here. The reasoning is applied using IF-THEN type fuzzy rules. These IF-THEN rules formulate the conditional statements that comprise fuzzy logic. The inference engine triggers the appropriate IF-THEN rules in the knowledge base using Mamdani-Larsen inference method (Mamdani 1974). There are nine rules that are used for fuzzy inference: R1: if b_time is low and nice is low then dp is veryhi R2: if b_time is low and nice is medium then dp is hi R3: if b_time is low and nice is hi then dp is hi R4: if b_time is medium and nice is low then dp is avg R5: if b_time is medium and nice is medium then dp is avg R6: if b_time is medium and nice is hi then dp is low R7: if b_time is hi and nice is low then dp is low R8: if b_time is hi and nice is medium then dp is verylow R9: if b_time is hi and nice is hi then dp is verylow

Defuzzifier
The defuzzifier component takes fuzzy dynamic priority (dp) of each process and defuzzify it to crisp dp. There are several techniques in the literature through which we can perform defuzzification. We apply Takagi Sugani formula (Leekwijck and Kerre 1999) for defuzzification. Takagi Sugani's formula is: , where

Results and discussion
To generate the results we have used Process Scheduling Simulation, Analyzer and Visualization (PSSAV) tool for simulation of shortest job first (SJF) and non-preemptive priority based algorithm. PSSAV is publically available under code license GNU GPL v2. To generate the results of our own algorithm, a simulation is written using Matlab R2014a(8.3.0.532). The working to generate the results for our intuitionistic fuzzy decision-making system (IFDMS) for non-preemptive CPU scheduling algorithm is shown below. We have generated and compared the results using two different case studies. The results of our two case studies are shown in Tables 7 and 8. The results of our intuitionitic fuzzy process scheduler are almost the same as the best known non-preemptive scheduling algorithm, i.e., shortest job first (SJF). The added advantange of using our algorithm is that we can further increase/decrease the priority of a process by decreasing/increasing its nice value respectively. The same cannot be done using SJF algorithm. So our proposed algorithm not only combines the plus points of conventional shortest job first (SJF) and priority based algorithm, but further gives reduced waiting times by adding the intuitionistic fuzzy modeling technique.

Data set 1
The input for data set-1 is given in Table 1. These per process values are taken from author's previous paper (Butt and Akram 2015). The recent cpu usage of each process is not computed here, as this input is not required for scheduling algorithms of batch operating systems. The first column shows the five processes under consideration, with their burst times (BT) and nice values (NV) shown against them. Table 1 shows that there are five processes with different burst times and nice values. We need to compute the dynamic priority of all the five processes. The detailed working for computing the dynamic priority of these processes is shown below.

Calculating dynamic priority of process P1
The first step is to intuitionistically fuzzify the crisp inputs, which can be obtained from the membership function (MF) and non-membership function (NMF) of burst time and  (2) for process P1 are shown below: After intuitionistically fuzzifying the two input parameters the rules of inference engine are triggered. In case of membership rule1 is triggered: low ∧ low = 0.625 ∧ 0.857 = 0.625. In case of non-membership rule1 is triggered: low ∨ low = 0.3 ∨ 0.118 = 0.3. Finally, the membership and non-membership values of the output variable dynamic priority for process P1 are shown below: Now we move towards defuzzification process. According to rule 1 dynamic priority will be very high.
Now we calculate the crisp value of dynamic priority for process P1 using TS formula. The working of calculating the defuzzified value of very high dp using TS formula is shown in Table 2. The final dynamic priority value for process P1 is 64.775 2.45 = 26.44

Calculating dynamic priority of process P2
The same procedure is followed for process P2 as well. The fuzzified membership and non-membership values of burst time (6) and nice value (7)  µ dp = {0, 0, 0, 0, 0.625}; ν dp = {1, 1, 1, 1, 0.3}  Table 2 P1: Defuzzification of very high dp using TS formula (data set 1) After intuitionistically fuzzifying the two input parameters the rules of inference engine are triggered. In case of membership rules 1, 2, 4, and 5 are triggered with dynamic priority very high, high, average and average respectively with truth values shown below: In case of non-membership also rule 1, 2, 4, and 5 are triggered with dynamic priority very high, high, average and averge respectively with truth values shown below: Finally, the membership and non-membership values of the output variable dynamic priority for process P2 are shown below: Now we move towards defuzzification process. According to rule 1 dynamic priority will be very high.
The working of calculating the defuzzified value of very high dp using TS forumla is shown in Table 3.  Table 3 P2: Defuzzification of very high dp using TS formula (data set 1) According to rule 2 dynamic priority will be high.
The working of calculating the defuzzified value of high dp using TS forumla is shown in Table 4. According to rule 4 dynamic priority will be average.
The working of calculating the defuzzified value of average dp using TS forumla is shown in Table 5. According to rule 5 dynamic priority will again be average. Table 4 P2: Defuzzification of high dp using TS formula (data set 1) The working of calculating the defuzzified value of average dp using TS forumla is shown in Table 6. The final dynamic priority value for process P2 is obtained by averaging out all the four dynamic priorities computed above, i.e., 26.08+20.5+14+14 4 = 18.65. The same procedure is followed for computing the dynamic priorities for the rest of the processes in the data set. Finally, the dynamic priority for processes P1, P2, P3, P4 and P5 comes out to be 26. 44, 18.65, 26.33, 26.2, and 26.53 respectively.

Comparison
If we sort the processes according to the calculated dynamic priorities, the sequence of execution of the processes is P5, P1, P3, P4, P2 . The average waiting time for this data set comes out to be 6 time units. The same results are obtained if we follow the process with the smallest burst time, i.e., shortest job first algorithm or if we simply execute the processes according to their nice value. The process with smaller nice value is selected for execution. Table 7 shows the results of data set-1. If these results are compared with author's previous paper (Butt and Akram 2015), it can be observed that with a time slice of 6 units the results are the same as Shortest Job First, which is a scheduling algorithm for batch operating systems. Intuitively, the given data set is such that the same results are produced as both the parameters are not conflicting. However, it is quite intuitive to observe that if the burst time and nice value of processes in the data set are conflicting to each other our algorithm will give better results than the SJF and the priority based algorithm. This is shown in the second data set.

Sensitivity analysis
According to Rezaei and Ortt (2013), sensitivity analysis is used to determine how sensitive the output of a system is on a particular input. Sensitivity analysis is useful as it can be used to determine how dependent the output is on a specific input. The formula to compute the contribution of an input on the output as given in Rezaei and Ortt (2013) is shown below: In the above formula dp(j) is the dynamic priority of a process that is computed considering all available inputs. dp ′ (j) is the dynamic priority of a particular process by removing all information of the ith input from the rule base. i shows the average absolute change after removing i th input. In our proposed intuitionistic fuzzy system, there are only two inputs, nice value (NV) and burst time (BT). For process P1 (BT:3, NV:2) and P2 (BT:6, NV: 7) the defuzzified dynamic priorities (dp) co-latexmputed above are 26.44 and 18.65 respectively. If we drop all the information regarding nice value (NV) for both processes, the new dynamic priorities (dp ′ ) are 26.438 and 19.792 respectively. Applying is computed as 0.9068. This shows that in data set 1, shown in Table 1, burst time (BT) has more important contribution in the final output of the system, while nice value (NV) has lesser contribution.

Data set 2
The input for data set-2 is given in Table 8. These per process values are taken from author's previous paper (Butt and Akram 2015). The recent cpu usage of each process is not computed here, as this input is not required for scheduling algorithms of batch operating systems. The first column shows the five processes under consideration, with their burst times (BT) and nice values (NV) shown against them. Table 8 shows that there are four processes with different burst times and nice values. We need to compute the dynamic priority of all the four processes. The detailed working for computing the dynamic priority of these processes is not shown as the same is shown in the previous case study. The same procedure is followed for computing the dynamic priorities of processes in data set 2. Finally, the dynamic priority for processes P1, P2, P3, and P4 comes out to be 10.5, 20.9, 14, and 17.5 respectively.

Comparison
If we sort the processes according to the calculated dynamic priorities, the sequence of execution of the processes is P2, P4, P3, P1 . The average waiting time for this data set comes out to be 10.5 time units. The same results are obtained if we follow the process with the smallest burst time, i.e., shortest job first algorithm. If we simply execute the processes according to their nice value i.e., the process with smaller nice value is selected for execution, the waiting time comes out to be 25.5 time units. Table 9 shows the results for data set-2.