Host: Mossaka
An operating system has total control of the hardware it’s running on. Whenever the applications need to access or modify hardware resources, they invoke syscalls into the kernel (a form of software-based interrupt). The kernel then handles the requests and returns the result to the caller in the user space.
Virtualization is the process of creating a virtual version of hardware, software, storage, or network resources.
OS essentially virtualizes
CPUs. It creates an illusion of nearly endless supply of CPUs by abstracting over running programs as Process / scheduling as Threads and using a technique called context switch (timer interrupt to prevents a program running forever)
<aside>
⚠️ There is no distinction between process and thread in Linux. Everything is a runnable Task. the syscall clone()
clones a task. Both fork()
and pthread_create()
calls clone.
</aside>
Memory. It creates an illusion of large, sparse, private address space for each running program. OS turns virtual memory into physical memory and relies on a hardware feature called TLB (translation lookaside buffer part of chip’s MMU) for efficiency.
I/O. hardware specific details are virtualized with device drivers. Linux treats most I/O resources as file descriptors. “everything is a file”
files, directories, device files, sockets, pipes, links are all files.
The VMM sits between the hardware and OSes. The VMM has total control of the hardware it’s running on and multiplex OSes across the same hardware. It is designed to be transparent
Motivations
Consolidation of resources
hardware costs are lowered due to the reduces # of physical servers
Scalability and portability
Easy addition and removal of virtual machines to different hardware and each VM can be replicated for fault tolerant. Allocate memory, network, compute and storage across multiple servers as needed.
User functionality
running a different OS on the same machine