Linux kernel Source read Note 2-2.6 Version Scheduler SCHED.C features

Source: Internet
Author: User

From: http://www.ibm.com/developerworks/cn/linux/l-scheduler/

The source code for the 2.6 version scheduler is well encapsulated in the/USR/SRC/LINUX/KERNEL/SCHED.C file. We summarize some useful functions that can be found in this file in table 1.

table 1. Features of the Linux 2.6 scheduler
function name functions Description
schedule Scheduler main function. Scheduling the highest priority task execution.
load_balance Check the CPU to see if there is an imbalance and attempt to migrate the task if it is unbalanced.
effective_prio returns the effective priority of a task (based on a static policy, but can contain any rewards and penalties).
recalc_task_prio determines the reward or penalty for a task based on the idle time of the task.
source_load calculates the load of the source CPU (the CPU from which the task was migrated) properly.
target_load calculates the payload of the target CPU (the CPU the task may migrate to) fairly.
migration_thread A high-priority system thread that migrates tasks between CPUs.

The structure of the running queue can also be found in the/usr/src/linux/kernel/sched.c file. The 2.6 version of the scheduler can also provide some statistics (if enabled CONFIG_SCHEDSTATS ). These statistics can be seen from/proc/schedstat in the/proc file system, which provides a lot of data for each CPU in the system, including load balancing and process migration statistics.

Linux kernel Source read Note 2-2.6 Version Scheduler SCHED.C features

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.