Simulation on Customer Scheduling by Using Shortest Remaining Time (SRT) in Beauty Salon
Total Page:16
File Type:pdf, Size:1020Kb
International Journal of Scientific Research Engineering & Technology (IJSRET), ISSN 2278 – 0882 300 Volume 8, Issue 6, June 2019 Simulation on Customer Scheduling by Using Shortest Remaining Time (SRT) in Beauty Salon Thwe1, Thi Thi Tun2 1(Faculty of Computer Science, University of Computer Studies (Taungyi), Taungyi Email: [email protected]) 2 (Faculty of Computer Science, University of Computer Studies (Myitkyina), Myitkyina Email: [email protected]) customer comes in particular given time, worker give ABSTRACT service to it according to their demand. Similarly, the The aim of processor scheduling is to assign processes to process is continues and queue is formed based on the be executed by the processor or processors over time, in functions. a way that meets system objectives. Scheduling affects The proposed system is intended to reduce waiting time the performance of the system because it determines for customers. Most of the people like to go to the which processes will wait and will progress. This paper beauty salon but they don’t like to wait in there. By proposes simulation on customer scheduling in beauty using SRT scheduling policy, waiting time can be more salon. In this simulation, Shortest Remaining Time reduced rather than other scheduling policies. Starting (SRT) is used to schedule this multiple processes from the system, the user enters the number of customers for the system because multiple processes may exist schedule in the beauty salon .The system displays the simultaneously. When a new process is entered the input dialog box for entering the number of customers. algorithm only needs to compare the currently executing The user enters customers’ name, arrival time and then process with the new process, ignoring all other must choose types of services depending on the number processes currently waiting to execute. Queue is first _ of customers. Then, the system calculates scheduling by in _ first _ out (FIFO) list and is a liner list of elements using Shortest Remaining Time (SRT). Therefore, the in which deletions can take place only at one end of the system displays customer who is firstly finished. list, “front”, and insertions can take place only at the other end of the list , “rear”. This system will be II. BACKGROUND THEORY implemented by Java Programming Language. An OS must allocate resources amongst competing Keywords – first in first out (FIFO), processors processes. The resource is allocated by means of scheduling, shortest remaining time (SRT) scheduling - determines which processes will wait and which will progress. The resource provided by a I. INTRODUCTION processor is execution time. Scheduling is to allocate processor time in such a way as to optimize one or more Customer scheduling makes human life very smarter and aspects of system behavior. Scheduling activities have to feel comfortable. Being a salon client today is three functions: long-term medium-term and short-term inconvenient. The customer have to remember that the scheduling. This system uses short-term scheduling. customer need to make an appointment, then hope he or Short-term scheduling is the decision as to whish she remember during business hours, and finally available process will be executed by the processor. The scramble to find the phone number and take time out of short-term scheduler also known as the dispatchers, his or her busy day to make the call. And never mind makes the fine-grained decision of which process to finding user reviews of local salons, tracking those down execute next [2]. somewhere on the web is a headache that most don’t The aim of processor scheduling is to assign processes to even attempt [1]. be executed by the processor over time. In a way that This is the experience of countless salon-visitors every meets system objectives, such as response time, day. As traditional methods of beauty salon are throughput, and processor efficiency. The scheduling inefficient, therefore proposed system is known as function should “customer scheduling” is considered here. Worker first Share time fairly among processes calculates how many customers are waiting as well as Prevent starvation of a process predefined time for particular activity. When the Use the processor efficiently www.ijsret.org International Journal of Scientific Research Engineering & Technology (IJSRET), ISSN 2278 – 0882 301 Volume 8, Issue 6, June 2019 Have low overhead short processes are continually added. This threat can be Prioritise processes when necessary (e.g. real minimal when process times follow a heavy-tailed time deadlines) distribution. Like shortest job next scheduling, shortest remaining 2.1. Types of Scheduling time scheduling is rarely used outside of specialized environments because it requires accurate estimations of There are three types of scheduling: long-term the runtime of all processes that are waiting to execute. scheduling, medium-term scheduling and short-term Scheduling algorithm as the name hints, selects the scheduling. Long-term scheduling is performed when a process for execution which has the smallest amount of new process is created. Medium-term scheduling is a time remaining until completion [4]. part of the swapping function. Short-term scheduling It can be categorized into two parts: is the actual decision of which ready process to execute Non-preemptive: Once selected for execution, a process next [3]. continues to run until the end of its CPU burst .It is also known as Shortest Job First (SJF). Preemptive: The process which is currently in execution and runs until it complete or a new process is added in the CPU Scheduler that requires smaller amount of time for execution. It is also known as shortest remaining time first (SRTF). Unlike round robin scheduling algorithm, shortest remaining time scheduling algorithm may lead to starvation. If the short processes are continually added to the CPU scheduler then the currently running process will never be able to execute, SRT is not starvation free. Shortest remaining time is optimal and it mostly gives minimum average waiting time for a given set of CPU bursts of the processes. In SRT, We will never know the next burst length. Fig1. Scheduling and Process States Transitions Here, User can calculate the average turnaround time and average waiting time along with the starting and 2.2. Shortest Remaining Time (SRT) finishing time of each process. Turnaround time: It’s the total time taken by the Shortest remaining time, also known as shortest process between starting and the completion. remaining time first (SRTF), is a scheduling method that Waiting time: It’s the time for which process is ready to is a preemptive version of shortest job next scheduling. run but not executed by CPU scheduler. In this scheduling algorithm, the process with the smallest amount of time remaining until completion is 2.3. Shortest Remaining Time First (SRTF) selected to execute. Since the currently executing process is the one with the shortest amount of time SRTF is pre-emptive version of shortest job first CPU remaining by definition, and since that time should only scheduling. In this algorithm the process which is having reduce as execution progresses, processes will always shortest remaining time is executed first and completed, run until they complete or a new process is added that before completion of that particular process if another requires a smaller amount of time. process having shortest burst time or shortest remaining Shortest remaining time is advantageous because short time enters in ready queue then current running process processes are handled very quickly. The system also is pre-empted and new process is executed. requires very little overhead since it only makes a This preemptive version of the SJF algorithm is faster decision when a process completes or a new process is than the non-preemptive version .However, within our added, and when a new process is added the algorithm calculation for SRTF, we have not included any time for only needs to compare the currently executing process context switching .Context switching is required for all with the new process, ignoring all other processes preemptive algorithms. Time taken to perform context currently waiting to execute. switches will depend upon the particular system, but it Like shortest job first, it has the potential for process must be accounted [5]. starvation; long processes may be held off indefinitely if www.ijsret.org International Journal of Scientific Research Engineering & Technology (IJSRET), ISSN 2278 – 0882 302 Volume 8, Issue 6, June 2019 2.4. Shortest Remaining Time Next (SRTN) C4 Hair 200 150 This is a preemptive version of the previous one, in Straight(Distilla which the scheduler always dispatches that ready process tion) which has the shortest expected remaining time to completion. The dispatching decision is always made C5 Hair Distillation 260 60 when a new process is submitted: the currently running process has obviously a smaller remaining time than all other ready ones, otherwise it wouldn't have been Time=20 mins, C1 enter, dispatched. But a newly submitted job may have an even shorter one, in which case the currently running one Table (3.2) First Customer Enter Table would be blocked and put in ready state [6]. Service Arrival Service Execution Remaining This decreases the average turnaround time with respect Customer Type Time Time Time Time[s-e] to SPN, since short, newly arrived processes are given immediate attention, if their expected completion time C1 Frizz 20 90 0 90 happens to be less than the remaining time to completion C1 is executed of the currently running and ready processes. As with SPN, there's a risk of starvation for long processes, in 20 50 80 presence of a constant supply of short ones. Since all preemption decision are made only either upon a new process submission or when a process completes, there's less overhead involved than with RR.