OS - Process (Main Thread) / Program
About
A process is the first thread started (called the main thread). It's the only thread that is authorized to start a new threads.
A process is a unit of resources, while a thread is a unit of:
- scheduling
- and execution.
A process is also known as:
- a task (ie Task Manager).
- running programs
Creating or destroying a process is relatively expensive, as resources must be acquired or released.
Processes are often seen as synonymous with programs or applications. However, what the user sees as a single application may in fact be a set of cooperating processes (ie a system)
OS
Process in a OS context
Management
Creation
A process is an instance of a executable file created via a command.
Processor
Which processor are allowed to run the process ? See Hardware - NUMA node (Affinity)
Id
State
Environment
Time
Process time are CPU time
Communication
- Between process: Processes can communicate each other on the same or on different systems through Inter Process Communication (IPC) resources, such as pipes and sockets.
- With the OS: OS - System Call (Process OS communication)
Vizualization
Watch Dog
Monitoring
- Process / Thread - Procmon (Process Monitor) can capture network event. See Network Monitoring Procmon
strace
OS - strace (Interactions between processes and the Linux kernel)
To start and monitor an new process:
strace -f -e trace=network -s 10000 PROCESS ARGUMENTS
To monitor an existing process with a known PID:
strace -p $PID -f -e trace=network -s 10000
Call Stack
There is usually exactly one call stack associated with a running process (or thread)
Priority
The priority of a web server:
where:
Kill
Windows and wmic
wmic process where CommandLine like '%${project.artifactId}%' and not name='wmic.exe' delete
REM or
wmic PROCESS WHERE NAME="CALC.EXE" DELETE
Thread
A process may start zero or many threads.
Example: in Process Explorer
Documentation / Reference
- See also Vol 3 - Chapter 7 - Task Management - https://software.intel.com/en-us/articles/intel-sdm