PatchworkOS
Loading...
Searching...
No Matches
sched.h File Reference
#include <kernel/defs.h>
#include <kernel/sched/wait.h>
#include <kernel/sync/lock.h>
#include <sys/list.h>
#include <sys/proc.h>

Go to the source code of this file.

Data Structures

struct  sched_queues_t
 Scheduling queues structure. More...
 
struct  sched_thread_ctx_t
 Per-thread scheduling context. More...
 
struct  sched_cpu_ctx_t
 Per-CPU scheduling context. More...
 

Typedefs

typedef struct process process_t
 
typedef struct thread thread_t
 

Enumerations

enum  schedule_flags_t {
  SCHED_NORMAL = 0 ,
  SCHED_DIE = 1 << 0
}
 Scheduling flags. More...
 

Functions

void sched_thread_ctx_init (sched_thread_ctx_t *ctx)
 Initializes a thread's scheduling context.
 
void sched_cpu_ctx_init (sched_cpu_ctx_t *ctx, cpu_t *self)
 Initializes a CPU's scheduling context.
 
NORETURN void sched_idle_loop (void)
 The idle loop for a CPU.
 
NORETURN void sched_done_with_boot_thread (void)
 Specify that the boot thread is no longer needed.
 
uint64_t sched_nanosleep (clock_t timeout)
 Puts the current thread to sleep.
 
bool sched_is_idle (cpu_t *cpu)
 Checks if the CPU is idle.
 
thread_tsched_thread (void)
 Retrieves the currently running thread.
 
process_tsched_process (void)
 Retrieves the process of the currently running thread.
 
thread_tsched_thread_unsafe (void)
 Retrieves the currently running thread without disabling interrupts.
 
process_tsched_process_unsafe (void)
 Retrieves the process of the currently running thread without disabling interrupts.
 
_NORETURN void sched_process_exit (uint64_t status)
 Exits the current process.
 
_NORETURN void sched_thread_exit (void)
 Exits the current thread.
 
void sched_yield (void)
 Yields the CPU to another thread.
 
void sched_push (thread_t *thread, cpu_t *target)
 Pushes a thread onto a scheduling queue.
 
void sched_push_new_thread (thread_t *thread, thread_t *parent)
 Pushes a newly created thread onto the scheduling queue.
 
void sched_invoke (interrupt_frame_t *frame, cpu_t *self, schedule_flags_t flags)
 The main scheduling function.
 

Typedef Documentation

◆ process_t

typedef struct process process_t

Definition at line 10 of file sched.h.

◆ thread_t

typedef struct thread thread_t

Definition at line 11 of file sched.h.