diff options
| author | mo khan <mo@mokhan.ca> | 2021-03-22 20:33:16 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2021-03-22 20:33:16 -0600 |
| commit | 491623c9c6eb612eb51d14c0719c8d1f01727320 (patch) | |
| tree | 100a3a9b9a05374dcef9fe450d9a4120dcd5f6a4 /doc | |
| parent | 805965979ac6cdd1ad117df0ccd3b98829af488e (diff) | |
Add notes on chapter 3
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/3.md | 71 |
1 files changed, 70 insertions, 1 deletions
@@ -54,4 +54,73 @@ A process is an active entityt with a program counter specifying the next instru to execute and a set of associated resources. A program becomes a process when an executable file is loaded into memory. -Two processes may be associated + +### Process State + +As a process executes, it changes state. The state of a process is defined in part by +the current activity of that process. It may be in one of the following states: + +* New: The process is being created +* Running: Instructions are being executed +* Waiting: The process is waiting for some event to occur (such as an I/O completion or reception of a signal) +* Ready: The process is waiting to be assigned to a processor +* Terminated: The process has finished execution. + +``` +------- -------------- +| new |-- admitted |-->| terminated | +------- | -- interrupt - | -------------- + V | | | exit + --------- | ----------- + | ready |<-| |--->| running | + --------- | ----------- + A |-- scheduler | + | dispatch | +I/O complete | | I/O wait + | | + | ----------- | + -----| waiting |<---| + ----------- +``` + +### Process Control Block + +Each process is represented in the operating system by a process control block (PCB) -- also called a `task control block`. +It serves as the repository for any information that may vary from process to process. + +* Process state: The state may be new, ready, running, waiting, halted etc. +* Program counter: The counter indicates the address of the next instruction to be executed for this process. +* CPU registers: The registers vary in number and type, depending on the computer architecture. + * include accumulators, index registers, stack pointers, and general purpose registers, plus any conditional code information. +* CPU-scheduling information: This information includes a process priority, pointers to scheduling queues, and any other scheduling parameters. +* Memory-management information: includes value of the base and limit registers and the page tables, or the segment tables, depending on the memory system used by the operating system. +* Account information: includes the amount of CPU and real time used, time limits, account numbers, job or process numbers etc. +* I/O status info: includes the list of I/O devices allocated to the process, a lit of open files, and so on. + +```plaintext +Process Control Block + + ---------------------- + | process state | + ---------------------- + | process number | + ---------------------- + | program counter | + ---------------------- + | | + | | + | registers | + | | + | | + ---------------------- + | memory limits | + ---------------------- + | list of open files | + ---------------------- + | | + | ... | + | | + ---------------------- +``` + +### Threads |
