This report will be about simulations ofCPU scheduling (Algorithm Evaluation).
The central processing unit or as itreferred to the CPU is a processor that is responsible for giving instructionsto the computer so it would know what to do. The CPU lets the computer knowwhen it should follow out certain instructions which as people know is aprogram. This program will receive information and will input all of theinformation from a device and process all of it so the computer couldunderstand it and output the information. Most technology nowadays has a CPUbuilt into it the most commonly known products are mobile phones and computershowever many other devices also have a CPU such as washing machines, DVDplayers, printers and many more.
Most CPUs are contained on a singularintegrated circuit chip they are very small but very powerful. However you canget multicore processors as well but they are still a single chip but theycontain a few CPUs on it which is classed as cores. This report will talk aboutthe importance of scheduling and how it’s a fundamental to operating systems.It will also contain information on how to get a more accurate evaluation ofscheduling algorithms by using simulations. The report will talk about how tocreate a simulation, how it will work and how it will process information. Willshow how and why when variables value is increased the simulator modifies thesystem state to reflect the activities of the devices, the process and thescheduler that keeps everything intact and running smoothly. Scheduling is very importantto an operating system it is a necessity and fundamental function for anoperating system to be able to run. A queue is created when the CPU is not inuse and the operating system is left to figure out which process it needs toget ready to execute.
So how does the CPU know which process should be carriedout first? Well the CPU works out the order and importance of a process by thehelpful hand of the short term scheduler. The short term scheduler selectswhich process should be carried out. The short term scheduler creates a queuewhere it lines up all the processes waiting to run on the CPU. When prioritiesare acquired the information will be passed onto the dispatcher. A dispatcheris another fundamental. Dispatchers hand over control to the processes so theycan run on the CPU that is selected by the short term scheduler.
The purpose of thisassignment is to simulate algorithms to achieve a more accurate and preciseevaluation on how a choice of certain scheduling algorithms can effect CPUutilization and how effective schedulers are when they assign processors to anyprocess. There are a few different scheduling algorithms that run differentlyand have different properties from each other some may run better than otherson selected scenarios. As different processes need to run at different timesand different orders so the selection of different algorithms can help selectwhich one is best for the case. A system always has a strategy which is calleda Process scheduling Policy what this does is it decides which is going to runat a given time.
So when a system has a choice of which process to execute theprocess scheduling policy steps in and decides what should be dealt with first.However there is also a scheduler and a dispatcher that also have jobs to do.These two the scheduler and dispatcher assign a processor to the selectedprocess. Every process has its ownidentity and own address which consists of three things which is the stackregion, data region and the data region. These three things help identify eachprocess and give it individuality. The stack region stores all the instructionand local variables that are used for active procedure calls.
The contents ofthe stack tend to grow as the process issues are issued and then get smallerwhen the procedures return. The data region works by storing all the variablesand dynamically allocated memory that process uses during execution. The textregion works by storing all the codes that processor has to execute. What is a scheduling algorithm? Well ascheduling algorithm is a method which gives certain things access to systemresources so threads, processes or data flows can get access to processor timeand communications bandwidth. Scheduling algorithms are used to meet targetquality and to be the most effective. As all CPUs need to be able to multi taskthere needs to be some sort arrangement for the CPU to be able to carry out allthe tasks that it needs too. More than one process needs to be executed at atime so the algorithms help set priorities and keep things running smoothly.
There are a few CPU scheduling algorithms out there but thisreport will be focused on FCFS (First Come First serve), Non preemptive, SJF (ShortestJob First) and RR (Round Robin). Each of the algorithms work in different ways. FCFS (First Come First Serve) – Is very self-explanatory andworks in a simple basic fashion. As suggested in the name the first process toarrive will be processed. This scheduling algorithm is definitely one of the simplestfor sure.
So the process first to request the CPU will be allocated it first.When the first process in the front of the queue is dealt with it is removedfrom queue and it moves onto the next one in line. However FCFS has issuesbecause it produces long waiting times. This is because it may take a while forthe process in the front of the queue to come through. Non preemptive – Works on a one in one out basis. So one taskwill be carried out until it is completely finished before another one will getstarted. No interruptions will occur to the current process that is running.The process will be kept in the scheduler until it is completely finished andready to move onto the next one.
This will generally cause a big queue to pileup which would equal to longer waiting times. SJF (Shortest Job First) – This algorithm is also very straightforward it says it all in the name. SJF will work by picking the smallest andfastest little job to do first and get it out the way and then move onto thenext smallest and fastest job in the queue. This works by picking the nextshortest CPU burst and not the overall process time.
Priorities are set in SJFso the smaller jobs have priority over others so the larger the CPU burst thelower priority it has.SJF can be proven to be one of the faster algorithmshowever it has a fault of not knowing how long the next CPU burst will be whicha problem. RR (Round Robin) – Round Robin scheduling works very similar toFCFS however it adds quantum timing to it. This means that CPU bursts are assignedtime quantum’s. This means that when a process is assigned the CPU a timer isset for as long as the value has been set for time quantum.