Commit 8059659

mo khan <mo@mokhan.ca>
2021-03-20 20:04:16
add notes on chapter 3
1 parent 11ff529
Changed files (2)
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
src/party.c
@@ -4,6 +4,7 @@
 
 int party_init(void)
 {
+  // Use dmesg to view the log
   printk(KERN_INFO, "Start the Party!!!\n");
   return 0;
 }