Handles processes and multitasking.
More...
Handles processes and multitasking.
- Author
- Craig Edwards (craig.nosp@m.edwa.nosp@m.rds@b.nosp@m.rain.nosp@m.box.c.nosp@m.c)
- Copyright
- Copyright (c) 2012-2023
◆ cpu_id_t
◆ gid_t
◆ pid_t
◆ proc_idle_timer_t
| typedef void(* proc_idle_timer_t) (void) |
◆ uid_t
◆ idle_type_t
Types of idle task.
| Enumerator |
|---|
| IDLE_FOREGROUND | |
| IDLE_BACKGROUND | |
◆ process_state_t
Represents the current state of a process.
| Enumerator |
|---|
| PROC_RUNNING | |
| PROC_IDLE | |
| PROC_DELET | |
◆ init_process()
◆ proc_cur()
Return detail of current process.
- Returns
- process_t* process detail or NULL if no current process
◆ proc_ended()
Returns true if the program has ended.
- Parameters
-
- Returns
- int true if ended
◆ proc_find()
Find a process by ID.
- Parameters
-
- Returns
- process_t* process detail or NULL if not found
◆ proc_id()
| pid_t proc_id |
( |
int64_t |
index | ) |
|
Returns the id of a process by index number.
- Parameters
-
| index | index number of process to find between 0 and proc_total() |
- Returns
- pid_t process id
◆ proc_kill()
Kill a process.
- Parameters
-
◆ proc_kill_id()
| bool proc_kill_id |
( |
pid_t |
id | ) |
|
Kill a process by ID.
- Note
- Cannot be used to kill the current process from itself!
- Parameters
-
- Returns
- true if found and killed
◆ proc_load()
| process_t* proc_load |
( |
const char * |
fullpath, |
|
|
struct console * |
cons, |
|
|
pid_t |
parent_pid, |
|
|
const char * |
csd |
|
) |
| |
Load a new BASIC process.
- Parameters
-
| fullpath | fully qualified path to file |
| cons | console |
| parent_pid | parent PID, or 0 |
| csd | Currently selected directory |
- Returns
- process_t* new process details
◆ proc_loop()
Run the process scheduling loop.
- Note
- Does not return
◆ proc_register_idle()
Register a function to be called periodically during idle time.
- Parameters
-
| handler | handler function, void(void) |
| type | type of idle to register |
◆ proc_run()
Run BASIC program for one atomic cycle.
- Parameters
-
◆ proc_set_csd()
| const char* proc_set_csd |
( |
process_t * |
proc, |
|
|
const char * |
csd |
|
) |
| |
Change CSD (currently selected directory) of process.
- Note
- No validation of the path is peformed, this must be done extnerally to this function by validating the file information on VFS.
- Parameters
-
| proc | Process struct |
| csd | current directory |
- Returns
- const char* new current directory
◆ proc_show_list()
Display a diagnostic list of all processes.
◆ proc_timer()
Change to next scheduled process.
- Note
- Uses the round robin scheduling algorithm
◆ proc_total()
Returns the total number of running processes.
- Returns
- int64_t number of running processes
◆ proc_wait()
Mark a process as waiting for another process to complete.
- Parameters
-
| proc | process to mark as waiting |
| otherpid | other process ID to wait on, must exist. |