IMG_20230125_135657_255 - L1.jpg

Three Concepts in Operating Systems

Virtualization

Let us take the most basic of resources, the CPU. Assume there is one physical CPU in a system (though now there are often two or four or more). What virtualization does is take that single CPU and make it look like many virtual CPUs to the applications running on the system. Thus, while each application thinks it has its own CPU to use, there is really only one. And thus the OS has created a beautiful illusion: it has virtualized the CPU.

Concurrency

There are certain types of programs that we call multi-threaded applications; each thread is kind of like an independent agent running around in this program, doing things on the program’s behalf. But these threads access memory, If we don’t coordinate access to memory between threads, the program won’t work as expected. First, the OS must support multi-threaded applications with protection (such as locks and condition variables). Second, the OS itself was the first concurrent program — it must access its own memory very carefully or many strange and terrible things will happen.

Persistence

Making information survive computer crashes, disk failures, or power outages is a tough and interesting challenge and needs persistence


<aside> 💡 How to create process threads

⇒ Job of an API (Application program interface) in system calls for OS

  1. An application needs to perform a certain task that requires the help of the operating system.
  2. The application identifies the appropriate API function or system call that can perform the task it needs.
  3. The application prepares the system call by setting up the necessary parameters, such as input/output data or memory addresses.
  4. The application initiates the system call by executing the API function.
  5. The operating system receives the system call and validates the input parameters to ensure they are correct and authorized.
  6. The operating system executes the appropriate code to perform the task requested by the application.
  7. The operating system returns the results of the system call to the application.
  8. The application processes the results and continues its execution. </aside>

We will talk about