12.07.2015 Views

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CSF (9) <strong>NetBSD</strong> <strong>Kernel</strong> Developer’s <strong>Manual</strong> CSF (9)pri_tsched_kpri(lwp_t ∗);voidresched_cpu(lwp_t ∗);voidsetrunnable();voidschedclock(lwp_t ∗);voidsched_init(void);DESCRIPTIONCSF provides a modular and self-contained interface for implementing different thread scheduling algorithms.The different schedulers can be selected at compile-time. Currently, the only scheduler available issched_4bsd(9), the traditional 4.4BSD thread scheduler.The interface is divided into two parts: A set of functions each scheduler needs to implement and commonfunctions used by all schedulers.Scheduler-specific functionsThe following functions have to beimplemented by the individual scheduler.Scheduler initializationvoid sched_cpuattach(struct cpu_info ∗)Per-CPU scheduler initialization routine.void sched_rqinit(void)Initialize the scheduler’s runqueue data structures.void sched_setup(void)Setup initial scheduling parameters and kick off timeout driven events.Runqueue handlingRunqueue handling is completely internal to the scheduler. Other parts of the kernel should access runqueuesonly through the following functions:void sched_enqueue(lwp_t ∗ , bool)Place an LWP within the scheduler’s runqueue structures.void sched_dequeue(lwp_t ∗)Remove an LWP from the scheduler’s runqueue structures.lwp_t ∗ sched_nextlwp(void)Return the LWP that should run the CPU next.bool sched_curcpu_runnable_p(void)Indicate if there is a runnable LWP for the current CPU.void sched_print_runqueue(void (∗pr)(const char ∗, ...))Print runqueues in DDB.<strong>NetBSD</strong> 3.0 July 14, 2007 2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!