BFS: Brain F*ck Scheduler Jacob Chan. Objectives  Brain F*ck Scheduling  What it is  How it works  Features  Scalability  Limitations  Definition.

Slides:



Advertisements
Similar presentations
Scheduling Algorithems
Advertisements

Operating Systems Process Scheduling (Ch 3.2, )
Sogang University Advanced Operating Systems (Process Scheduling - Linux) Advanced Operating Systems (Process Scheduling - Linux) Sang Gue Oh, Ph.D. .
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 9 th Edition Chapter 6: CPU Scheduling.
Chapter 5 CPU Scheduling. CPU Scheduling Topics: Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Ceng Operating Systems Chapter 2.2 : Process Scheduling Process concept  Process scheduling Interprocess communication Deadlocks Threads.
Chapter 3: CPU Scheduling
Project 2 – solution code
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
5: CPU-Scheduling1 Jerry Breecher OPERATING SYSTEMS SCHEDULING.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
Operating Systems Process Scheduling (Ch 4.2, )
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Budapesti Műszaki és Gazdaságtudományi Egyetem Méréstechnika és Információs Rendszerek Tanszék Scheduling in Windows Zoltan Micskei
 Scheduling  Linux Scheduling  Linux Scheduling Policy  Classification Of Processes In Linux  Linux Scheduling Classes  Process States In Linux.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
CPU Scheduling Chapter 6 Chapter 6.
Chapter 6: CPU Scheduling
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 5 Operating Systems.
Windows 2000 Scheduling Computing Department, Lancaster University, UK.
Operating System Concepts and Techniques Lecture 5 Scheduling-1 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques, First.
OPERATING SYSTEMS CPU SCHEDULING.  Introduction to CPU scheduling Introduction to CPU scheduling  Dispatcher Dispatcher  Terms used in CPU scheduling.
Chapter 6 CPU SCHEDULING.
More Scheduling cs550 Operating Systems David Monismith.
Operating System Examples - Scheduling
1 Our focus  scheduling a single CPU among all the processes in the system  Key Criteria: Maximize CPU utilization Maximize throughput Minimize waiting.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
What Every Developer Should Know about the Kernel Dr. Michael L. Collard 1.
BFSBFS by Con KolivasCon Kolivas Guruprasad Aphale. Real Time Lunch, 10/21/ Guruprasad Aphale.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
Chapter 5: Process Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Basic Concepts Maximum CPU utilization can be obtained.
Lecture 6 Page 1 CS 111 Online Preemptive Scheduling Again in the context of CPU scheduling A thread or process is chosen to run It runs until either it.
6.1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
CS333 Intro to Operating Systems Jonathan Walpole.
1.  System Characteristics  Features of Real-Time Systems  Implementing Real-Time Operating Systems  Real-Time CPU Scheduling  An Example: VxWorks5.x.
Operating Systems Scheduling. Scheduling Short term scheduler (CPU Scheduler) –Whenever the CPU becomes idle, a process must be selected for execution.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Lecture 4 Page 1 CS 111 Summer 2013 Scheduling CS 111 Operating Systems Peter Reiher.
Process Scheduling. Scheduling Strategies Scheduling strategies can broadly fall into two categories  Co-operative scheduling is where the currently.
Basic Concepts Maximum CPU utilization obtained with multiprogramming
1 Chapter 5: CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 6: CPU Scheduling.
Chapter 19: Real-Time Systems
Linux Scheduler.
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Operating Systems Design (CS 423)
Chapter 5a: CPU Scheduling
Chapter 2.2 : Process Scheduling
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 2: The Linux System Part 3
Chapter5: CPU Scheduling
TDC 311 Process Scheduling.
Scheduling.
Chapter 5: CPU Scheduling
Chapter 6: CPU Scheduling
CPU SCHEDULING.
Outline Scheduling algorithms Multi-processor scheduling
CPU scheduling decisions may take place when a process:
Process Scheduling Decide which process should run and for how long
Chapter 19: Real-Time Systems
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
Shortest-Job-First (SJR) Scheduling
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Presentation transcript:

BFS: Brain F*ck Scheduler Jacob Chan

Objectives  Brain F*ck Scheduling  What it is  How it works  Features  Scalability  Limitations  Definition of Terms

Brain F*** Scheduler: What and Why?  I don’t curse FYI. It’s against my integrity  So for the purpose of this class, let’s say that it’s BFS  Goals  Minimize complex designs of CPU process schedulers  Implement a simpler design (because BFS is an alternative to Completely Fair Scheduler or CFS)  Achieve desktop interactivity without the heuristics  Aka improving desktop performance  Who operates desktops? How does the user interact to the desktop?

Brain F*** Scheduler: What and Why?  Con Kolivas  Australian anesthetist  Wrote patches to improve desktop performance  Linux developers mainly focused on server development prior to BFS  Thus, he devised the BFS  BFS allowed enhancements for lower-spec devices  Single cores  Low power machines (like phones)  Reason: low overhead (due to dropping lower priority tasks; more on this later)

Jiffy  Duration of one tick of the timer system interrupt  1 jiffy = 1 tick of system clock  Not absolute  Dependent on clock interval frequency of the HARDWARE  Linux on Intel i386 has a jiffy of 4 milliseconds (too slow!)

