Autosave: 2024-06-26 06:15:05
This commit is contained in:
parent
bbb48c995d
commit
db4140c321
3 changed files with 25 additions and 10 deletions
BIN
.zk/notebook.db
BIN
.zk/notebook.db
Binary file not shown.
|
@ -9,7 +9,8 @@ created: Friday, June 21, 2024
|
|||
|
||||
Programs are sequences of machine instructions stored in a file. However they do
|
||||
not work by themselves. Something needs to load the file's intructions into
|
||||
memory and direct the CPU to run the program. The OS does this via processes.
|
||||
memory, direct the CPU to run the program and manage it during runtime. The OS
|
||||
does this via processes.
|
||||
|
||||
A process **is a running instance of a given program**. It can be thought of as
|
||||
a container in which a program runs. This container includes:
|
||||
|
@ -18,9 +19,9 @@ a container in which a program runs. This container includes:
|
|||
- a memory address
|
||||
- other information about the state of the process
|
||||
|
||||
Other than the `init` process started by the kernel (PID1), every process has a
|
||||
parent process that started it. This parent-child relationship creates a tree of
|
||||
processes.
|
||||
Other than the `init` process started by the kernel (PID1) (see
|
||||
), every process has a parent process that started it.
|
||||
This parent-child relationship creates a tree of processes.
|
||||
|
||||
It is possible that a parent process will terminate before one of its child
|
||||
processes. In this instance the child becomes an orphan. When this occurs in
|
||||
|
@ -44,8 +45,13 @@ For instance here, `terminator` is a child of `init`, as are `zsh` and `tmux`
|
|||
but they are also children of `terminator`.`pstree` is a child of `zsh` and
|
||||
therefore also a child (grandchild) of `terminator`.
|
||||
|
||||
Each process has a unique identifier called a _process identifier_, a
|
||||
_processID_ or just _PID_.
|
||||
|
||||
## Related notes
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
|
|
@ -1,18 +1,27 @@
|
|||
---
|
||||
id: zadl
|
||||
title: Threads
|
||||
tags: []
|
||||
tags: [operating-systems]
|
||||
created: Wednesday, June 26, 2024
|
||||
---
|
||||
|
||||
# Threads
|
||||
|
||||
A process is a running instance of a given program. A program runs sequentially
|
||||
handling one task at a time, however we may need to run certain tasks in
|
||||
parallel.
|
||||
A  is a running instance of a given program. A program
|
||||
runs sequentially handling one task at a time, however we may need to run
|
||||
certain tasks in parallel.
|
||||
|
||||
For example think of a program that is downloading a resource from the internet
|
||||
and wants to update the UI at the same time to show the download process.
|
||||
Think of a program that is downloading a resource from the internet and wants to
|
||||
update the UI at the same time to show the download process.
|
||||
|
||||
If the program is strictly sequential, once the program starts the download, the
|
||||
UI is neglected since the CPU time dedicated to the process must be focused
|
||||
elsewhere.
|
||||
|
||||
We need the updating of the UI and the download to execute in parallel. This is
|
||||
achieved via operating system **threads of execution**.
|
||||
|
||||
> A thread is a schedulable unit of execution within a process.
|
||||
|
||||
## Related notes
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue