1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00
os-k/kaleid/include/kernel/kernsched.h
2019-01-19 22:36:38 +01:00

116 lines
3.0 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 //
//------------------------------------------//
//
// Debug stuff
//
#define printdbg printf
//
// 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 *);
extern const char *PrioClassesNames[];
//------------------------------------------//
// 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;
//------------------------------------------//
// Functions //
//------------------------------------------//
void SchedInit(void);
void SchedFini(void);
void SchedThisProc(Process_t *);
void SchedOnTick(void);
//------------------------------------------//
// End of header //
//------------------------------------------//
#endif