2024-01-22 10:12:47
This commit is contained in:
48
UNB/Year 4/Semester 1/CS3418/9-20-2023.md
Normal file
48
UNB/Year 4/Semester 1/CS3418/9-20-2023.md
Normal file
@@ -0,0 +1,48 @@
|
||||
Lecture Topic: Processes
|
||||
Parts of memory
|
||||
- Stack
|
||||
- Heap
|
||||
- Program Counter
|
||||
- Registers
|
||||
- Arguments Vector
|
||||
- Environment PATH
|
||||
|
||||
| Stack Layout |
|
||||
| ------------------------------ |
|
||||
| argv, argc |
|
||||
| stack |
|
||||
| heap |
|
||||
| uninitialized global variables |
|
||||
| initialized global variables |
|
||||
| text |
|
||||
|
||||
Heap Memory, only the result of calls to malloc or calloc
|
||||
Stack Memory, anything else, even pointers or custom typedefs, unless it was specifically allocated
|
||||
|
||||
Possible Process States
|
||||
- New: First Stage, when the OS loads the program and before it is given CPU cycles
|
||||
- Ready: When the program is ready to execute and has been added to the OS queue for execution
|
||||
- Running: The program is executing instructions on the CPU
|
||||
- Waiting: The program is waiting for CPU cycles or is dormant, either due to timeout or waiting for IO or events
|
||||
- Terminated: The program memory is unallocated and revoked. Can be invoked by program itself or by parent (includes OS)
|
||||
|
||||
Process Control Block or Task Control Block
|
||||
- Process state
|
||||
- Program counter
|
||||
- Scheduling information
|
||||
- Memory info
|
||||
- Accounting info
|
||||
- IO status info (fds, etc)
|
||||
In Linux this is implemented with a structure called `task_struct`
|
||||
|
||||
It's organized in a Linked List, it's used for scheduling.
|
||||
|
||||
The process scheduler, selects which process get CPU attention, with the goal of improving response time, as well as multiprorgramming.
|
||||
|
||||
Maintained Queues
|
||||
- Waiting Queue
|
||||
- Ready Queue
|
||||
|
||||
Processes could be CPU bound or IO bound
|
||||
|
||||
In general 100% utilization (CPU, IO) is not bad
|
Reference in New Issue
Block a user