A Scheduling Algorithm For Mac

Posted on

Online excel 2011 for mac. This tutorial is for Excel 2011 for Macs. Go to this page for the Excel 2010 PC tutorials. Want to use the same data as the tutorial? Some of the exercises use data.

A Scheduling Algorithm For Mac

A Process Scheduler schedules different processes to be assigned to the CPU based on particular scheduling algorithms. There are six popular process scheduling algorithms which we are going to discuss in this chapter −. First-Come, First-Served (FCFS) Scheduling. Shortest-Job-Next (SJN) Scheduling. Priority Scheduling. Shortest Remaining Time. Round Robin(RR) Scheduling.

A Scheduling Algorithm For Mac Mac

Multiple-Level Queues Scheduling These algorithms are either non-preemptive or preemptive. Non-preemptive algorithms are designed so that once a process enters the running state, it cannot be preempted until it completes its allotted time, whereas the preemptive scheduling is based on priority where a scheduler may preempt a low priority running process anytime when a high priority process enters into a ready state. First Come First Serve (FCFS). Jobs are executed on first come, first serve basis. It is a non-preemptive, pre-emptive scheduling algorithm.

Easy to understand and implement. Its implementation is based on FIFO queue.

Poor in performance as average wait time is high. Wait time of each process is as follows − Process Wait Time: Service Time - Arrival Time P0 0 - 0 = 0 P1 5 - 1 = 4 P2 8 - 2 = 6 P3 16 - 3 = 13 Average Wait Time: (0+4+6+13) / 4 = 5.75 Shortest Job Next (SJN).

This is also known as shortest job first, or SJF. This is a non-preemptive, pre-emptive scheduling algorithm. Best approach to minimize waiting time. Easy to implement in Batch systems where required CPU time is known in advance. Impossible to implement in interactive systems where required CPU time is not known. The processer should know in advance how much time process will take. Process Arrival Time Execute Time Service Time P0 0 5 3 P1 1 3 0 P2 2 8 14 P3 3 6 8 Gantt Chart Wait time of each process is as follows − Process Wait Time: Service Time - Arrival Time P0 3 - 0 = 3 P1 0 P2 14 - 2 = 12 P3 8 - 3 = 5 Average Wait Time: (3+12+5) / 4 = 5 Priority Based Scheduling.

Priority scheduling is a non-preemptive algorithm and one of the most common scheduling algorithms in batch systems. Each process is assigned a priority. Process with highest priority is to be executed first and so on. Processes with same priority are executed on first come first served basis. Priority can be decided based on memory requirements, time requirements or any other resource requirement. Wait time of each process is as follows − Process Wait Time: Service Time - Arrival Time P0 9 - 0 = 9 P1 6 - 1 = 5 P2 14 - 2 = 12 P3 0 - 0 = 0 Average Wait Time: (9+5+12+0) / 4 = 6.5 Shortest Remaining Time.

Shortest remaining time (SRT) is the preemptive version of the SJN algorithm. The processor is allocated to the job closest to completion but it can be preempted by a newer ready job with shorter time to completion. Impossible to implement in interactive systems where required CPU time is not known.

It is often used in batch environments where short jobs need to give preference. Round Robin Scheduling. Round Robin is the preemptive process scheduling algorithm. Each process is provided a fix time to execute, it is called a quantum. Once a process is executed for a given time period, it is preempted and other process executes for a given time period. Context switching is used to save states of preempted processes.

Wait time of each process is as follows − Process Wait Time: Service Time - Arrival Time P0 (0 - 0) + (12 - 3) = 9 P1 (3 - 1) = 2 P2 (6 - 2) + (14 - 9) + (20 - 17) = 12 P3 (9 - 3) + (17 - 12) = 11 Average Wait Time: (9+2+12+11) / 4 = 8.5 Multiple-Level Queues Scheduling Multiple-level queues are not an independent scheduling algorithm. They make use of other existing algorithms to group and schedule jobs with common characteristics. Multiple queues are maintained for processes with common characteristics. Each queue can have its own scheduling algorithms. Priorities are assigned to each queue. For example, CPU-bound jobs can be scheduled in one queue and all I/O-bound jobs in another queue. The Process Scheduler then alternately selects jobs from each queue and assigns them to the CPU based on the algorithm assigned to the queue.

abc Powtoon Transcript CPU SCHEDULING MAC OS X Mac OS X supports both the multilevel feedback queue scheduling and round-robin(RR) scheduling algorithm. The preemptive process scheduling algorithm and used exactly in Mac OS X. ROUND ROBIN (RR). Each progress in Mac OS X gets a small unit of CPU time (time quantum), usually 10-100 miliseconds. The process is pre-empted and added to the end of the ready queue Example; Time quantum= 20 Process P1 P2 P3 P4 Burst Time 53 17 68 24 Average waiting time = ( (0 – 0) + (77 - 20) + (121 – 97) + (20 – 0) + (37 – 0) + (97 - 57) + (134 – 117) + (57 – 0) + (117 – 77) ) / 4 = (0 + 57 + 24) + 20 + (37 + 40 + 17) + (57 + 40) ) / 4 = (81 + 20 + 94 + 97)/4 = 292 / 4 = 73. There is fairness since every process gets equal share of CPU. The newly created process is added to end of ready queue.

Generally employs time-sharing, giving each job a time slot or quantum. Advantages:. Poor average waiting time when jobs have similar lengths. Performance depends on length of time slice. Disadvantages; Multilevel Feedback Queue. Number of queues.

Examples

Scheduling algorithms for each queue. Method used to determine when to upgrade a process Example: Three queues: Q0 – RR with time quantum 8 milliseconds. Q1 – RR time quantum 16 milliseconds.

The advantage of multilevel queue scheduling is that it covers all disadvantage of all others scheduling. The main disadvantage of multilevel queue scheduling is that it is very difficult to understand.