proc.c File Reference
Simple cooperative multitasking scheduler. More...
#include "proc_p.h"
#include "proc.h"
#include "cfg/cfg_proc.h"
#include <cfg/log.h>
#include "cfg/cfg_arch.h"
#include "cfg/cfg_monitor.h"
#include <cfg/macros.h>
#include <cfg/module.h>
#include <cfg/depend.h>
#include <cpu/irq.h>
#include <cpu/types.h>
#include <cpu/attr.h>
#include <cpu/frame.h>
#include <string.h>
Go to the source code of this file.
Functions | |
| void | proc_init (void) |
| Initialize the process subsystem (kernel). | |
| struct Process * | proc_new_with_name (UNUSED_ARG(const char *, name), void(*entry)(void), iptr_t data, size_t stack_size, cpu_stack_t *stack_base) |
| Create a new process, starting at the provided entry point. | |
| const char * | proc_name (struct Process *proc) |
| Return the name of the specified process. | |
| const char * | proc_currentName (void) |
| Return the name of the currently running process. | |
| void | proc_rename (struct Process *proc, const char *name) |
| Rename a process. | |
| void | proc_setPri (struct Process *proc, int pri) |
| Change the scheduling priority of a process. | |
| void | proc_exit (void) |
| Terminate the current process. | |
| iptr_t | proc_currentUserData (void) |
| Get the pointer to the user data of the current process. | |
Variables | |
| REGISTER List | ProcReadyList |
| Track ready processes. | |
| REGISTER Process * | CurrentProcess |
| Track running processes. | |
| struct Process | MainProcess |
| The main process (the one that executes main()). | |
Detailed Description
Simple cooperative multitasking scheduler.
- Version:
- Id
- proc.c 2953 2009-09-16 13:51:30Z lottaviano
Definition in file proc.c.
Function Documentation
| iptr_t proc_currentUserData | ( | void | ) |
| void proc_exit | ( | void | ) |
| void proc_init | ( | void | ) |
| const char* proc_name | ( | struct Process * | proc | ) |
| struct Process* proc_new_with_name | ( | UNUSED_ARG(const char *, name) | , | |
| void(*)(void) | entry, | |||
| iptr_t | data, | |||
| size_t | stack_size, | |||
| cpu_stack_t * | stack_base | |||
| ) | [read] |
Create a new process, starting at the provided entry point.
- Note:
- The function is a more convenient way to create a process, as you don't have to specify the name.
proc_new(entry, data, stacksize, stack)
- Returns:
- Process structure of new created process if successful, NULL otherwise.
| void proc_setPri | ( | struct Process * | proc, | |
| int | pri | |||
| ) |
Change the scheduling priority of a process.
Process piorities are signed ints, whereas a larger integer value means higher scheduling priority. The default priority for new processes is 0. The idle process runs with the lowest possible priority: INT_MIN.
A process with a higher priority always preempts lower priority processes. Processes of equal priority share the CPU time according to a simple round-robin policy.
As a general rule to maximize responsiveness, compute-bound processes should be assigned negative priorities and tight, interactive processes should be assigned positive priorities.
To avoid interfering with system background activities such as input processing, application processes should remain within the range -10 and +10.
Variable Documentation
| REGISTER Process* CurrentProcess |
| struct Process MainProcess |
| REGISTER List ProcReadyList |
