Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
25_26_27_28 (1).docx
Скачиваний:
0
Добавлен:
01.05.2025
Размер:
32.57 Кб
Скачать
  1. Scheduling: Round Robin Scheduling (rr)

Round Robin Scheduling (RR) . Round-robin (RR) is one of the simplest preemptive scheduling algorithms for processes in an operating system. RR assigns short time slices to each process in equal portions and in order, cycling through the processes. Round-robin scheduling is both simple and easy to implement, and starvation-free (all processes will receive some portion of the CPU). Round-robin scheduling can also be applied to other scheduling problems, such as data packet scheduling in computer networks. However, round robin does not support prioritizing jobs, meaning that less important tasks will receive the same CPU time as more important ones.

Example: The time slot could be 100 milliseconds. If job1 takes a total time of 250ms to complete, the round-robin scheduler will suspend the job after 100ms and give other jobs their time on the CPU. Once the other jobs have had their equal share (100ms each), job1 will get another allocation of CPU time and the cycle will repeat. This process continues until the job finishes and needs no more time on the CPU.

A challenge with the RR scheduler is determining how to determine the time slice to allocate tasks. If the time slice is too large, then RR performs similarly to FCFS. However, if the time slice is too small, then the overhead of performing context switches so frequently can reduce overall performance. The OS must pick a time slice which balances these tradeoffs.

  1. Paging : a working set, a thrashing and what are strategies to eliminate it?

Working Sets conceptual model to prevent thrashing.

  • If the sum of all working sets of all runnable threads exceeds the size of memory, then stop running some of the threads for a while.

  • Divide runnable threads into two groups: active and inactive:

  • When a process is active its entire working set must always be in memory: never execute a thread whose working set is not resident.

  • When a process becomes inactive, its working set can migrate to disk.

  • Threads from inactive processes are never scheduled for execution.

  • The collection of active processes is called the balance set.

  • The system must have a mechanism for gradually moving processes into and out of the balance set.

  • As working sets change, the balance set must be adjusted.

If memory gets overcommitted:

  • The pages being actively used by the current threads don't all fit in physical memory.

  • Each page fault causes one of the active pages to be moved to disk, so another page fault will occur soon.

  • The system will spend all his time reading and writing pages, and won't get much work done.

  • This situation is called thrashing; it was a serious problem in early demand paging systems.

How to deal with thrashing?

  • If a single process is too large for memory, there is nothing the OS can do. That process will simply thrash.

  • If the problem arises because of the sum of several processes:

  • Figure out how much memory each process needs.

  • Change scheduling priorities to run processes in groups that fit comfortably in memory: must shed load.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]