milistars.blogg.se

Lab scheduling round robin with a timeslice of 4 ticks
Lab scheduling round robin with a timeslice of 4 ticks














Time-slice: period of time a task can run before a context-switch can replace it.Time-slice Context switches Context switches When Can A Context-Switch Occur?

LAB SCHEDULING ROUND ROBIN WITH A TIMESLICE OF 4 TICKS PC

This generally includes changing the stack pointer, the PC and the PSR (program status register).New task’s registers and status are loaded into the processor.Task control block stores memory usage, priority level, etc.Task is placed on the “ready” list to await the next time-slice.Processor’s registers for that particular task are saved in a task-specific table.Simply saves the old context and “restores” the new one.The CPU’s replacement of the currently running task with a new one is called a “context switch”.Note: I will use the work “task” interchangeably with “process” in this lecture.Multitasking allows for concurrency – if a task is waiting for an event, another task can grab the CPU and get some work done.Multitasking needs to provide for inter-task memory protection.Multitasking has more overheads – saving the current task, selecting the next task, loading the next task.Hardware interrupts and high-priority tasks might cause a task to yield the CPU prematurely.Scheduler decides the next task to run on the CPU, and starts this next task.In both cooperative and preemptive cases.Preemptive multi-taskinga another entity (the scheduler) decides when to make a running task yield the CPU.Cooperative multi-taskinga running task decides when to yield the CPU.Multi-taskinga operating system technique for sharing a single processor between multiple independent tasks.Batch system a operating system technique where one job completes before the next one starts.task priority task priority task priority CPU registers CPU registers CPU registers Memory Processor } context CPU registers The Big Picture Various solutions to dealing with critical sections.Critical sections = providing adequate memory-protection when multiple tasks/processes run concurrently.Scheduling = deciding which task/process to run next.Context switching = alternating between the different processes or tasks.Outline of This Lecture FOCUS: Multiple processes/tasks running on the same CPU earliest deadline first, variable time slice, etc) where there's 256 tasks priorities for each scheduling policy.Process Scheduling & Concurrency Lecture 13 one for real-time tasks, one for normal tasks, one for background/idle tasks) that all use different approaches (e.g. high priority tasks only get 1 ms, medium priority tasks get 10 ms, low priority tasks get 125 ms).įor a "less oversimplified" example you could have several completely different scheduling policies (e.g. In this case, you could could have different time slice lengths for different priorities (e.g. In this case an important task can be starved forever just because unimportant tasks keep sleeping and waking up.Įssentially, round-robin is a steaming pile of "useless" and it won't matter what you do until you replace it with completely different scheduling algorithm that has at least some respect for the importance/priority of different tasks.įor an oversimplified example you could have 3 different task priorities, where the OS only ever runs the highest priority tasks that it can (including making sure higher priority tasks preempt lower priority tasks immediately) and round-robin is used for tasks at the same priority. Note: You might be tempted to "fix" this by making tasks that unblock go to the head of the list. Reducing the time slice length will reduce the time it takes before the important task can start doing something useful, but will also reduce the amount of time the important task gets to do something useful.

lab scheduling round robin with a timeslice of 4 ticks lab scheduling round robin with a timeslice of 4 ticks

wakes up after calling "sleep()", receives file IO it was waiting for, etc) then it may have to wait for thousands of unimportant tasks to work their way through their time slices before the important task gets a chance to do anything. For this case it doesn't matter how big the time slices are.įor IO bound tasks, round robin causes bad latency. The problem with round robin is that tasks aren't equal.įor CPU bound tasks if you've got an extremely important task and thousands of unimportant tasks, then all those unimportant tasks cripple the performance of the important task.














Lab scheduling round robin with a timeslice of 4 ticks