OS - Process (Main Thread)

> Operating System - Kernel (Windows, Unix, Linux) > OS - Process (Main Thread)

1 - 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:

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)

Advertising

3 - OS

Process in a OS context

4 - Management

4.1 - Creation

A process is an instance of a executable file created via a command.

4.2 - Processor

Which processor are allowed to run the process ? See Hardware - NUMA node (Affinity)

4.3 - Id

4.4 - State

Advertising

4.5 - Environment

4.6 - Time

Process time are CPU time

4.7 - Communication

4.8 - Vizualization

4.9 - Watch Dog

4.10 - Monitoring

4.10.1 - 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
Advertising

4.11 - Call Stack

There is usually exactly one call stack associated with a running process (or thread)

4.12 - Priority

4.13 - 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

4.14 - Thread

A process may start zero or many threads.

Example: in Process Explorer

Advertising

5 - Documentation / Reference