Analysis of FreeBSD Ule Scheduler

Source: Internet
Author: User
Tags execution reserved versions linux

FreeBSD 5-current has just introduced a kernel dispatch unit scheduler called the Ule Scheduler. This scheduler is much more efficient in SMP systems than FreeBSD previous versions (currently, the scheduler is called the 4BSD Scheduler).

The new Ule Scheduler is designed more like a scheduler for operating systems such as Solaris and Linux. Solaris's SMP performance is very good this is one of its selling points, and its scheduler to use the excellent algorithm is a very important reason. BSD-derived systems, although the overall design of the system is reasonable, and the performance of other parts of the operating system to make up for its shortcomings in the SMP scheduler, even though FreeBSD in most cases performance is more than

Other systems, but it uses the 4BSD Scheduler's low SMP performance is still a criticism.

Happily, the newly designed Ule Scheduler introduced an advanced algorithm for SMP scheduling in Solaris, Linux, and other systems, and it has a fairly good performance in a single-processor system, comparable to the performance of the 4BSD scheduler.

Why is the new Ule scheduler able to achieve higher performance? The main reason is that the new Ule Scheduler maintains the running queues for each CPU separately, and the CPU can "steal" each other's tasks in the ready queue to achieve a better balance. Basically, the design of the Ule scheduler conforms to the following principles: use as much execution resources as possible, use local locks as much as possible, avoid the use of spin locks that waste execution resources as much as possible, and use efficient scheduling algorithms as much as possible (the complexity of the current Ule Scheduler is O(1)).

When I write this article, the Ule Scheduler is still in the process of further improvement. On the one hand, it has been able to provide better scheduling performance than the 4BSD Scheduler--The kernel-state scheduling cost is reduced by about 25%, and user-state computing is reduced to a certain extent.

The CVS tag of the Ule Scheduler (SRC/SYS/KERN/SCHED_ULE.C) described in this article is

$FreeBSD: src/sys/kern/sched_ule.c,v 1.8 2003/02/03 05:30:07 jeff Exp $

Future versions of the Ule scheduler may have some access to this version, but not too large.

If necessary, you can download the required source code here [of course, I personally suggest that you still checkout a copy of Freebsd-current source code ]. Because of the reference

The code in the scheduler, according to the source code license Agreement, the following first restatement of its copyright notice. This code uses a typical BSD-style authorization. In order not to cause the difficulty of reading, this horse does not make grammar light.

/*-
* Copyright (c) 2003, Jeffrey Roberson
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* Modification, are permitted provided that following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* Notice unmodified, this list of conditions, and the following
* Disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* Notice, this list of conditions and the following disclaimer in the
* documentation and/or materials provided with the distribution.
*
* This SOFTWARE are provided by the AUTHOR ' as is ' and any EXPRESS OR
* Implied warranties, including, BUT not LIMITED to, the implied warranties
* of merchantability and FITNESS for A particular purpose ARE disclaimed.
* in NO EVENT SHALL the AUTHOR is liable for any DIRECT, INDIRECT,
* Incidental, SPECIAL, exemplary, OR consequential damages (including, BUT
* Not LIMITED to, procurement of substitute goods or SERVICES; LOSS of Use,
* DATA, or profits; OR BUSINESS interruption) HOWEVER caused and on any
* Theory of liability, WHETHER in CONTRACT, STRICT liability, OR TORT
* (including negligence OR otherwise) arising in any WAY out of the use of
* This SOFTWARE, even IF advised of the possibility of SUCH DAMAGE.
*/
The Chinese text is as follows, for reference, where the English version is the subject of inconsistency with English.
All rights reserved
©
2003 Jeffrey Roberson, All rights reserved.
Allows redistribution of modified or unmodified software that exists in source or compiled form, subject to the following conditions:
1. Publications in the form of source code must retain the aforementioned copyright notice, this license condition and the subsequent non-commitment clause.
2. The published version of the publication must be reproduced in the release of the document and/or other information to restate the above copyright notice, this license conditions, and subsequent commitments to the terms.
This software is provided by its author in "That Way". No warranties, express or implied, including, but not limited to, the indirect warranties of merchantability and practicality based on a purpose. In any case, the author is not responsible for the use of this software, direct, indirect, incidental, special, disciplinary or consequential damages (including, without limitation, access to alternatives and services, inability to use, loss of data, loss of profit or disruption of business), regardless of how such damage is caused, and based on what responsibility is inferred, Whether it is within the scope of the contract, strict liability or civil tort (including negligence and other reasons) assumes any responsibility, even if it is previously known that such damage may occur.

In this scheduler, there are still a number of sections labeled "XXX", which are currently not well optimized or need to be modified in a larger scale in the future; In addition, there are some inconsistencies with the source code, which I will try to minimize (that is, do not affect the code intent) Correction or avoidance. In addition, I do not intend to elaborate on the details of some of the scheduler-this may include macro definitions that are not closely related to the scheduler itself, and so on. If you are interested in these parts of the scheduler, see your code yourself.

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.