Avoiding Scheduler Subversion using Scheduler - Cooperative Locks Yuvraj Patel , Leon Yang , Leo Arulraj , Andrea Arpaci - Dusseau , Remzi Arpaci - Dusseau , Michael Swift University of Wisconsin - Madison
Once upon a time .... Processes P0 P1 Accessing a kernel service 1
Once upon a time .... Processes P0 P1 Default priority Accessing a kernel service 1
Once upon a time .... *Linux CFS Scheduler Processes P0 P1 Accessing a kernel service Default priority 1
Schedulers are important for resource sharing 2
Let us now introduce a lock .... 3
A ticket lock reduces wait - time and avoids starvation 4
If P0 holds the lock twice as long as P1 5
P1 If P0 holds the lock P0 twice as long as P1 Time 5
P1 If P0 holds the lock P0 twice as long as P1 Time While in critical section, P0 uses twice much CPU as P1 5
P1 If P0 holds the lock P0 twice as long as P1 Time 5
P1 If P0 holds the lock P0 twice as long as P1 Time 5
P1 If P0 holds the lock P0 twice as long as P1 Time Every time P0 enters critical section, it uses twice as much CPU as P1 5
Despite 50 : 50 allocation , P0 uses twice as much CPU as P1 ' s 6
Scheduler Subversion Locks determine the CPU allocation instead of the scheduler 7
When does scheduler subversion happen ? 8
Two reasons 9
Different critical section lengths 10
Different critical section lengths Thread dwelling longer in critical section becomes dominant user of CPU 11
Majority locked run time 12
Majority locked run time Threads have to spend a lot of time in the critical section 1 , 2 , 3 , 4 and it is often a case 1 . Lock – Unlock : Is That All ? A Pragmatic Analysis of Locking in Software Systems . ACM Trans . Comput . Syst ., 36 ( 1 ), March 2019 . 2 . Remote Core Locking : Migrating Critical - Section Execution to Improve the Performance of Multithreaded Applications . USENIX ATC 2012 3 . Understanding Manycore Scalability of File Systems , USENIX ATC 2016 4 . Non - scalable locks are dangerous . Linux Symposium , 2012 13
Every concurrent system can be prone to scheduler subversion 14
Remedy 15
Three design components Track lock usage of users 16
Three design components Example x Track lock usage of users P1 Track the time P0 spent by each process in critical section 16
Three design components Example x Track lock usage of users P1 Track the time P0 spent by each process in 2x critical section 16
Three design components Example x Track lock usage of users P1 P0 Penalize dominant users 2x 16
Three design components Example x Track lock usage of users P1 Penalize while P0 acquiring the Penalize dominant users lock again 2x 16
Three design components Example x x Track lock usage of users P1 P0 Penalize dominant users 2x 16
Three design components Example x x Track lock usage of users P1 P0 Penalize dominant users 2x Provide appropriate opportunity to each user 16
Three design components Example x x x Track lock usage of users P1 P0 Penalize dominant users 2x Penalizing P0 creates Provide appropriate enough opportunity to let P1 acquire the opportunity to each user lock multiple times 16
Three design components Example x x x Track lock usage of users P1 P0 Penalize dominant users 2x Opportunity depends on Provide appropriate the scheduling goals opportunity to each user 16
Scheduler - Cooperative Locks ( SCL ) Ticket Lock SCL 17
Conclusion We introduce the scheduler subversion problem We introduce scheduler - cooperative locks ( SCL ) to mitigate scheduler subversion
Thank you !!! Queries ??
Recommend
More recommend