How does BFS Work?  System time is updated by an interrupt that is periodically sent out by the CPU  Think of system time as the computer’s body clock (to be simpler)  CPU will stop what it is doing and runs the timer interrupt service routine (just to update system time)  Effects  Jiffy is added (one tick of system clock)  Preemption  CPU resumes whatever it is doing (unless there is a preemption)

Key Feature: Virtual Deadline  Deadlines imposed on soft real-time system  Not really a critical deadline (as in life-or-death)  Service the earliest deadline as much as possible  Expired deadlines are not BOOM! But if there are, finish it right away.  Virtual deadlines may be ignored(depending on priority of process), and can also be recomputed  In BFS, virtual deadlines are only used for normal and idle processes  Including tasks at the same level  Real time tasks go ahead of normal tasks!

BFS: Variables  rr_interval  Round robin interval (can be found in /proc/sys/kernel/rr_interval )  Default value: 6ms  Humans can detect jitter in approximately 7ms  Higher than 6ms will result into worse latencies  Latency vs throughput: what are the difference?  Time quantum is equal to this value  Affects in computing virtual deadlines (more on this later)  iso_cpu  Used for isochronous scheduling  Default value: 70%  Setting this to 0 removes running pseudo-real-time tasks  Setting this to 100 results into users getting round robin access ( SCHED_RR )

BFS: Variables  Scheduling policies  SCHED_ISO (Isochronous Scheduling)  Allows non-root users to run tasks with an almost real-time priority  If isochronous task exceeds iso_cpu time, then it is demoted to a normal task  During this, total CPU power is computed  SCHED_IDLEPRIO (scheduling tasks that would run only if processor is idle)  Very low priority!

General Features of BFS  Only one runqueue for the ENTIRE SYSTEM, not each CPU  This makes BFS unique from other schedulers (since other schedulers are on a per- core basis)  Maximum size = (# of tasks requesting CPU time) – (logical processors) + 1  O(n) worst case (what is n?)  Relies on virtual deadlines for normal (and idle, if any) priority tasks  Process accounting does not rely on sleep time

Computation of Virtual Deadline  Only applies to normal or idle tasks  When task requests CPU time, it enters the ready queue  Priority ratio (based on nice level)  Nice level = 100% for -20, +10% for every level above that  Virtual deadline = (current time in jiffies) + (priority ratio * rr_interval )  Time slice = rr_interval

Computation of Virtual Deadline  Only applies to normal or idle tasks  When task requests CPU time, it enters the ready queue  Priority ratio (based on nice level)  Nice level = 100% for -20, +10% for every level above that  Virtual deadline = (current time in jiffies) + (priority ratio * rr_interval )  Time slice = rr_interval

Computation of Virtual Deadline  When task uses up time slice, its time slice is refilled and its virtual deadline is recomputed then it is put back to the runqueue  The virtual deadline will remain unchanged if the task goes to sleep without using its allocated time slice  Why would a task go to sleep?

BFS: New Task Inserted  BFS runqueues have 103 priority queues  Each is a double linked list implementation  100 for static real-time tasks  1 for isochronous  1 for normal  1 for idle  When task is inserted, a corresponding bit in a bitmap of priorities is updated  Indicates that this task is waiting to be run

BFS: New Task Arrives  When task arrives (or ready to be in the runqueue)  If there is an available processor, immediately assign the task to that processor (to run it)  Requires O(n), n = number of CPUs  Else, preempt the running task with the lowest priority, if the task’s priority and virtual deadline allows it (or latest deadline, if applicable)  Check priority, then virtual deadline (only for normal or idle tasks)  If no available processor and preemption, then put the task in the appropriate priority queue  O(1)

BFS: Rescheduling  Tasks return to runqueue when:  Time slice allocated is consumed. Time slice and virtual deadline are recomputed  It goes to sleep or is preempted. Time slice and virtual deadline are not recomputed  Check bitmap to see priority level tasks  Real-time -> isochronous -> normal -> idle  Each priority queue has its own algorithm to choose next process to run  Real-time with same priority level tasks are in FIFO  Isochronous tasks are in FIFO  Among normal and idle tasks, earliest virtual deadline is chosen  Chosen process is removed from the runqueue and dispatched to the processor

BFS: Rescheduling  It’s not always the case that normal/idle queues use priority-oriented algorithms  Normally, the earliest deadline task is chosen  But this takes O(n), with n = number of processes in queue  If process with expired deadline is found while searching, then choose that process immediately!  Even if there is a task with an earlier and expired deadline along the list

BFS: Computer Affinity  Tasks can be assigned to any CPU, but idle processors are ranked according to affinity  Temporal locality  tasks that have run at least once are assigned to the same processor (or processor in the same cache)

Lab 6: Answering Questions  There will be no lab for this session (in order to prepare for next week’s midterms)  However, the following questions must be answered first (next slide)  No need to submit a certificate of authorship (since submission is notes-based)  This will count as a normal lab  I have uploaded BFS notes for this exercise (since some of them come from the notes)  Deadline: 11:55 pm tonight (it’s easy anyway)

Lab 6: Answering Questions 1.Why is there a subtraction of number of processors in computing for the maximum size of the runqueue? What about the +1? (2 pts) 2.Based on the niceness level, which has higher priority, a process with a niceness level of 8 or -5? Show your solution (2 pts) 3.Why does processing not account of sleep time? (2 pts) 4.If a process A will run on processor B located at cache C, why will it prefer to run in that same processor? (2 pts) 5.Describe subtick accounting in your own words (2 pts)