name: Process Management API
description: System calls for process creation, execution, termination, and control.
image: https://kinlane-productions.s3.amazonaws.com/apis-json/apis-json-logo.jpg
humanURL: https://man7.org/linux/man-pages/man2/fork.2.html
baseURL: system://unix/process
tags:
- Execution
- Processes
- Scheduling
properties:
- type: Documentation
url: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fork.html
- type: GettingStarted
url: https://sourceware.org/glibc/manual/
- type: APIReference
url: https://man7.org/linux/man-pages/man2/fork.2.html
operations:
- name: fork
description: Create a new process by duplicating the calling process
parameters: []
returns: PID of child (in parent), 0 (in child), -1 on error
- name: exec
description: Execute a program (family of functions - execl, execv, execve, etc.)
parameters:
- pathname
- argv
- envp
returns: does not return on success, -1 on error
- name: wait
description: Wait for process to change state
parameters:
- status
returns: PID of terminated child
- name: waitpid
description: Wait for specific process to change state
parameters:
- pid
- status
- options
returns: PID of child
- name: exit
description: Terminate the calling process
parameters:
- status
returns: does not return
- name: _exit
description: Terminate the calling process immediately without cleanup
parameters:
- status
returns: does not return
- name: getpid
description: Get process ID
parameters: []
returns: process ID
- name: getppid
description: Get parent process ID
parameters: []
returns: parent process ID
- name: kill
description: Send signal to a process
parameters:
- pid
- sig
returns: 0 on success, -1 on error
- name: nice
description: Change process priority
parameters:
- inc
returns: new nice value
- name: setpgid
description: Set process group ID
parameters:
- pid
- pgid
returns: 0 on success, -1 on error
- name: getpgid
description: Get process group ID
parameters:
- pid
returns: process group ID
- name: setsid
description: Create a new session and set process group ID
parameters: []
returns: session ID of new session
- name: getrlimit
description: Get resource limits for the process
parameters:
- resource
- rlim
returns: 0 on success, -1 on error
- name: setrlimit
description: Set resource limits for the process
parameters:
- resource
- rlim
returns: 0 on success, -1 on error
- name: alarm
description: Set an alarm clock for delivery of a signal
parameters:
- seconds
returns: remaining seconds of previous alarm
- name: pause
description: Wait for a signal
parameters: []
returns: -1 with errno set to EINTR
- name: posix_spawn
description: Spawn a new process without fork (POSIX.1-2001)
parameters:
- pid
- path
- file_actions
- attrp
- argv
- envp
returns: 0 on success, error number on failure