├── 1. Introduction to Operating Systems ├── Notes.md └── programs │ ├── concurrency.c │ ├── cpu.c │ ├── io.c │ └── memory.c ├── A Tour Of Computer Systems.md ├── Images ├── IMG_0496.jpeg ├── Pasted_image_20240812203747.png ├── Pasted_image_20240812204907.png ├── Pasted_image_20240813140913.png ├── Pasted_image_20240814164851.png ├── Pasted_image_20240814171737.png ├── Pasted_image_20240814171751.png ├── Pasted_image_20240814174255.png ├── Pasted_image_20240815213722.png ├── Pasted_image_20240914161843.png ├── Pasted_image_20240914170738.png ├── Pasted_image_20240920111656.png ├── Pasted_image_20240920170027.png ├── Pasted_image_20240922121416.png ├── Pasted_image_20240923163417.png ├── Pasted_image_20240924190622.png └── Pasted_image_20241023193041.png ├── Part I └── 4. The Abstraction : The Process │ └── Notes.md └── README.md /1. Introduction to Operating Systems/Notes.md: -------------------------------------------------------------------------------- 1 | #### Introduction to Operating System 2 | 3 | If you are not familiar with computer program you can read [Introduction to Computing Systems](https://icourse.club/uploads/files/96a2b94d4be48285f2605d843a1e6db37da9a944.pdf). It is a really comprehensive book to start your computer science journey if you have no idea about programming in general. 4 | 5 | Concepts learnt in the chapter: 6 | 7 | - Running program -> Executes several instructions per second. 8 | - Processor's job -> fetch from memory, decode, execute. 9 | - Von Neumann model of computing. 10 | - Virtualization of resources 11 | 12 | Crux of the problem. 13 | 14 | - How to virtualize processes? 15 | 16 | - Benefit of virtualization. 17 | - System calls for user interaction. 18 | - OS as a resource manager. 19 | 20 | ##### 2.1 Virtualizing the CPU 21 | 22 | ```c 23 | #include // for input/output functions 24 | #include // for exit function 25 | #include // for usleep function (used to create a delay) 26 | 27 | int main(int argc, char *argv[]) { // main function, starts the program 28 | if (argc != 2) { // checks if exactly one argument is passed 29 | fprintf(stderr, "usage: cpu \n"); // print usage info if not 30 | exit(1); // exit with an error code (1) if no argument is passed 31 | } 32 | 33 | char *str = argv[1]; // assign the passed argument to a variable `str` 34 | while (1) { // infinite loop, keeps running until you stop it manually 35 | usleep(1000000); // delay of 1 second (1,000,000 microseconds) 36 | printf("%s\n", str); // print the string stored in `str` 37 | } 38 | 39 | return 0; 40 | } 41 | ``` 42 | 43 | The above program prints something which is entered by the user as a command line argument. If we run multiple instances of this program on a single CPU, both start executing properly even with a single CPU. That is because OS along with the hardware creates this illusion of multiple CPUs and this is what we call virtualization of CPU. 44 | 45 | There are certain policies followed by the OS to avoid some conflicts which will be discussed in further chapters. 46 | 47 | ##### 2.2 Virtualizing the memory 48 | 49 | ```c 50 | #include // for printf function 51 | #include // for malloc and assert functions 52 | #include // for usleep function 53 | #include // for assert function 54 | 55 | int main(int argc, char *argv[]) { 56 | // Allocate memory dynamically for one integer 57 | int *p = malloc(sizeof(int)); 58 | 59 | // Check if memory allocation was successful 60 | assert(p != NULL); // if p is NULL, the program will terminate 61 | 62 | // Print the process ID and the address of the allocated memory 63 | printf("(%d) address pointed to by p: %p\n", getpid(), p); 64 | 65 | // Initialize the integer at the allocated memory to 0 66 | *p = 0; 67 | 68 | // Start an infinite loop to increment and print the integer value 69 | while (1) { 70 | usleep(1000000); // pause for 1 second (1,000,000 microseconds) 71 | 72 | *p = *p + 1; // increment the integer at the memory pointed to by p 73 | printf("(%d) p: %d\n", getpid(), *p); // print process ID and new value of *p 74 | } 75 | 76 | // Free the allocated memory (although this line is never reached due to infinite loop) 77 | free(p); 78 | 79 | return 0; // return 0 to indicate successful completion (never reached) 80 | } 81 | ``` 82 | 83 | The above program creates a slot in the main memory to store an integer type, then it prints the process id and address of the variable. It initially stores 0 in the variable. Finally the loop increments the value stored at the address held in p. 84 | 85 | If you run multiple instances of the program we observe same memory address being allocated to the programs. This is because of the virtual address space allocated to each process and the OS maps it to the physical memory of the machine. This is virtualization of memory. 86 | 87 | ##### 2.3 Concurrency 88 | 89 | ```c 90 | #include // for printf function 91 | #include // for atoi and exit functions 92 | #include // for pthread functions 93 | 94 | // Define a shared counter variable with `volatile` to indicate it may be modified concurrently 95 | volatile int counter = 0; 96 | int loops; // variable to store the number of loops each thread will execute 97 | 98 | // Worker function that each thread will execute 99 | void *worker(void *arg) { 100 | int i; 101 | // Loop `loops` times, incrementing the shared counter each time 102 | for (i = 0; i < loops; i++) { 103 | counter++; // increment the shared counter 104 | } 105 | return NULL; // thread function must return NULL since it’s of type `void *` 106 | } 107 | 108 | int main(int argc, char *argv[]) { 109 | // Check if the program received exactly one command-line argument 110 | if (argc != 2) { 111 | fprintf(stderr, "usage: threads \n"); // print usage message if not 112 | exit(1); // exit with error status if argument count is incorrect 113 | } 114 | 115 | // Convert the argument (string) to an integer and assign it to `loops` 116 | loops = atoi(argv[1]); 117 | 118 | // Declare two pthread_t variables to hold thread identifiers 119 | pthread_t p1, p2; 120 | 121 | // Print the initial value of `counter` (expected to be 0) 122 | printf("Initial value : %d\n", counter); 123 | 124 | // Create the first thread, passing `worker` as the function to execute 125 | pthread_create(&p1, NULL, worker, NULL); 126 | 127 | // Create the second thread, also running `worker` 128 | pthread_create(&p2, NULL, worker, NULL); 129 | 130 | // Wait for the first thread to finish execution 131 | pthread_join(p1, NULL); 132 | 133 | // Wait for the second thread to finish execution 134 | pthread_join(p2, NULL); 135 | 136 | // Print the final value of `counter` 137 | printf("Final value : %d\n", counter); 138 | 139 | return 0; // return 0 to indicate successful execution 140 | } 141 | ``` 142 | 143 | To understand the above program you will need to know about threads in C and concurrency as well. Note that concurrency and parallelism are both different. 144 | You can learn the difference [here](https://www.youtube.com/watch?v=oV9rvDllKEg&t=645s) 145 | 146 | In the program we create two threads p1 and p2. We wait for it finish execution. It loops over for the number of times we mention in the command line argument, so each thread executes the worker function once. The counter variable is shared among both the threads, which means each thread increases the value of count n number of times so if we provide 1000 we get a final value of 2000 as result. But if we give a large number we start getting different output and not 2n. This is because of how instructions get executed in OS discussed in upcoming topics. 147 | This crux of the problem here is how do we build a correctly working program when there are concurrently executing threads. 148 | 149 | ##### 2.4 Persistence 150 | 151 | Volatile memory like DRAM(Main memory) loses all information when the power goes off or if the system crashes and hence we required I/O device like hard-drive (HDD, SSD) to persist data. 152 | The software which manages files is called the `file system`. 153 | Disk is not virtualized as the user might want to share them among different applications. 154 | 155 | ```c 156 | #include // Standard I/O library 157 | #include // For file operations like write and close 158 | #include // For assertions to validate success of operations 159 | #include // For file control options (open flags) 160 | #include // For system-defined types 161 | #include // For file permission constants like S_IRWXU 162 | 163 | int main(int argc, char *argv[]) { 164 | // Open/create the file "/tmp/file" with write-only permissions 165 | // O_WRONLY: Open file for write-only access 166 | // O_CREAT: Create the file if it doesn't exist 167 | // O_TRUNC: Truncate the file to zero length if it already exists 168 | // S_IRWXU: Sets permissions so that the file's owner can read, write, and execute 169 | int fd = open("/tmp/file", O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU); 170 | 171 | // Assert that the file descriptor is valid (greater than -1) 172 | assert(fd > -1); 173 | 174 | // Write "hello world\n" (13 bytes) to the file 175 | int rc = write(fd, "hello world\n", 13); 176 | 177 | // Assert that 13 bytes were written successfully 178 | assert(rc == 13); 179 | 180 | // Close the file descriptor 181 | close(fd); 182 | return 0; // Return 0 to indicate successful execution 183 | } 184 | ``` 185 | 186 | The open, write and close operations are system calls routed to the file system. 187 | OS is sometimes seen as a standard library as it provides the higher level access to the devices using system calls. 188 | -------------------------------------------------------------------------------- /1. Introduction to Operating Systems/programs/concurrency.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | volatile int counter = 0; 6 | int loops; 7 | 8 | void *worker(void *arg){ 9 | int i; 10 | for(i=0; i\n"); 19 | exit(1); 20 | } 21 | loops = atoi(argv[1]); 22 | pthread_t p1, p2; 23 | 24 | printf("Initial value: %d\n", counter); 25 | pthread_create(&p1, NULL, worker, NULL); 26 | pthread_create(&p2, NULL, worker, NULL); 27 | 28 | pthread_join(p1, NULL); 29 | pthread_join(p2, NULL); 30 | printf("Final value: %d\n", counter); 31 | return 0; 32 | } -------------------------------------------------------------------------------- /1. Introduction to Operating Systems/programs/cpu.c: -------------------------------------------------------------------------------- 1 | #include // for input/output functions 2 | #include // for exit function 3 | #include // for usleep function (used to create a delay) 4 | 5 | int main(int argc, char *argv[]) { // main function, starts the program 6 | if (argc != 2) { // checks if exactly one argument is passed 7 | fprintf(stderr, "usage: cpu \n"); // print usage info if not 8 | exit(1); // exit with an error code (1) if no argument is passed 9 | } 10 | 11 | char *str = argv[1]; // assign the passed argument to a variable `str` 12 | while (1) { // infinite loop, keeps running until you stop it manually 13 | usleep(1000000); // delay of 1 second (1,000,000 microseconds) 14 | printf("%s\n", str); // print the string stored in `str` 15 | } 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /1. Introduction to Operating Systems/programs/io.c: -------------------------------------------------------------------------------- 1 | #include // Standard I/O library 2 | #include // For file operations like write and close 3 | #include // For assertions to validate success of operations 4 | #include // For file control options (open flags) 5 | #include // For system-defined types 6 | #include // For file permission constants like S_IRWXU 7 | 8 | int main(int argc, char *argv[]) { 9 | // Open/create the file "/tmp/file" with write-only permissions 10 | // O_WRONLY: Open file for write-only access 11 | // O_CREAT: Create the file if it doesn't exist 12 | // O_TRUNC: Truncate the file to zero length if it already exists 13 | // S_IRWXU: Sets permissions so that the file's owner can read, write, and execute 14 | int fd = open("/tmp/file", O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU); 15 | 16 | // Assert that the file descriptor is valid (greater than -1) 17 | assert(fd > -1); 18 | 19 | // Write "hello world\n" (13 bytes) to the file 20 | int rc = write(fd, "hello world\n", 13); 21 | 22 | // Assert that 13 bytes were written successfully 23 | assert(rc == 13); 24 | 25 | // Close the file descriptor 26 | close(fd); 27 | 28 | return 0; // Return 0 to indicate successful execution 29 | } 30 | -------------------------------------------------------------------------------- /1. Introduction to Operating Systems/programs/memory.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc, char *argv[]){ 7 | int *p = malloc(sizeof(int)); 8 | assert(p != NULL); 9 | printf("(%d) address pointed to by p: %p\n", getpid(), p); 10 | *p = 0; 11 | while(1){ 12 | usleep(1000000); 13 | *p = *p + 1; 14 | printf("(%d) p: %d\n", getpid(), *p); 15 | } 16 | return 0; 17 | } -------------------------------------------------------------------------------- /A Tour Of Computer Systems.md: -------------------------------------------------------------------------------- 1 | ``` 2 | #include 3 | 4 | int main() 5 | { 6 | printf("hello, world\n); 7 | return 0; 8 | } 9 | ``` 10 | **hello.c** 11 | 12 | ![The ASCII text representation of the above program](Images/Pasted_image_20240812203747.png) 13 | 14 | **The ASCII text representation of the above program** 15 | 16 | The hello.c program is actually a sequence of bits stored in a text file. They are organized in 8-bit chunks to form a byte. Each byte corresponds to a ASCII character as represented above for hello.c program. 17 | ![The compilation system](Images/Pasted_image_20240812204907.png) 18 | 19 | Fig 1.3 **The compilation system** 20 | 21 | The above system is responsible to convert the C program which is in high-level language to an executable object which are low-level machine-language instructions bundled together. 22 | 23 | `linux > gcc -0 hello hello.c` 24 | `gcc` is the compiler here which performs the translation from source code to executable object in four phases. 25 | 26 | - Phase 1 : **Preprocessing Phase** 27 | The preprocessor(`cpp`) modifies the original C program directives (`#`) to read its contents and include it directly in the program text, which results in another C program with .i suffix. 28 | 29 | - Phase 2 : **Compilation Phase** 30 | The compiler(`cc1`) coverts the hello.i file to hello.s file which contains the assembly-level program. 31 | 32 | - Phase 3 : **Assembly Phase** 33 | The assembler(as) translates hello.s into machine language instructions, then packages them in a form know as a **relocatable object program** and stores the result in the object file hello.o. 34 | 35 | - Phase 4: **Linking Phase** 36 | The linker(`1d`) handles the merging of dependent functions of the source program like `printf` in hello.c which results in executable object file hello ready to be executed. 37 | 38 | 39 | *Difference between relocatable object program and executable object program* 40 | - A **relocatable object program** is an intermediate file produced by the assembler. It contains machine code generated from assembly language code, but it’s not yet ready for execution. 41 | - **Relocation Information**: Contains data that allows the linker to adjust addresses based on where the object file is placed in memory. This means the addresses in the object file are placeholders that will be updated by the linker. 42 | 43 | - An **executable object program** is the final output of the linking process. It’s a complete binary file that can be directly executed by the operating system. 44 | - **Fully Resolved Addresses**: All addresses and symbols are resolved. The linker has adjusted the code and data locations to match the final memory layout. 45 | 46 | ##### Understanding how compilation system works 47 | - Optimizing program performance. We need a basic understanding of machine level code and how the compiler translates different C statements into machine level code. 48 | - Understanding link time errors. Complicated errors which are related to the operation of linker. Example: `> Cannot resolve a reference.` 49 | - Avoiding Security Holes. We can avoid major vulnerabilities by understanding how data and control information are stored on the program. 50 | 51 | ##### Processor Read and Interpret Instructions Stored in Memory 52 | A shell is a command-line interpreter 53 | ``` 54 | linux> ./hello 55 | hello, world 56 | linux> 57 | ``` 58 | Execution of the hello file produced by compilation. 59 | 60 | ##### Hardware Organization of a System 61 | ![Buses](Images/Pasted_image_20240813140913.png) 62 | 63 | **Buses** 64 | Electrical conduits that run throughout the system carrying fixed size chunks of bytes known as words(data) between components. Most machines have words sizes 4 bytes(32 bits) or 8 bytes(64 bits). 65 | 66 | **I/O Devices** 67 | Input Output devices. Each I/O device is connected to the I/O bus by either a controller or an adapter. 68 | 69 | **Main Memory** 70 | Physically main memory consists of a collection of Dynamic Random Access Memory(DRAM) chips. 71 | 72 | **Processor** 73 | It interprets the instructions stored in main memory. It has a program counter(PC), which at any point in time points to a machine instruction in main memory. A processor appears to operate according to a very simple instruction execution model, defined by its *instruction set architecture*. 74 | 75 | - Load: Copy a byte or a word from main memory into a register, overwriting the previous contents of the register. 76 | - Store: Copy a byte or a word from a register to a location in main memory, overwriting the previous contents of that location. 77 | - Operate: Copy the contents of two registers to the ALU, perform an arithmetic operation on the two words, and store the result in a register, overwriting the previous contents of that register. 78 | - Jump: Extract a word from the instruction itself and copy that word into the program counter (PC), overwriting the previous value of the PC. 79 | ##### Running the `hello` program 80 | ![](Images/Pasted_image_20240814164851.png) 81 | 82 | The input flows from the I/O device to the register which is then stored in memory. Once the command is entered the shell loads the executable file(hello) form disk directly to the main memory using a technique known as *Direct Memory Access*. After the code and data has been loaded into memory, the processor begins executing the machine-language instructions in the hello program's main routine. Here the data hello world\n gets to the display device to be displayed on screen. 83 | 84 | ![Writing the output string from memory to the display](Images/Pasted_image_20240814171751.png) 85 | 86 | **Writing the output string from memory to the display** 87 | 88 | #### Caches Matter 89 | ![](Images/Pasted_image_20240814171737.png) 90 | 91 | So as there is a lot of copying there is overhead and the system designers work on making these operations run faster. Due to physical laws large storage devices are slower than smaller storage devices. The processor runs at higher speeds than the main memory, and this gap is increasing. To bridge this gap the smaller, faster storage devices called cache memories which serve as temporary storage devices, they store frequently accessed data for quick retrieval. 92 | 93 | **Cache levels**: 94 | - **L1 cache**: Smallest and fastest, located on the processor chip. 95 | - **L2 cache**: Larger than L1, slightly slower, but still much faster than main memory. 96 | - Some systems have **L3 cache** as well. 97 | Caches use Static Random Access Memory, which is faster but more expensive than main memory. Programs tend to access data in localized regions and caches exploit this tendency to improve the overall system performance. 98 | 99 | ![](Images/Pasted_image_20240814174255.png) 100 | 101 | #### Storage Devices Form a Hierarcy 102 | The main idea of a hierarchy is that storage at one level serves as a cache for the next lower level. For example register serves as cache for L1, L1 as cache for L2 and so on. Programmers can exploit knowledge of the different caches to improve performance. 103 | 104 | #### The Operating System Manages the Hardware 105 | ![](Images/Pasted_image_20240815213722.png) 106 | 107 | Operating system is an intermediate between the application program and hardware, so any attempts to manipulate the hardware must go through OS. 108 | OS has two main purposes: 109 | 1) to protect the hardware from misuse 110 | 2) provide mechanism to manipulate low-level hardware using an application program 111 | It achieves both goals via abstractions shown in above image. These abstractions provide programmers an easy way to deal with hardware. 112 | 113 | ##### **Processes** 114 | A process is the operating system's abstraction for a running program. Multiple processes can run concurrently on the same system. A CPU with a single or multiple processors execute multiple processes concurrently by having the processor switch among them. This mechanism is called *context switching*. 115 | 116 | ![](Images/Pasted_image_20240914161843.png) 117 | 118 | While making the switch between processes the OS saves the context of the current process and then restoring the context of the next process and the incoming process picks up where it left off. The context-switching is managed by the system kernel. 119 | 120 | ##### **Threads** 121 | A process can consist of multiple execution units called threads, each running in the context of the process and sharing the same code and global data. Multi-threading model make programs run faster with multiple processors. Used in network servers to enable concurrency because it easier to share data between threads than processes. 122 | 123 | ##### **Virtual Memory** 124 | It is an abstraction that provides each process with the illusion that it has exclusive use of the main memory. Each process has same uniform view of the memory knows as virtual address space. 125 | 126 | ![](Images/Pasted_image_20240914170738.png) 127 | 128 | ##### **Files** 129 | A file is a sequence of bytes. Every I/O device is modeled as a file. All input and output in the system is performed by reading and writing files using system calls known as Unix I/O. 130 | This notion of a file provides with a generic view of the I/O devices contained in the system. 131 | 132 | #### System Communicate with Other Systems Using Networks 133 | The network can be viewed as another I/O device. Due to the significance of internet use case of copying data has increased and hence many applications are based on it like email, FTP etc. 134 | 135 | ![](Images/Pasted_image_20240920111656.png) 136 | 137 | #### Important Themes 138 | 139 | ##### **Amdahl's Law** 140 | States the effectiveness of improving the performance of one part of the system. 141 | 142 | ![](Images/IMG_0496.jpeg) 143 | 144 | ##### **Concurrency and Parallelism** 145 | We use concurrency to refer to the general concept of a system with multiple, simultaneous activities, and parallelism to refer to the use of concurrency to make a system run faster. Parallelism can be exploited at multiple levels of abstraction in a computer system. Below are three levels. 146 | ***Note:*** Concurrency is about dealing with multiple tasks that can progress over overlapping time periods, but it doesn't necessarily mean they execute simultaneously. Concurrent execution can be achieved through interleaving on a single processor. Parallelism, which involves true simultaneous execution, is a form of concurrency, but not all concurrent systems are parallel. 147 | 148 | 1. **Thread-Level parallelism** 149 | Multi-core processors have multiple CPUs integrated onto a single chip. 150 | 151 | ![](Images/Pasted_image_20240920170027.png) 152 | 153 | Each has its own L1 and L2 cache. L1 is split into two, one to hold the fetched instruction and the other to hold data. The cores share higher levels of cache and an interface to main memory. 154 | **Hyperthreading**, also called simultaneous multi-threading, which allows a CPU to execute multiple flows of control by having copies of PC and register. A hyperthreaded processor decides which of its threads to execute on a cycle-by-cycle basis.The ability to switch on every clock cycle comes from having multiple threads "ready to go" at all times within the processor itself. As an example, the Intel Core i7 processor can have each core executing two threads, and so a four-core system can actually execute eight threads in parallel. 155 | 156 | 2. **Instruction-Level parallelism** 157 | At a lower level of abstraction modern processors can execute multiple instructions at one time. Processors that can sustain more than one instruction per cycle are called *superscalar* processors. 158 | 159 | 3. **Single-Instruction, Multiple-Data (SIMD) Parallelism** 160 | At the lowest level, many modern processors have special hardware that allows 161 | a single instruction to cause multiple operations to be performed in parallel, a 162 | mode known as single-instruction, multiple-data (SIMD) parallelism. 163 | For example,recent generations of Intel and AMD processors have instructions that can add 8 pairs of single-precision floating-point numbers (C data type float) in parallel. 164 | -------------------------------------------------------------------------------- /Images/IMG_0496.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/IMG_0496.jpeg -------------------------------------------------------------------------------- /Images/Pasted_image_20240812203747.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/Pasted_image_20240812203747.png -------------------------------------------------------------------------------- /Images/Pasted_image_20240812204907.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/Pasted_image_20240812204907.png -------------------------------------------------------------------------------- /Images/Pasted_image_20240813140913.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/Pasted_image_20240813140913.png -------------------------------------------------------------------------------- /Images/Pasted_image_20240814164851.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/Pasted_image_20240814164851.png -------------------------------------------------------------------------------- /Images/Pasted_image_20240814171737.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/Pasted_image_20240814171737.png -------------------------------------------------------------------------------- /Images/Pasted_image_20240814171751.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/Pasted_image_20240814171751.png -------------------------------------------------------------------------------- /Images/Pasted_image_20240814174255.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/Pasted_image_20240814174255.png -------------------------------------------------------------------------------- /Images/Pasted_image_20240815213722.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/Pasted_image_20240815213722.png -------------------------------------------------------------------------------- /Images/Pasted_image_20240914161843.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/Pasted_image_20240914161843.png -------------------------------------------------------------------------------- /Images/Pasted_image_20240914170738.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/Pasted_image_20240914170738.png -------------------------------------------------------------------------------- /Images/Pasted_image_20240920111656.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/Pasted_image_20240920111656.png -------------------------------------------------------------------------------- /Images/Pasted_image_20240920170027.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/Pasted_image_20240920170027.png -------------------------------------------------------------------------------- /Images/Pasted_image_20240922121416.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/Pasted_image_20240922121416.png -------------------------------------------------------------------------------- /Images/Pasted_image_20240923163417.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/Pasted_image_20240923163417.png -------------------------------------------------------------------------------- /Images/Pasted_image_20240924190622.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/Pasted_image_20240924190622.png -------------------------------------------------------------------------------- /Images/Pasted_image_20241023193041.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluewmist/operating-system/bdf6c27c8e08d9a80d1e82061eccbde8df9c4454/Images/Pasted_image_20241023193041.png -------------------------------------------------------------------------------- /Part I/4. The Abstraction : The Process/Notes.md: -------------------------------------------------------------------------------- 1 | Process is a fundamental abstraction which is a running program. 2 | 3 | Crux of the problem. 4 | Provide the illusion of multiple cpus to run multiple applications. 5 | 6 | The OS creates this illusion by virtualizing the CPU. 7 | Time sharing -> allows users to run concurrent processes. 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Learning Operating Systems from Scratch 3 | 4 | Welcome to this project! I'm diving deep into operating systems with a focus on understanding core concepts through hands-on learning. My goal is to strengthen my foundation in operating systems by implementing the concepts whenever possible. 5 | 6 | The below mentioned resources are followed to give us a direction but the learning and implementation will not be limited to the books. 7 | - [three easy pieces](https://pages.cs.wisc.edu/~remzi/OSTEP/) 8 | - [csapp](https://github.com/wangmu0115/Book-CSAPP/blob/master/_Attachments/Computer_Systems_A_Programmers_Perspective(3rd).pdf) 9 | 10 | The main goal is to try implementing the concepts when possible so I assume you have basics of C. I will be working on the homework section of the book Three-Easy-Pieces for practice. I will be extensively using the Search Engine and LLMs to improve my understanding on a particular concept if necessary. 11 | 12 | I will be taking brief notes in markdown format on Obsidian which will be uploaded to this repository. I will just mention the main topics that were discussed in the lesson, you need to utilise the book or search online to study it further which fulfils this project's goal of active learning. 13 | 14 | Beyond the books, I'll implement extra projects that reinforce key operating system concepts, aiming to provide a well-rounded understanding. 15 | 16 | Contributions are always welcome. If you're also passionate about learning fundamental CS concepts, feel free to enhance this repository. Together, we can build a resource that supports learning CS fundamentals before moving into more abstract technologies, encouraging creativity in problem-solving. 17 | 18 | I am new to both writing notes, documentation and maintaining a big project so pardon my errors and I would like your critical feedback to grow. 19 | --------------------------------------------------------------------------------