Operating system nucleus or Kernel
This is the heart of the operating system and handles the most critical features. Here we see just a glimpse of the modules, concepts and techniques present in the nucleus of the modern operating systems.
File System
To store data in permanent storage units (non-volatile), the operating system uses a File. A file is a sequence of bytes which are saved using a name such as "sample.txt".
To organize these files we use a directory or folder. Directories can contain files and directories, which in turn may contain more files or directories.
Processes and Multitasking
Multitasking is the ability of a computer to run more than one program at a time. Each running program is a process. Notice that a program can be run twice at the same time, creating two different processes running the same program.
The operating system, gives some memory space to each process, and controls that it isn´t accessed by another process. Furthermore, the operating system divides the CPU execution time between the processes.
Interruptions
This is a mechanism of the CPU, which allows the operating system to control the processes (running programs). Interruptions are a mechanism by which, when an event occurs, the CPU interrupts the execution of a program and begins executing another one.
This is important, because it allows the operating system to remove the CPU to a running program without asking permission. In this way, the operating system can organize the CPU time between different processes, as necessary.
Execution modes
A CPU can have two or more execution modes with different privileges. The idea is that the operating system runs without restrictions and programs run in more restricted modes. In this way, you can control that a process does not interfere with another or with the operating system.
Virtual Memory
The physical or real memory of a computer can be 500MB, while the virtual or fictitious memory, can be 4 GB.
Without virtual memory, programmers have to be aware not to exceed the size of physical memory (RAM) with their programs. If it is overcome, an error occurs which ends the program.
Using virtual memory, the operating system (OS), tricks the program into thinking that there is more memory than it really exists. The OS does this, using the disk space to meet the space shortfall. The programmer is not aware of this process and does not have to worry about the physical memory.
How does the virtual memory work
- The OS loads and unloads the memory using fixed length packets, called "pages".
- Every time we ask the OS to load something into memory, it loads the necessary pages into the physical memory.
- When there is no space in the physical memory to place a page, it removes the least used page and it saves it onto the disk. This is known as "swapping".
- If access to a page -which is on the disk- is requested, it reloads it into the physical memory. This is called "page fault".
- The space disk allocated to keep these pages is known as "swap or exchange memory."