BFSBFS by Con KolivasCon Kolivas Guruprasad Aphale. Real Time Lunch, 10/21/2009 1 Guruprasad Aphale.

Slides:



Advertisements
Similar presentations
Uniprocessor Scheduling Chapter 9 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
Advertisements

Scheduling Algorithems
1 Always want to have CPU (or CPU’s) working Usually many processes in ready queue –Ready to run on CPU –Focus on a single CPU here Need strategies for.
Linux Scheduler. Linux is a multitasking OS Deciding what process runs next, given a set of runnable processes, is a fundamental decision a scheduler.
The Linux Kernel: Memory Management
Sogang University Advanced Operating Systems (Process Scheduling - Linux) Advanced Operating Systems (Process Scheduling - Linux) Sang Gue Oh, Ph.D. .
BFS: Brain F*ck Scheduler Jacob Chan. Objectives  Brain F*ck Scheduling  What it is  How it works  Features  Scalability  Limitations  Definition.
 A quantum is the amount of time a thread gets to run before Windows checks.  Length: Windows 2000 / XP: 2 clock intervals Windows Server systems: 12.
Day 25 Uniprocessor scheduling. Algorithm: Selection function Selection function – which process among ready processes to select. w – time spent in system,
Chapter 2: Processes Topics –Processes –Threads –Process Scheduling –Inter Process Communication (IPC) Reference: Operating Systems Design and Implementation.
Cs238 CPU Scheduling Dr. Alan R. Davis. CPU Scheduling The objective of multiprogramming is to have some process running at all times, to maximize CPU.
The Linux Scheduler 2.4 vs 2.6 Michael McCabe Michael McCabe
1 Lecture 10: Uniprocessor Scheduling. 2 CPU Scheduling n The problem: scheduling the usage of a single processor among all the existing processes in.
Phones OFF Please Processes Parminder Singh Kang Home:
Budapesti Műszaki és Gazdaságtudományi Egyetem Méréstechnika és Információs Rendszerek Tanszék Scheduling in Windows Zoltan Micskei
1 Uniprocessor Scheduling Chapter 9. 2 Aim of Scheduling Main Job: Assign processes to be executed by the processor(s) and processes to be loaded in main.
 Scheduling  Linux Scheduling  Linux Scheduling Policy  Classification Of Processes In Linux  Linux Scheduling Classes  Process States In Linux.
Operating System Concepts and Techniques Lecture 5 Scheduling-1 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques, First.
Operating System Examples - Scheduling
OPERATING SYSTEM: DESIGN AND IMPLEMENT FINAL PROPOSAL SCHEDULER 周長毅, 周榆豐.
Seminar on Linux Process Management Presentation by Manoj Dhage MTech 1 st Year, SIT, IIT Kharagpur.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 5: CPU Scheduling.
CPU Scheduling Presentation by Colin McCarthy. Runqueues Foundation of Linux scheduler algorithm Keeps track of all runnable tasks assigned to CPU One.
Multiprogramming. Readings r Silberschatz, Galvin, Gagne, “Operating System Concepts”, 8 th edition: Chapter 3.1, 3.2.
Uniprocessor Scheduling
Kernel Locking Techniques by Robert Love presented by Scott Price.
LINUX SCHEDULING Evolution in the 2.6 Kernel Kevin Lambert Maulik Mistry Cesar Davila Jeremy Taylor.
CSCI1600: Embedded and Real Time Software Lecture 24: Real Time Scheduling II Steven Reiss, Fall 2015.
CS Spring 2009 CS 414 – Multimedia Systems Design Lecture 31 – Process Management (Part 1) Klara Nahrstedt Spring 2009.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 3.
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.
Operating System Examples - Scheduling. References r er/ch10.html r bangalore.org/blug/meetings/200401/scheduler-
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
Lecture 5 Scheduling. Today CPSC Tyson Kendon Updates Assignment 1 Assignment 2 Concept Review Scheduling Processes Concepts Algorithms.
Scheduling.
Multiprogramming. Readings r Chapter 2.1 of the textbook.
REAL-TIME OPERATING SYSTEMS
Homework Assignment #2 J. H. Wang Oct. 25, 2016.
Scheduling of Non-Real-Time Tasks in Linux (SCHED_NORMAL/SCHED_OTHER)
Linux Scheduler.
Scheduling and Fairness
Operating Systems Design (CS 423)
Wayne Wolf Dept. of EE Princeton University
Uniprocessor Scheduling
Chapter 2.2 : Process Scheduling
CPU Scheduling.
CS 3204 Operating Systems Lecture 14 Godmar Back.
Linux kernel: Processes, threads and scheduling
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Chapter 2: The Linux System Part 3
TDC 311 Process Scheduling.
Scheduling.
Chapter 5: CPU Scheduling
Chapter 9 Uniprocessor Scheduling
CPU SCHEDULING.
Outline Scheduling algorithms Multi-processor scheduling
COT 4600 Operating Systems Fall 2009
Process Scheduling Decide which process should run and for how long
Scheduling of Regular Tasks in Linux
Chapter 10 Multiprocessor and Real-Time Scheduling
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
Scheduling Classes and Real-Time Scheduling in Linux
Uniprocessor Scheduling
Linux Scheduling CSE 2431: Introduction to Operating Systems
Scheduling of Regular Tasks in Linux
CPU Scheduling David Ferry CSCI 3500 – Operating Systems
Presentation transcript:

BFSBFS by Con KolivasCon Kolivas Guruprasad Aphale. Real Time Lunch, 10/21/ Guruprasad Aphale.

Outline What is BFS? CFS vs. BFS Design of BFS ▫ Design Details ▫ Design Decisions Performance Evaluation ▫ Comparison with CFS Questions?? 2 Guruprasad Aphale.

Why BFS?? [1] 3 Guruprasad Aphale.

What is BFS? A “Fair” Scheduler by Con Kolivas. Simple, Basic Design Forward Looking Only Time slice independent of sleep time ▫ Fixed Time slice length Desktop Oriented Scheduler ▫ Meant for low spec machines ▫ Not supposed to be scaled for large hardware ▫ NUMA unaware 4 Guruprasad Aphale.

FeatureCFSBFS Scheduling Complexity O(log n)O(n) Ideal ForBig MachinesDesktop to mid-size (No. of Logical CPUs < 16) Tunable Knobs8 [2] 1 Run QueuesMultipleSingle Run Queue Implementation Red Black TreesDoubly Linked Lists Design ComplexityComplexSimple, Basic Code ComplexityComplexLess than CFS (Number of lines also reduced by more than 4000) Comparison of CFS and BFS 5 Guruprasad Aphale.

Design Details Virtual Deadline Task Insertions Task Selection Locking 6 Guruprasad Aphale.

Virtual Deadline “round robin interval” (rr_interval) ▫ Length of time slice in ms ▫ Configurable ▫ Modified based on number of CPUs  rr_interval *= 1 + lg(num_online_cpus) When a task is created, it is given a time slice and a virtual deadline Virtual Deadline = jiffies + (user_priority * rr_interval) user_priority : nice value + 20 (in range 0..39) 7 Guruprasad Aphale.

Virtual Deadline Continued.. The deadline is a virtual one ▫ No guarantee that a task will be scheduled by this time. ▫ Used to compare which task should go next Events causing rescheduling ▫ time_slice Exhausted ▫ sleep ▫ preemption 8 Guruprasad Aphale.

Virtual Deadline Continued… After swapping a task out ▫ put back on queue ▫ task with earliest deadline is chosen from queued but not running tasks. A problem with this approach ▫ Task’s deadline may already pass before it is chosen for execution. ▫ Indication that the task needs CPU time ahead of all later deadlines. 9 Guruprasad Aphale.

