Processes

From AMC-OS Developers
Jump to navigation Jump to search

Process definition in AMC-OS

A process is an instance of an application. Processes are managed in AMC-OS by the PSI (Processes System Interface) module.

It is characterized by :

  • a process ID (PID) and its parent process ID
  • an owner (User ID)
  • a list of execution threads
  • a page directory defining the address space used by all execution threads
  • all resource handles shared by all threads in the process.

PSI (Processes System Interface)

Each process is defined by a PSI_ENTRY containing all process information.

PID

A PID is a 16-bit unsigned integer, uniquely assigned to each process, with a maximum of PSI_MAX_PROCESSES. PSI maintains a linked list of unsorted used and free PIDs, allowing allocation and release of PIDs in O(1), by respectively removing or adding the PID at the beginning of the list. Both list share the same global table called StatusTable with two initial pointers, one for the linked list of free entries (firstFreeEntry), one for the linked list of used entries (firstUsedEntry).

Internal functions for PID management are :

  • PID PSI_AllocatePID(PSI_ENTRY *)
  • void PSI_ReleasePID(PID)

To get the PSI_ENTRY for a specific PID, an index table called PSI_QuickTable is maintained.