os-k/kaleid/include/kernel/kernsched.h

103 lines
2.7 KiB
C

//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Authors: spectral` //
// NeoX //
// //
// Desc: Scheduler header //
//----------------------------------------------------------------------------//
//------------------------------------------//
// Dependencies //
//------------------------------------------//
#ifndef _KALKERN_BASE_H
#include "kernbase.h"
#endif
#ifndef _KALLIST_H
#include <common/kallist.h>
#endif
//------------------------------------------//
// Start of header //
//------------------------------------------//
#ifndef _KALKERN_SCHED_H
#define _KALKERN_SCHED_H
//------------------------------------------//
// Preprocessor //
//------------------------------------------//
#define printdbg printf
#define _STR(x) #x
#define _XSTR(x) _STR(x)
//
// States for a process
//
#define STATE_RUNNING 0
#define STATE_RUNNABLE 1
#define STATE_BLOCKED 2
//
// Time in ticks a process should be run
//
#define DEF_PROC_TSLICE 5 // 20 ticks
#define TCR_PROC_TSLICE 20000 // 20000 ticks (time critical)
//------------------------------------------//
// List heads //
//------------------------------------------//
DECLARE_PER_CPU(IdlePrioProcs, ListHead_t *);
DECLARE_PER_CPU(ReglPrioProcs, ListHead_t *);
DECLARE_PER_CPU(ServPrioProcs, ListHead_t *);
DECLARE_PER_CPU(TimeCritProcs, ListHead_t *);
//------------------------------------------//
// Data types //
//------------------------------------------//
//
// A process
//
typedef struct sProcess_t{
// Identifier
int pid;
// Current priority class
int prioClass;
// Default priority class (without boosts)
int defPrioClass;
// Current priority level
int prioLevel;
// Default priority level
int defPrioLevel;
// Current state
int procState;
// Remaining time running
ulong timeSlice;
// Default time-slice
ulong defTimeSlice;
// Scheduler internals
ListNode_t *schedNode;
} Process_t;
//------------------------------------------//
// End of header //
//------------------------------------------//
#endif