Section 3.5. Dispatcher Initialization


3.5. Dispatcher Initialization

Dispatcher initialization begins at boot time, when the core operating system startup code calls dispinit(). Among the basic initialization tasks performed by dispinit() are the setup of the default CPU partition (cpupart_initialize_default()) and calls into the scheduler-class-specific init functions for all the pre-loaded scheduling classes. disp_setup() is called to establish the actual dispatch queues and initialize the queue variables. Table 3.1 described the initialization functions.

Table 3.1. Dispatcher Initialization Functions

Function

Description

disp_setup()

Allocate dispatcher structures and variables

dispinit()

Initialize loaded scheduling classes and the dispatcher framework

disp_add()

Initialize a newly loaded scheduling class

cpu_dispalloc()

Allocate per-processor dispatch queues

disp_dq_alloc()

Allocate the kernel memory for the queues and set the pointers; support function for cpu_dispalloc()

disp_dq_assign()

Assign priorities to dispatch queues

disp_dq_free()

Free dispatch queue resources (kernel memory)

disp_cpu_init()

Initialize a dispatch queue for a processor

disp_kp_alloc()

Allocate a kernel preempt (kp) queue

disp_kp_free()

Free a previously allocated kp queue


The initialization sequence and flow is illustrated below.

The cpupart_initialize_default() function is part of the CPU partition support code. A CPU partition is the kernel abstraction for user-defined processor sets (processor sets are created with psrset(1M)). Processor sets and CPU partitions are different but related abstractions. Users create processor sets and explicitly bind threads to the set, and the kernel guarantees that only threads bound to the set are executed on the processors in the set. Within the kernel, a processor partition has been defined; this partition represents a grouping of one or more processors, with a global dispatch queue. The kp queue for real-time threads is global for the partition: Each processor in the partition still has a per-processor set of dispatch queues for threads in other scheduling classes. As part of the dispatcher initialization process, the default CPU partition is created and initialized.

Each scheduling class has a class-specific initialization function that gets called for each loaded scheduling class. The scheduling class initialization functions are relatively simple, establishing priority limit variables, setting up list arrays that maintain linked lists of threads in each class, and initializing class-specific parameters.

The dispatch queue setup code allocates the kernel memory and sets up the linked lists, pointers and structure variables for the per-CPU dispatch queues and the kp queue. When the dispatch queue initialization is complete, the last step is to compute the global base priority for interrupt threads, based on the number of global priorities (see Figure 3.8). The number of global priorities and the base priority of interrupt threads are determined by the presence or absence of the real-time scheduling class. If the real-time class is not loaded (default), there are 100 global priorities (099) for noninterrupt threads and the interrupt thread priorities are 100109. If real-time is loaded, the number of global priorities is increased to 160 (0159) and interrupt threads occupy priorities 160169.

Figure 3.5. Dispatcher Initialization Functions





SolarisT Internals. Solaris 10 and OpenSolaris Kernel Architecture
Solaris Internals: Solaris 10 and OpenSolaris Kernel Architecture (2nd Edition)
ISBN: 0131482092
EAN: 2147483647
Year: 2004
Pages: 244

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net