cpu_need_resched(9) - NetBSD Manual Pages

Command: Section: Arch: Collection:  
CPU_NEED_RESCHED(9)    NetBSD Kernel Developer's Manual    CPU_NEED_RESCHED(9)

cpu_need_resched -- context switch notification
#include <sys/cpu.h> void cpu_need_resched(struct cpu_info *ci, int flags);
The cpu_need_resched() function is the machine-independent interface for the scheduler to notify machine-dependent code that a context switch from the current LWP, on the cpu ci, is required. This event may occur if a higher priority LWP appears on the run queue or if the current LWP has exceeded its time slice. If RESCHED_IMMED flag is specified in flags, machine-dependent code should make a context switch happen as soon as possible. In that case, for example, if ci is not the current processor, cpu_need_resched() typi- cally issues an inter processor call to the processor to make it notice the need of a context switch as soon as possible.
Specifically, the cpu_need_resched() function will perform the following operations: Set a per-processor flag which is checked by userret(9) when returning to user-mode execution. Post an asynchronous software trap (AST). Send an inter processor interrupt to wake up cpu_idle().
sched_4bsd(9), userret(9) NetBSD 5.0 May 18, 2007 NetBSD 5.0
Powered by man-cgi (2024-03-20). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.