vault backup: 2022-09-21 14:09:30

This commit is contained in:
Jet Hughes 2022-09-21 14:09:30 +12:00
parent 354decc348
commit 823f0d3b4b
2 changed files with 48 additions and 2 deletions

View File

@ -41,7 +41,7 @@ system program types include.,
also runs in user space
## system calls
# system calls
processes issue requests to the kernel by making system calls
![system call diagram|300](https://i.imgur.com/GAktF7t.png)
@ -105,6 +105,51 @@ generated by:
a system call generates an interrupt and the OS transfers control to a system call handler
### data structure of kernel process
# Processes
a process is dynamic
a given program can be executing many times of a given machines: each instance is a separate process
process components
- text section/code section: the program code itself
- data section: any global variables used by the program
- process stack: any local variables currently being used
- program counter: a pointer to some place in the program code
- contents of CPU registers
- memory management information
- device/file allocation information
- accounting information
## process control blocks
the OS keeps a record of each process in the system, with a data structure called *process control block* (PCB)
![example block|400](https://i.imgur.com/UTDFjse.png)
![example linux processes|400](https://i.imgur.com/ar19swB.png)
## scheduling processes
processes take turns to run on the CPU. processes wait to run in one of two queues:
- ready queue: process ready to execute
- device queue: processes waiting to use a particular device. (one queue per device)
generally represented as linked lists
## flow of processes
![process flow diagram|400](https://i.imgur.com/ib1t78H.png)
Rounded rectangles are events.
Rectangles are queues where processes wait.
Circles are processing resources that serve the events/queues.
## process creation
created by another process: parent process creates a child process
- process can copy itself using fork
- child process can then call exec() to load a new program
- a child process can run concurrently with parent
- child process can share the resources of its parent if not restricted
system start with one process called *init*
## procees heirarchy
processes for a tree
![process tree diagram|400](https://i.imgur.com/SNTlCNZ.png)

View File

@ -42,6 +42,7 @@ tags:
- [11-struct-and-union](notes/11-struct-and-union.md)
- [12-pointers-to-routines](notes/12-pointers-to-routines.md)
- [13-OS-intro](notes/13-OS-intro.md)
- [14-processes-and-system-calls](notes/14-processes-and-system-calls.md)
# Archive