Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and Machine Learning applied to Process definitions Our target: CFS Scheduling What can we do ? Results and analysis Benoit Zanotti Conclusion jicks@lse.epita.fr http://www.lse.epita.fr July 17, 2013
Plan Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and definitions Machine Learning Introduction and definitions 1 Process Scheduling Machine Learning Our target: CFS Process Scheduling What can we do ? Results and analysis Conclusion
Plan Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and definitions Machine Learning Introduction and definitions 1 Process Scheduling Machine Learning Our target: CFS Process Scheduling What can we do ? Results and analysis Conclusion
Definition of Machine Learning Machine Learning applied to Process Scheduling Benoit Zanotti Definition Introduction and definitions Machine Learning is a field of Computer Science about Machine Learning the construction and study of systems that can learn from Process Scheduling Our target: CFS data. What can we do ? Usual organizations of ML algorithms : Results and analysis Supervised learning (classification, ...) Conclusion Unsupervised learning (clustering, ...) Semi-supervised learning ...
Notes about Machine Learning Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and definitions Machine Learning Process Scheduling We won’t talk really about the theory. But: Our target: CFS Pretreatment is very important. What can we do ? Usually, big tradeo ff between speed and e ffi ciency Results and analysis In Process Scheduling, those factors will be limiting. Conclusion
Plan Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and definitions Machine Learning Introduction and definitions 1 Process Scheduling Machine Learning Our target: CFS Process Scheduling What can we do ? Results and analysis Conclusion
What is Process Scheduling ? Machine Learning applied to Process Scheduling Benoit Zanotti Definition Introduction and definitions Process Scheduling is the method by which processes are Machine Learning Process Scheduling given access to processor time. It is used to achieved multi- Our target: CFS tasking. What can we do ? Results and There is many well-known scheduling algorithms. For analysis example: Conclusion First In, First Out Round-Robin (fixed time unit, processes in a circle)
Main concerns Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and A scheduler has mainly 3 metrics: throughput, latency definitions and fairness. We can simplify them (in practice) by: Machine Learning Process Scheduling Speed (how much time the scheduler itself uses, Our target: CFS number of context-switching, ...) What can we do ? Results and Fairness (giving equal CPU time to each process) analysis Conclusion Reactivity (are interactive processes given any advantages ?) A scheduler is complicated. Let’s optimize one using ML !
Plan Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and definitions Our target: CFS Our target: CFS 2 Inner workings Inner workings Advantages / Inconvenients Advantages / Inconvenients What can we do ? Results and analysis Conclusion
Plan Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and definitions Our target: CFS Our target: CFS 2 Inner workings Inner workings Advantages / Inconvenients Advantages / Inconvenients What can we do ? Results and analysis Conclusion
Inner workings of CFS Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and Stands for C ompletely F air S cheduler definitions Our target: CFS Scheduler of Linux since 2.6.23 Inner workings Advantages / Inconvenients Just an RB-tree with elements indexed by the What can we do ? runtime of the process. Results and analysis Straightforward algorithm: just take the minimum of Conclusion the tree. CFS in Linux kernel is actually more complicated (handling Real-Time tasks, nice values, ...)
Why CFS ? Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and definitions Our target: CFS Inner workings Quite simple and works really well Advantages / Inconvenients What can we do ? Most familiar (I implemented one in mikro) Results and Already e ffi cient. I wanted to see what ML could do. analysis Conclusion
Plan Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and definitions Our target: CFS Our target: CFS 2 Inner workings Inner workings Advantages / Inconvenients Advantages / Inconvenients What can we do ? Results and analysis Conclusion
Advantages / Inconvenients Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and definitions Our target: CFS ✓ Very simple to understand Inner workings Advantages / Inconvenients ✓ Works really well in general cases What can we do ? ✓ No real corner cases Results and analysis ✗ A little light on the handling of interactive processes. Conclusion
Plan Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and definitions What can we do ? Our target: CFS 3 What can we do ? ML considerations ML considerations Applying ML to the CFS Applying ML to the CFS Results and analysis Conclusion
Plan Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and definitions What can we do ? Our target: CFS 3 What can we do ? ML considerations ML considerations Applying ML to the CFS Applying ML to the CFS Results and analysis Conclusion
ML considerations Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and Restricted to supervised learning (classification and definitions regression mainly) Our target: CFS What can we do ? Scheduler must be as fast as possible. Its ML ML considerations Applying ML to the CFS components too. Results and Avoiding complex code in the kernel is often a good analysis Conclusion idea. → precomputed model / profile for each processes → no complex methods, results will be mitigated
Plan Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and definitions What can we do ? Our target: CFS 3 What can we do ? ML considerations ML considerations Applying ML to the CFS Applying ML to the CFS Results and analysis Conclusion
Applying ML to the CFS Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and Ojective: reducing the number of context switchs : definitions Our target: CFS A process time quantum should ideally not finish What can we do ? (process going to sleep) ML considerations Applying ML to the CFS An estimation of the next quantum would help Results and analysis Based on the N lasts quantums Conclusion Be careful not to be too unfair Note: Many other objectives were possible...
Actual implementation Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and definitions Our target: CFS Proof of Concept What can we do ? One using Taylor’s Theorem and one using a ML considerations Applying ML to the CFS classifier Results and analysis Need to extract real runtime quantums and to create Conclusion profiles
Taylor’s theorem Machine Learning applied to Process Scheduling Benoit Zanotti The sequence of quantums can be seen as a function Introduction and of the time. definitions Our target: CFS Taylor’s theorem gives an approximation of a What can we do ? function on a point given its derivatives ML considerations Applying ML to the CFS Discrete derivation is only substraction Results and analysis → an approximation of the next quantum is: Conclusion f ( x + 1) = f ( x ) + f ′ ( x − 1) + f ′′ ( x − 1) 2 This method is simple and fast, but not very precise.
Classifier Machine Learning applied to Process Scheduling Naive Bayes Classifier using the last 4 quantums: Benoit Zanotti It is the best (found) compromise between speed and Introduction and definitions results Our target: CFS Parameters and output are range of time, not the What can we do ? actual values ML considerations Applying ML to the CFS Based on Bayes’ theorem. Outputs the labels with Results and analysis most probability Conclusion Only 4 multiplications are needed for each label (there is 10 of them). Using bit manipulation, we can avoid any conditionals → it is fast, but clearly not the most accurate
Plan Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and definitions Results and analysis 4 Our target: CFS perf and Linsched What can we do ? Methodology and results Results and analysis Analysis perf and Linsched Methodology and results Analysis Conclusion
Plan Machine Learning applied to Process Scheduling Benoit Zanotti Introduction and definitions Results and analysis 4 Our target: CFS perf and Linsched What can we do ? Methodology and results Results and analysis Analysis perf and Linsched Methodology and results Analysis Conclusion
Recommend
More recommend