diff options
| author | mo khan <mo@mokhan.ca> | 2021-03-20 14:04:16 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2021-03-20 14:04:16 -0600 |
| commit | 805965979ac6cdd1ad117df0ccd3b98829af488e (patch) | |
| tree | 68396d83e2ef6aa9755e290b166e77d1d336ae56 /doc | |
| parent | 11ff529d60c1aaec2d68df211fdf556390da55f8 (diff) | |
add notes on chapter 3
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/3.md | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/doc/3.md b/doc/3.md new file mode 100644 index 0000000..2f1a471 --- /dev/null +++ b/doc/3.md @@ -0,0 +1,57 @@ +# Chapter 3 - Processes + +The process is the unit of work in a modern time-sharing system. +A system consists of a collection of processes: operating system processes +executing system code and user processes executing user code. + +Potentially, all these processes can execute concurrently, with the CPU +multiplexed among them. By switching the CPU between processes, the +operating system can make the computer more productive. + +A batch system executes `jobs`. +A time-shared system has `user programs` or `tasks`. + +All these activities are similar so we call them `processes`. + +## The Process + +A process is more than the program code, also known as the `text section`. +It also includes the current activity, represented by a value of the `program counter` +and the contents of the processor's registers. + +A process also includes the process `stack`, which contains temporary data (such +as function params, return addresses, and local variables) and a `data section` which +contains global variables. + +A process may also include a `heap`, which is memory that is dynamically allocated +during process run time. + +```plaintext + max |-------| + | Stack | + |-------| + | | | + | | | + | V | + | | + | | + | A | + | | | + | | | + |-------| + | heap | + |-------| + | data | + |-------| + | text | + 0 |-------| +``` + +A program is not a process. A program is a file containing instructions stored on +disk like an `executable file`. + +A process is an active entityt with a program counter specifying the next instruction +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 |
