- Main Page
- Data Structures
- Files
- Directories

- Search for |

- File List
- Globals

# sched.c File Reference

`#include <ubixos/sched.h>`
`#include <ubixos/kpanic.h>`
`#include <ubixos/spinlock.h>`
`#include <ubixos/endtask.h>`
`#include <vfs/mount.h>`
`#include <lib/kmalloc.h>`
`#include <lib/kprintf.h>`
`#include <vmm/vmm.h>`
`#include <sys/gdt.h>`
`#include <sys/idt.h>`
`#include <sys/kern_descrip.h>`
`#include <isa/8259.h>`
`#include <string.h>`
`#include <assert.h>`

Include dependency graph for sched.c:

Go to the source code of this file.

## Functions
void | sched ()
int | sched_addDelTask (kTask_t *tmpTask)
int | sched_deleteTask (pidType id)
kTask_t * | sched_getDelTask ()
int | sched_init ()
int | sched_setStatus (pidType pid, tState state)
void | sched_yield ()
void | schedEndTask (pidType pid)
kTask_t * | schedFindTask (uInt32 id)
kTask_t * | schedNewTask ()
## Variables
kTask_t * | _current = 0x0
kTask_t * | _usedMath = 0x0
static kTask_t * | delList = 0x0
static uInt32 | nextID = -1
static spinLock_t | schedulerSpinLock = SPIN_LOCK_INITIALIZER
static kTask_t * | taskList = 0x0

## 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 * | tmpTask | ) |

Definition at line 194 of file sched.c.

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

Referenced by sched().

int sched_deleteTask | ( | pidType | id | ) |

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 | pid,
|  | tState | state |
| ) |  |  |

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 = 0x0

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 = 0x0

Definition at line 52 of file sched.c.

Referenced by mathStateRestore().

kTask_t* delList = 0x0`[static]`

Definition at line 48 of file sched.c.

Referenced by sched_addDelTask(), and sched_getDelTask().

uInt32 nextID = -1`[static]`

Definition at line 49 of file sched.c.

Referenced by sched_init(), and schedNewTask().

spinLock_t schedulerSpinLock = SPIN_LOCK_INITIALIZER`[static]`

Definition at line 54 of file sched.c.

Referenced by sched(), and schedNewTask().

kTask_t* taskList = 0x0`[static]`

Definition at line 47 of file sched.c.

Referenced by sched_deleteTask(), sched_init(), schedFindTask(), and schedNewTask().