![]() |
Max OS 0.3
|
A process that can be scheduled by the Scheduler, wraps & manages threads as well as its own address space and resources. More...
#include <process.h>
Public Member Functions | |
| Process (const string &name, bool is_kernel=false) | |
| Base Constructor for the Process. | |
| Process (const string &name, void(*_entry_point)(void *), void *args, int arg_amount, bool is_kernel=false) | |
| Constructor for the Process class (from a function) | |
| Process (const string &name, void *args, int arg_amount, ELF64 *elf, bool is_kernel=false) | |
| Constructor for the Process class (from an elf, will free the elf memory after loading) | |
| ~Process () | |
| Destructor for the Process class. | |
| common::Vector< Thread * > | threads () |
| Gets the threads of the process. | |
| void | add_thread (Thread *thread) |
| Adds a thread to the process. | |
| void | remove_thread (uint64_t tid) |
| Remove a thread by its tid (NOTE: this will not remove it from the scheduler) | |
| void | set_pid (uint64_t pid) |
| Sets the pid of the process once added to the queue. | |
| uint64_t | pid () const |
| Gets the pid of the process. | |
| uint64_t | total_ticks () |
| Gets the total ticks of the threads in the process (not this does not include any past killed threads) | |
Public Attributes | |
| bool | is_kernel |
| Whether this process is a kernel process. | |
| string | name |
| The name of the process. | |
| string | working_directory = "/" |
| The working directory of the process. | |
| memory::MemoryManager * | memory_manager = nullptr |
| The manager for memory used by this process. | |
| ResourceManager | resource_manager |
| The manger for resources used by this process. | |
A process that can be scheduled by the Scheduler, wraps & manages threads as well as its own address space and resources.
Base Constructor for the Process.
| p_name | The name of the process |
| is_kernel | If the process is a kernel process |
Definition at line 181 of file process.cpp.
References is_kernel, memory_manager, and MaxOS::memory::MemoryManager::s_kernel_memory_manager.
| Process::Process | ( | const string & | p_name, |
| void(*)(void *) | _entry_point, | ||
| void * | args, | ||
| int | arg_amount, | ||
| bool | is_kernel = false |
||
| ) |
Constructor for the Process class (from a function)
| p_name | The name of the process |
| _entry_point | The entry point of the process |
| args | The arguments to pass to the process |
| arg_amount | The amount of arguments |
| is_kernel | If the process is a kernel process |
Definition at line 198 of file process.cpp.
References add_thread().
| Process::Process | ( | const string & | p_name, |
| void * | args, | ||
| int | arg_amount, | ||
| ELF64 * | elf, | ||
| bool | is_kernel = false |
||
| ) |
Constructor for the Process class (from an elf, will free the elf memory after loading)
| p_name | The name of the process |
| args | The arguments to pass to the process |
| arg_amount | The amount of arguments |
| elf | The elf file to load the process from |
| is_kernel | If the process is a kernel process |
Definition at line 218 of file process.cpp.
References add_thread().
| Process::~Process | ( | ) |
Destructor for the Process class.
Definition at line 235 of file process.cpp.
References MaxOS::Logger::DEBUG(), is_kernel, memory_manager, name, and MaxOS::memory::PhysicalMemoryManager::s_current_manager.
Adds a thread to the process.
| thread | The thread to add |
Definition at line 256 of file process.cpp.
References MaxOS::common::Spinlock::lock(), and MaxOS::common::Spinlock::unlock().
| uint64_t Process::pid | ( | ) | const |
Gets the pid of the process.
Definition at line 326 of file process.cpp.
Referenced by MaxOS::processes::Scheduler::current_process(), MaxOS::processes::GlobalScheduler::force_remove_process(), MaxOS::processes::Scheduler::get_process(), MaxOS::processes::GlobalScheduler::remove_process(), and set_pid().
Remove a thread by its tid (NOTE: this will not remove it from the scheduler)
| tid |
Definition at line 272 of file process.cpp.
Referenced by MaxOS::processes::Scheduler::force_remove_process(), and MaxOS::processes::Scheduler::schedule_next().
Sets the pid of the process once added to the queue.
| pid |
Definition at line 296 of file process.cpp.
References pid().
Referenced by MaxOS::processes::Scheduler::add_process().
Gets the threads of the process.
Definition at line 316 of file process.cpp.
Referenced by MaxOS::processes::Scheduler::add_process(), MaxOS::processes::Scheduler::force_remove_process(), MaxOS::processes::Scheduler::remove_process(), and MaxOS::processes::Scheduler::schedule_next().
| uint64_t Process::total_ticks | ( | ) |
Gets the total ticks of the threads in the process (not this does not include any past killed threads)
Definition at line 336 of file process.cpp.
References total_ticks().
Referenced by total_ticks().
| bool MaxOS::processes::Process::is_kernel |
Whether this process is a kernel process.
Definition at line 107 of file process.h.
Referenced by Process(), and ~Process().
| memory::MemoryManager* MaxOS::processes::Process::memory_manager = nullptr |
The manager for memory used by this process.
Definition at line 112 of file process.h.
Referenced by Process(), and ~Process().
| string MaxOS::processes::Process::name |
The name of the process.
Definition at line 109 of file process.h.
Referenced by MaxOS::processes::GlobalScheduler::add_process(), and ~Process().
| ResourceManager MaxOS::processes::Process::resource_manager |
| string MaxOS::processes::Process::working_directory = "/" |