What is virtualization?
computer architecture technology
by which multiple virtual machines
-> are multiplexed in the same hardware
=> creating virtual resources (such as server, storage, network, …) in a layer abstracted form real hardware
What are objectives of virtualization?
enhance resource sharing by many users at a time
replace and upgrade HW on the fly
add new devices (i.e. network cards, virtual sockets, processors,…) without reboots
reduce down time
offer administrative tasks (such as installing software, planning new VMs, optimizing number of VMs, …,) at runtime
faster provisioning of multiple machines
What two basic modes of operatoin (in the OS) exist?
user mode
kernel mode
What are the perks of kernel mode?
OS allows all CPU instruciotns to execute on the unterlying hardware
kernel codes do not execute in the USER mode
What are the perks of user mode?
OS allows only a few instructions to be executed
if user applicatios have to execute the privileged instructions
-> applications ask kernels to do the work (i.e. System call)
user applcations can’t:
open files
send network packets
print to the screen
allocate memory
How do kernel processes run?
run in KERNEL mode
with supervisor or superuser privilege
How do user processes run?
run in USER mode
with user privileges
How manages processes and threads?
OS
What are the tasks of the OS?
process management (start, run, stop processes)
memory management (allocate, deallocate memory)
file management (open, close, modfy, read, rename, create)
network management
scheduling
timing
What are system calls?
user space request
of a kernel service
How many cycles does a sys call usually take?
around 242 cycles
What types of virtualization are there?
Type I -> bare metal virtualization
Type II -> Hosted virtualization
How does Type I / Bare metal virtualization work?=
usually harder to setup
How does type II / hosted virtualization work?
easy to setup
hypervisor loaded on top of an OS (contrary to type I where directly loaded on hardware)
guest OS runs on hosted hypervisors
How does full virtualtization work?
User requests directly on underlying HW (as regular)
kernel instructions:
trapped by VMM (i.e. requires s/w interrupt)
VMM emulates instruction on the fly (-> directly translates to corresponding underlying hardware…)
Advantage / disadvanage full virtualization?
advantages:
OS needs no modificatoin
maximum decoupling
full isolation
What is the impact of sys calls in full virtualization?
high overhead
e.g. in 32 bit -> 2300 cycles
What is virtual memory?
memory virtualizaton introduced to reduce system crash
-> virtual memory is a memory management technique
-> map programs memory address (virtual addresses) to underlying physical memory (in computer)
usually -> OS maintains mapping or virtual memory to physical memory
What are advantages of virtual memroy?
increased security
isolation
freeing applicaionts
How is virtual memory applied in VMs?
2-stage mapping process for any guest OS
guest OS cannot directly access machine memory
VMM does mapping of addresses
page table in VMM is called shadw page table
shadow paging takes 3 to 400 times more cycles than native sutiations
Flow of memory virtualizatoin in VM
What is para virtualization?
modify the OS so that sys call trapping and rewriting can be avoided
hypervisor provides interface to accomodate critical kernel operatoins
such as memory management and interrupt handling
How is the performance in para virtualizuation?
comparatively good
-> avoid unnecessary trapping of critical instructions
-> lower virtualization overhead
What is a challenge in para-virtualizuatoini?
need modified guest OS!!!
Difference full vs para virtualization?
full:
guest OS -> VMM -> (translates) -> HW
para:
(modified) guest OS -> VMM
-> (interfaces) -> HW
Scheme of para virtualization
What is the goal of hardware-assited virtualization?
add layer that is able to
quickly identify privilege instrunctions
and efficiently execute them
Scheme hardware assisted virtualiation
What is the idea of OS-level virtualization?
containers share underlying OS kernel
-> thus can only run flavors of the same OS
What are the building blocks of OS-level virtualization?
namespaces
cgroups
What are namespaces?
used in linux to limit the views
wrap a group of resources
different types of namespaces exist
pid
cgroup
network
mount
user
What are PID namespaces?
process ID
-> allows to create another set of PID starting from PID for that specific namespace
if not, init process gets PID1
without namespaces -> all processes descend from init process
processes within new namespace cannot view parent process
parent can view child processes
What are cgroup namespaces?
offers new views to root directories
poor: -> chroot() may also set roor directory -> only changes lookup -> not secure and good…
cgroup isolage and manage resources…
What are network namespaces?
namespace creates new interfaces, routing tables etc.
-> i.e. new interface lo
-> but: must ensure mapping of global namespace to locally framed new namespace…!)
What are mount namespaces?
provide isolaiton of mountpoints
What are user namespaces?
usolates user and group IDs
How are linux namespaces managed?
APIs
-> clone()
-> setns()
What are cgroups?
linux kernel feature which limits applicaiton to specific set of resources
-> proves mechanism for aggregating/partitioning set of tasks
-> how much to use
-> what to use?
What are the 3 main tasks of cgroups (control groups) on a gorup of processes?
limit resources
isolate resources
audit utility of resources
Why should we limit resource utilization?
to guarantee certain amount of resources
e.g. CPU, memory, disk, I/O
for a group of processes
What types of cgroups are there?
memory cgroup
cpu cgroup
blkio cgroup
cpuset cgroup
devices cgroup
freezer cgroup
…
What is the memory cgroup?
memory resource controller
-> isolates memory behavior of group of tasks from rest of system
creates cgroup with limited amount of memory
separates memory hungry applications from other applicaiotns
What are featuers of a memory cgroup?
accounting
how much memory pages are utilized by specific group of running processes?
in file pages (pages on disk)
in anonymous pags (pages not located on disk -> e..g heaps, stacks,…)
limiting
soft limit - memory is alloted if available
hard limit - memory is not allotted to the group of tasks
What happens when the hard limit in memoy cgroups get exceeded?
kernel trigers OOM killer (out of memory) process
-> to kill any running processes (based on badness score)
=> thus advisable to only run one application on a container
How can one customiue the OOM killer in memory cgroups?
override hart limits
steps:
all processes are stopped from processing (freeze option)
notify user space
user could kill specific processes
or user could increase hard limit specified in cgroups
when done, unfreeze the group
What are containers?
lightweight VM
use kernel featuers (cgroups, namespaces)
shared hardware among multiple users
What do container solutions allow?
multiple isolated linux systems of same kind
on single host
=> thus called self-contained executoin environment
What is docekr?
utilizes container technology
-> easily ports containers
replicates containers across envbironments
What are advantages of docker?
reduces time between writing code and producint them
removes unnecessary configuraiotn hurdles of applicaionts
What is the difference between docker and VMs?
-> do not require guest os
-> overcome problems of VM
size
memory
integration
What is union filesystem?
unionfs
filesystem service for linux, freeBDS and netBDS
-> inplements a union mount for other file systems
-> allows files and directories of separate file systems (branches) to be transparently overlaid
-> forming single coherent file system
=> used by docker
How are docker containers initlialized?
docker caches layers the first time of building them
-> initial install e.g. ubuntu is cached (base)
-> for second build, only rest such as apache or mysql is built
-> deployment is faster…
What is the architecture of docker?
follows client-server
docker client talks to docker daemon
docker daemon does
building
running
distributing docker containers
docekr registry stores docker images
either in local
or public registries (e.g. docker hub, docker cloud,…)
What states can a docker container have?
created
restarting
paused
exited
dead
What tools are there in docekr?
docker desktop
docker compose
docker swarm
What is docker desktop?
bundled package which contains all components of dockers –
docker engine, cli, credential helper, and so forth.
What is docker compose?
tool for defining instances specific to certain applications.
able to build and run the multi-container docker applications.
It is represented as YAML files.
What is docker swarm?
tool to manage docker containers hosted on clusters.
has features such as
scaling,
multi-host orchestration,
service discovery,
load balancing,
follows init and join approach (as like in kubernetes)
What is vmware - vsphere?
virtualizes and aggregates underlygin physical hadrware resources of a datacenter
type-I cloud OS -> aggregate infrastructure of datacenter…
enables to manage IT resources
What are elemets of
Last changed2 years ago