Why does Linux Kernel Scheduler code have locks for run queues? Does the scheduler spawn kernel threads, and locks are to prevent two of such threads to avoid modifying run queues at the same time?
Each Processor has a run-queue, and might want to access other run-queues of other Processors. Locking is required to avoid corruption when a run-queue is manipulated by two or more Processors.
Reference: Linux Kernel Development by Robert Love ( Partially available at http://www.informit.com/articles/article.aspx?p=101760&seqNum=2 )