Monday, June 3, 2019

Task Scheduling Based On Multilevel Queue Scheduling Computer Science Essay

Task Scheduling Based On Multilevel dress Scheduling Computer Science EssayAbstract This written report gives the survey on projection scheduling. The different scheduling utilise to schedule task ignorantd on priority, duration and deadline. To achieve that techniques such as runner In prototypical Out, Shortest Job runner, violate Robin Scheduling, Multilevel Queue Scheduling are discussed. Among these techniques, the technique named Multilevel Feedback Queue scheduling is proposed as a good scheduling technique along with the future work.Keywords FCFS, context Switching, Starvation, inflexible, SJF, Multilevel come up.INTRODUCTIONScheduling is a basic c erstwhilept in computer multi transitionor and multitasking operational systems. Scheduling refers to the way forgees are ordered to run on the CPUs, since there are typically many more act upones running than there are addressable CPUs.It also states that when an activity should start or end depending on its durat ion, predecessor activity, predecessor relationships, re cum availability and e sparely the target completion which is consider as deadline.Thescheduleris concerned brinyly with Throughput, Latency, Turn around, Response Time and Fairness. Throughput describesthat number of processes that complete their execution per time unit. Latency, specifically illustrates about turn around and response time. In retroversion, total time between submission of a process and its completion is described and the response timedeals with the amount of time it takes from when a request was submitted until the first response is produced. Finally, fairness tells about the equal CPU time to each process (or more generally appropriate times according to each process priority).In practice, these goals often conflict (e.g. throughput versus latency), thus a scheduler leave alone implement a suitable compromise.Inreal-timeenvironments, such as industrious devicesforautomatic deemin industry (for examplerob otics), the scheduler also must ensure that processes crumb meetdeadlines this is crucial for keeping the system stable. Scheduled tasks are sent to mobile devices andmanagedthrough an administrative back end.Types of Operating System SchedulersLong Term SchedulerThe long term scheduler is otherwise called admission scheduler. This scheduler decides which process or play has to be admitted first to the ready align. Because while executing a program, which process to be run is authorized or delayed by long term scheduler. The tier of concurrency is maintained and it checks whether high or low amount of processes are to be executed concurrently. It also dictates how the split between CPU intensive and IO intensive is to be handled. It is useful for the real time process to get enough CPU time to finish off their tasks in the modern OSs. The GUI interfaces becomes slow if the real time scheduling is non proper.Long-term scheduling is also important in large-scale systems such as batch processing systems, computer clusters, supercomputers and render farms.In these cases, special purposejob scheduler software is typically used to assist these functions, in addition to any underlying admission scheduling support in the in operation(p) system.Long term scheduling obviously controls the degree of multiprogramming in multitasking systems, following certain policies to decide whether the system can honor a spic-and-span job submission or, if more than wiz job is submitted, which of them should be selected. The need for around form of compromise between degree of multiprogramming and throughput seems evident, especially when one considers interactive systems. The higher the number of processes, in fact, the smaller the time each of them may control CPU for, if a fair share of responsiveness is to be precondition to all processes. Moreover we have already seen that a too high number of processes causes waste of CPU time for system housekeeping chores (trashing in virtual memory systems is a particularly nasty example of this). However, the number of active processes should be high enough to keep the CPU busy overhaul the payload (i.e. the user processes) as much as possible, by ensuring that on average there always be a sufficient number of processes not waiting for I/O.Short-term SchedulerThe short circuit-term scheduler (also known as the CPU scheduler) decides which of the ready, in-memory processes are to be executed (allocated a CPU) next following a quantifyinterrupt, an IO interrupt, an operatingsystem callor another form ofsignal. Thus the short-term scheduler makes scheduling decisions much more frequently than the long-term or mid-term schedulers a scheduling decision will at a minimum have to be made after each time slice, and these are very short. This scheduler can bepreemptive, implying that it is capable of forcibly removing processes from a CPU when it decides to allocate that CPU to another process, or non-preempti ve in which case the scheduler is unable to force processes off the CPU. In most cases short-term scheduler is written in assembler because it is critical part of operating system.II.ANALYSISIn this part, we will discuss about different typesetters cases of scheduler and their usage.Each technique is compared with different performance metrics such as Throughput, CPU utilization, Turnaround time, waiting time and response time.First Come First Severed (FCFS)This technique is a basic one, and commonly used scheduler. Based on the order the job arrives, the task be scheduled. To maintain this find will be handled. The blameless ready task is put inside the dress, according to the arrival of jobs.To describe this sample source code along with the Gantt Chart.Sample regulation line up_Fifo q //The processes inside the queuetask_Include(procs) // method to include a process into the queueq.include_Tail(procs) //Inserting the bare-ass coming process at the vestige endq.size++ //Re portingRescheduling() // To re fly the coop the process from the queueP=q.head_Exclude()Reportingreturn P suitConsider four tasks P,Q,R and S. Each task requires some amount of time to complete the task. It is shown below.Table 1Task ScheduleTaskTime UnitP9Q5R10S6Gantt ChartPQRS0 9 14 24 30Fig 1. FCFS drillIn the above example, the incoming task is included in the queue one by one. It executes based on the time units. The drawback of this the task which has to finish first has to wait until its time reach. Another bother is overhead occurs between the processes which leads to Context Switching.Performance EvaluationTable 2Performance Metric 1performance metricsFirst In First Out end-to-end4/(30+3cs)CPU utilization30/(30+3cs)Turnaround time(9+14+24+29+6cs)/4=19 Omitting csWaiting time(0+9+14+24+6cs)/4=11.75 Omitting csResponse Time(0+9+cs+14+2cs+24+3cs)/4=11.75 Omitting csShortest Job First (SJF)To overcome the problem of first one we are going for shortest job first technique. In this scheduler, a sort list is maintained. In the list all the task which has least(prenominal) time unit will be scheduled first. This technique is useful because the task which has earliest time unit got the opportunity to execute. To describe this sample source code along with the Gantt Chart.Sample Codesort_List SL //Data Structure for sorted listtask_Include (procs, expected_runtime)// method to include a process into the sorted list.SL.insert(procs, procs.runtime)//Inserting the newcoming process into the sorted listRescheduling()// To remove the shortest job from the list.return SL.remove_head()ExampleConsider four tasks P,Q,R and S. Each task requires some amount of time to complete the task which is given in table 1.Gantt ChartQSPR0 5 11 20 30Fig 2. SJF ExampleIn this scheduler, the new incoming shortest job will be included in the list which leads to the problem named Starvation.In Starvation, the job which has longest time to finish the execution will be waiting because all the newly arrived jobs will enter into the list. Therefore, the longest job will starve to get the resource.Performance EvaluationTable 3Performance Metric 3performance metricsFirst In First OutThroughout4/(30+3cs)CPU utilization30/(30+3cs)Turnaround time(5+11+cs+20+2cs+30+3cs)/4=16.5 Omitting csWaiting time(0+5+cs+11+2cs+24+3cs)/4=10 Omitting csResponse Time(0+5+cs+11+2cs+24+3cs)/4=10 Omitting csRound Robin SchedulingIn time-sharing systems, the Round robin technique is very much successful. The jobs will be preempted.For each task, particular time slot will be given. The job should be perfect within that time, otherwise the other jobs will be preempted and the old task should wait until it gets the new slot.This will be achieved using queueSample Codequeue_Fifo fq //First in first out queuetask_Include(procs) // method to include a task into the queueq.include_Tail(procs) //Inserting the new coming process at the tail endRescheduling(y)// To remove the next process and run i tIf(y==timer)task_Include(current)set_Timer(time_quanta) return fq.remove_head()ExampleHere also the same four task will be taken and based on time quanta 3 and 6 the task be scheduled.If Time quanta=3,PQRSPQRSPR0 3 6 9 12 15 16 19 21 23 26Fig 3. RR Example TQ=3If time quanta=6,PQRSPR0 6 10 16 21 23 26Fig 4. RR Example TQ=6Performance EvaluationTable 3Performance Metric 3performance metricsFirst In First OutThroughout4/(26+9cs)CPU utilization26/(26+9cs)Turnaround time(23+16+26+21)/4=21.5 Omitting csWaiting time(15+12+17+16)/4=15 Omitting csResponse Time(0+3+6+9)/4=4.5 Omitting csPriority(PRI)In this method a priority is fixed to each and every process. To implement this Shortest job first(SJF) algorithm is used. If 2 jobs are having the same priority the scheduled will be done based on FCFS queue. In some cases, the jobs be preempted eventhough it has the higher priority.To describe this sample source code along with the Gantt Chart.Sample CodePRI (L,M,H(RR))queue_Fifo fq3 //The p rocesses inside the queuetask_Include(procs, pri) // method to include a process into the queuefqpri.include_Tail(procs)//Inserting the new coming process at the tail endRescheduling(y) // To remove the next process and run itIf(y==timer)task_Include(current, current.pri)set_Timer(time_quanta)for pri=H to Lif(fqpri.empty()) return fqpri.remove_head()ExampleConsider four tasks P,Q,R and S. Each task requires some amount of time to complete the task. It is shown below.Gantt ChartFor Time quanta=6PPRQRS0 6 8 14 18 21 26Fig 4. PRI Example TQ=6In the above example, the incoming task is included in the queue one by one. It executes based on the priority assigned to each task. The drawback of this the task is once the higher priority job finish its execution the lower priority jobs gets the chance of doing its execution.Performance EvaluationTable 4Performance Metric 4performance metricsFirst In First OutCPU utilization26/(26+4cs)Response Time(0+8+14+21+4cs)/4=10.75 Omitting csMultilevel Q ueue SchedulingIn Multilevel queue scheduling each process is divided into different groups. It is divided into the following processesSYSTEM PROCESSESINTERACTIVE PROCESSESINTERACTIVE change PROCESSESBATCH PROCESSESSTUDENT PROCESSESFig 5. Multilevel Queue scheduling Process groups.In the above diagram, the foreground queue is called interactive and background queue is called batch. These two plays a major role in scheduling. The jobs are assigned to separate queues. The assigning be done based on memory size, process type and process priority. The vital one is each queue uses its own scheduling policy based on the need of the task. It can either do preemptively or non-preemptively.PossibilitiesThere are two possibilities to choose the scheduling algorithmEach queue has absolute priority once the higher priority job queue becomes empty it wont go for lower priority jobs.Eg. In the Fig.5. The batch processes wont get the chance of execution until the system, interactive and interacti ve editing processes finish its execution.Each queue gets some CPU time when there is a time slice between queues after that it can be scheduled the processes in the queue.Eg. If 70% of CPU time is given to foreground queue, it uses round robin scheduling.Rest 30% be allotted to background queue which uses FIFO scheduling.The main drawback of this scheduling is, it is not flexible. To overcome this we are going for multilevel feedback scheduling.III.PROPOSED ALGORITHMComparing with different task scheduling, the proposed algorithm which can be used in task scheduling is multilevel feedback queue scheduling.To overcome the inflexibility of multilevel queue scheduling, the multilevel feedback queue scheduling came into pass. In this, the process can move between various queues. Here separate queues will be used for handling the process, it automatically adjust the priority of the jobs. The process is either I/O bound or CPU bound. Based on the process type, the scheduling algorithm su ch as round- robin, FCFS be used which maintains the flexibility.It gives preference on short jobs, I/O bound processes and schedule the process according to the nature of the process. It is described based on number of queues, the scheduling policy, a method used to upgrade, degrade or introduce a process and the inter scheduling between the queues.Steps in Multilevel Feedback queueThe new incoming process is added to the queue tail.At one stage, the process comes to the top of the queue and that will be assigned to the CPU.The process leaves the system once it completes its execution.When the process relinquishes control, it leaves the queuing network and once it becomes ready it enters into the queue level.When the process is having quantum time it will be preempted, and enter into the lower level of queue.This will be repeated until the process completes or it reaches the base level queue.ExampleConsider three queues,Q0- Round robin TQ 8 millisecondsQ1- Round robin TQ 16 millise condsQ2- FCFSTQ=8TQ=16FCFSIf the new job comes it enters into the queue Q0 and served as FCFS. When it gains CPU, it gets the tine quanta as 8 milliseconds. If the job is not completed within 8 milliseconds, the job moves to the queue Q1.At Q1 job is again served as FCFS and true the time quanta of 16 milliseconds. If it is not complete it will preempt to queue Q2.IV.CONCLUSION AND FUTURE WORKFrom the different view of task scheduling, multilevel feedback scheduling is considered as the good one in assignment of task. This will be implemented in real time systems for the assignment of task.

No comments:

Post a Comment