# sched.h File Reference

`#include <ubixos/types.h>`
`#include <ubixos/tty.h>`
`#include <vfs/file.h>`
`#include <sys/tss.h>`
`#include <sys/thread.h>`

Include dependency graph for sched.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | osInfo
struct | taskStruct

## Typedefs

typedef taskStruct | kTask_t

## Enumerations

enum | tState { PLACEHOLDER = -2, DEAD = -1, NEW = 0, READY = 1, RUNNING = 2, IDLE = 3, FORK = 4, WAIT = 5 }

## Functions

void | sched ()
int | sched_addDelTask (kTask_t *)
int | sched_deleteTask (pidType)
kTask_t * | sched_getDelTask ()
int | sched_init ()
int | sched_setStatus (pidType, tState)
void | sched_yield ()
void | schedEndTask (pidType pid)
kTask_t * | schedFindTask (uInt32 id)
kTask_t * | schedNewTask ()

## Variables

kTask_t * | _current
kTask_t * | _usedMath

## Typedef Documentation

typedef struct taskStruct kTask_t

## Enumeration Type Documentation

enum tState

Enumerator:

  PLACEHOLDER |
  DEAD |
  NEW |
  READY |
  RUNNING |
  IDLE |
  FORK |
  WAIT |

Definition at line 41 of file sched.h.

## Function Documentation

void sched | ( |  | ) |

Definition at line 84 of file sched.c.

References _current, DEAD, FORK, taskStruct::id, taskStruct::next, READY, sched_addDelTask(), sched_deleteTask(), schedulerSpinLock, spinTryLock(), and taskStruct::state.

Referenced by sched_yield().

Here is the call graph for this function:

int sched_addDelTask | ( | kTask_t * |  | ) |

Definition at line 194 of file sched.c.

References delList, taskStruct::next, and taskStruct::prev.

Referenced by sched().

int sched_deleteTask | ( | pidType |  | ) |

Definition at line 175 of file sched.c.

References taskStruct::id, taskStruct::next, taskStruct::prev, and taskList.

Referenced by sched().

kTask_t* sched_getDelTask | ( |  | ) |

Definition at line 203 of file sched.c.

References delList, and taskStruct::next.

Referenced by systemTask().

int sched_init | ( |  | ) |

Definition at line 69 of file sched.c.

References taskStruct::id, kmalloc(), kpanic(), kprintf(), nextID, and taskList.

Here is the call graph for this function:

int sched_setStatus | ( | pidType | ,
|  | tState |  |
| ) |  |  |

Definition at line 281 of file sched.c.

References schedFindTask(), taskStruct::state, and x1.

Referenced by endTask(), execFile(), and execThread().

Here is the call graph for this function:

void sched_yield | ( |  | ) |

Definition at line 259 of file sched.c.

References sched().

Referenced by _int0(), _int1(), _int10(), _int11(), _int12(), _int2(), _int3(), _int4(), _int5(), _int6(), _int9(), endTask(), fork_copyProcess(), schedEndTask(), spinLock(), sysFgetc(), sysSchedYield(), systemTask(), ubthread_cond_timedwait(), and ubthread_cond_wait().

Here is the call graph for this function:

void schedEndTask | ( | pidType | pid | ) |

Definition at line 241 of file sched.c.

References _current, endTask(), taskStruct::id, and sched_yield().

Here is the call graph for this function:

kTask_t* schedFindTask | ( | uInt32 | id | ) |

Definition at line 216 of file sched.c.

References taskStruct::id, taskStruct::next, and taskList.

Referenced by sched_setStatus(), sysCheckPid(), systemTask(), and vmmMapFromTask().

kTask_t* schedNewTask | ( |  | ) |

Definition at line 143 of file sched.c.

References file::f_flag, taskStruct::id, kmalloc(), kpanic(), memset(), NEW, taskStruct::next, nextID, thread::o_files, taskStruct::prev, schedulerSpinLock, spinLock(), spinUnlock(), taskStruct::state, taskList, taskStruct::td, and taskStruct::usedMath.

Referenced by biosCall(), execFile(), and execThread().

Here is the call graph for this function:

## Variable Documentation

kTask_t* _current

Definition at line 51 of file sched.c.

Referenced by __sysctl(), _int0(), _int1(), _int10(), _int11(), _int12(), _int13(), _int2(), _int3(), _int4(), _int5(), _int6(), _int8(), _int9(), biosCall(), elf_loadfile(), endTask(), execFile(), fork_copyProcess(), fstat(), getgid(), getpid(), getuid(), intNull(), kmod_load(), ldEnable(), mathStateRestore(), mmap(), mpi_createMbox(), mpi_destroyMbox(), mpi_fetchMessage(), mpi_postMessage(), obreak(), sched(), schedEndTask(), sys_exec(), syscall(), sysChDir(), sysExec(), sysExit(), sysFgetc(), sysFwrite(), sysGetCwd(), sysGetFreePage(), sysGetGid(), sysGetpid(), sysGetUid(), sysMkDir(), sysPasswd(), sysSetGid(), sysSetUid(), ubthread_mutex_lock(), ubthread_mutex_unlock(), ubthread_self(), vmm_pageFault(), vmm_remapPage(), vmmGetFreeVirtualPage(), and vmmMapFromTask().

kTask_t* _usedMath

Definition at line 52 of file sched.c.

Referenced by mathStateRestore().