Task Insertion Has only one global queue which contains sub-queuesglobal queue Inserts task into relevant queue ▫ Each insertion takes O(1) time as inserting into doubly linked list. Check if new task can run on any idle CPU or can preempt any other running low priority task. ▫ Don’t wait for schedule to be called if a cpu is idle or low priority task is running Worst case time O(M), where M is number of CPUs. 10 Guruprasad Aphale.

Bitmap Array of sub queue heads RT tasks SCHED_NORMAL SCHED_ISO SCHED_IDLEPRIO t1t1 titi tjtj tntn Insertion t n+1 New Task to be inserted. SCHED_ISO 1 t n+2 New Task to be inserted. SCHED_RR (3 rd Sub-queue) 11 Guruprasad Aphale.

Task Selection Check bitmaps to find first set bit. If the first bit corresponds to a RT sub queue, select first task in the queue If no bit set in RT queue, then search for next task based on EVDF and suitable CPU affinity. ▫ If a task with expired deadline found, return that task. In most cases, entire queue lookup is not required. 12 Guruprasad Aphale.

Bitmap Array of sub queue heads RT tasks SCHED_NORMAL SCHED_ISO SCHED_IDLEPRIO d=7 d =5 Selection Task removed from queue and assigned to cpu 13 Guruprasad Aphale.

Locking Only one queue, thus only one lock protecting the process data So for every operation that modifies the queue, global lock has to be acquired. Once a task is assigned to a CPU, CPU removes it from queue and creates a local copy of task’s data structure. Thus updates are lockless Max number of tasks in global queue = number of tasks remaining – number of CPUs Guruprasad Aphale.

Design Decisions Single Run Queue ( O(n) lookup) ▫ Refers to queued but not running processes ▫ Absence of multiple queues results in no complex interactions among them Scheduling Decisions based only on CPU Usage ▫ No sleep time taken into consideration during scheduling decisions ▫ No interactivity estimator present 15 Guruprasad Aphale.

Design Decisions Interactivity in BFS ▫ The tasks that are waking up try to preempt same priority tasks. ▫ Even if they do not preempt, the waiting time for a task is still bounded(because of rr_interval), thus it is scheduled within a timeframe. 16 Guruprasad Aphale.

Performance Evaluation [3] TestCFSBFS Timed Apache Compilation Seconds Seconds Timed PHP Compilation Seconds Seconds 7-Zip Compression MIPS MIPS Apache Benchmark Requests Per Second Requests Per Seconds Threaded I/O Tester (Read Filesize Per Thread : 16 MB, Thread Count : 8) ms16.00 ms System Configuration Dual-core Intel Atom 330 CPU with Hyper-Threading clocked at 2.10GHz Good for Interactive Desktops? People have been doing a lot of benchmarking. But the results are not conclusive. 17 Guruprasad Aphale.

Thank You Questions??? 18 Guruprasad Aphale.

References 1. magazine.com/Online/News/Con-Kolivas- Introduces-New-BFS-Schedulerhttp:// magazine.com/Online/News/Con-Kolivas- Introduces-New-BFS-Scheduler 2. ry/l-cfs/ ry/l-cfs/ 3. &item=bfs_scheduler_benchmarks&num=1http:// &item=bfs_scheduler_benchmarks&num=1 19 Guruprasad Aphale.

Global Queue Structure Contains 103 subqueues ▫ 100 RT queues ▫ SCHED_ISO queue ▫ SCHED_NORMAL queue ▫ SCHED_IDLEPRIO queue ▫ Each sub queue is a doubly linked list. While setting up a new task, a bitmap of running priorities is set. Each bit corresponds to a sub queue inside global queue. This shows which priorities have waiting tasks. 20 Guruprasad Aphale.

Bitmap Array of sub queue heads RT tasks SCHED_NORMAL SCHED_ISO SCHED_IDLEPRIO t1t1 titi tjtj tntn Task Sub queues Global Run Queue Structure (Only Queues) 21 Guruprasad Aphale.