Description
This functions provide general process handling. Creation, insertion into the
system, destruction, finding a certain process...
Details
create_process ()
proc_t* create_process (void); |
Do everything necesary to have a new process in the system.
new_process ()
proc_t* new_process (void); |
Allocate data for new process.
Note: the process will have to be inserted to have any efect.
insert_process ()
void insert_process (proc_t *proc); |
Inserts process proc in the system.
Note: proc can be obtained with new_process.
free_process ()
void free_process (proc_t *proc); |
Definitely free all data related to proc.
Note: proc will be gone for good.
destroy_process ()
gint destroy_process (proc_t *proc); |
Start considering proc a terminated process and remove it from the
system.
Note: the data of proc is not freed, and proc will be saved by
save_processes_to_file.
get_proc_by_pid ()
proc_t* get_proc_by_pid (gint pid); |
select_process ()
void select_process (proc_t *proc); |
Makes proc the selected process.
Note: some code will do things to the selected process.
get_CPU_selected_proc ()
proc_t* get_CPU_selected_proc (void); |
Find out which is the currently selected process
save_processes_to_file ()
void save_processes_to_file (void); |
Asks the user for a filename and saves all processes on the current
session to a file, ready to be loaded in a new session.
Note: Both terminated and not yet running processes will be written.
load_processes_from_file ()
void load_processes_from_file (void); |
Asks the user for a filename and loads all processes it can find it it.
Note: Not all processes will be visible at once, they will be inserted
at the right time.
burst()
#define burst(proc) (proc->next_event.time - proc->time) |
Calculates the current burst (time until next voluntary event) for proc.