8#define SCHED_TIME_SLICE 2
the data of each core (per-CPU data).
struct cpu cpu_t
the data of one core
uint8_t flags
Definition idt.c:3
unsigned int uint32_t
Definition fb.h:17
struct process process_t
process control block.
void scheduler_tick(void)
called from the PIT IRQ handler on every tick.
Definition scheduler.c:546
void scheduler_remove(process_t *proc)
remove a process from its run queue.
Definition scheduler.c:396
bool scheduler_is_active(void)
check whether the scheduler has started switching processes.
Definition scheduler.c:541
bool scheduler_run_core(void)
make the code that runs the call the idle task of its core, and run processes on the core from now on...
Definition scheduler.c:326
void scheduler_ready_locked(process_t *proc)
scheduler_ready() for a caller that holds sched_lock.
Definition scheduler.c:346
void scheduler_unlock(uint32_t flags)
release sched_lock and restore the interrupt state.
Definition scheduler.c:408
void scheduler_tail(void)
the first call of a new process (the idle task, the start of a program, a fork child): release the sc...
Definition scheduler.c:440
void schedule_locked(void)
switch to the next ready process.
Definition scheduler.c:457
void scheduler_kick(process_t *proc)
make a process that runs on another core enter the kernel now (a reschedule IPI), so that it acts on ...
Definition scheduler.c:374
process_t * scheduler_pull_locked(cpu_t *cpu, uint32_t min_load)
move the process at the head of the queue of the busiest other core to the queue of a core (load bala...
Definition scheduler.c:250
spinlock_t sched_lock
the lock of the run queues, the state of each process and the list of each wait queue.
Definition scheduler.c:41
void scheduler_finish(uint32_t flags)
scheduler_unlock() after schedule_locked(): it also frees the orphans that exited on the stack this c...
Definition scheduler.c:414
void scheduler_init(void)
initialize the scheduler.
Definition scheduler.c:305
void scheduler_yield(void)
voluntarily yield the CPU to the next ready process.
Definition scheduler.c:579
void scheduler_ready(process_t *proc)
add a process to a run queue: the queue of the core it last ran on, or of an idle core (scheduler....
Definition scheduler.c:384
void scheduler_remove_locked(process_t *proc)
scheduler_remove() for a caller that holds sched_lock.
Definition scheduler.c:364
the data of one core
Definition cpu.h:39
kernel locking rules:
Definition spinlock.h:67