Lecture 02 · E2C Continuum and Cloud Computing

المحاضرة 02 · استمرارية E2C والحوسبة السحابية

Type 1 versus Type 2 hypervisors

hypervisors من النوع الأول مقابل النوع الثاني

Slides 22–24 الشرائح 22–24 P1 MUST

One question decides everything on this page: who owns the hardware? Answer it and the overhead, isolation, administration and the product names all fall into place.

سؤال واحد يحسم كل ما في هذه الصفحة: من يملك العتاد؟ أجب عنه، وستترتب في ذهنك تلقائياً مسائل overhead والعزل والإدارة وأسماء المنتجات.

The one-line definitions

التعريفات في سطر واحد

A hypervisor, also called a virtual machine monitor (VMM), is the software that lets several virtual machines share one physical computer while each guest OS believes it has a real machine of its own. There are two places to put it.

إن hypervisor، ويُسمّى أيضاً virtual machine monitor (VMM)، هو البرنامج الذي يسمح لعدة أجهزة افتراضية (VMs) بمشاركة حاسوب فعلي واحد، بينما يعتقد كل نظام تشغيل ضيف (guest OS) أن لديه جهازاً حقيقياً خاصاً به. وهناك مكانان لوضعه.

TYPE 1 · BARE METAL TYPE 2 · HOSTED Guest OS 1 Guest OS 2 Guest OS N Type 1 hypervisor (VMM) acts as the OS, schedules CPUs, partitions RAM Hardware CPU, memory, storage, networking ≈5% overhead ESXi · Hyper-V · KVM · AWS Nitro Browser Guest OS 1 Guest OS N Type 2 VMM (an app) Host operating system owns the hardware, the extra hop Hardware CPU, memory, storage, networking ≈10% overhead VirtualBox · VMware Workstation · Parallels
Type 1 sits directly on the hardware. Type 2 adds a full host OS in between, so every guest request takes one extra hop.
Type 1 يقع مباشرة على العتاد. وType 2 يضيف نظام تشغيل مضيفاً كاملاً في المنتصف، فيمرّ كل طلب من الضيف بخطوة إضافية.
Memory trick حيلة للحفظ

"Type 1 is first on the metal. Type 2 is second, after a host OS."

"Type 1 هو الأول على المعدن. وType 2 هو الثاني، بعد نظام تشغيل مضيف."

Count the layers between guest and hardware: Type 1 has one (the hypervisor), Type 2 has two (VMM plus host OS). More layers means more overhead, weaker isolation and easier installation.

عُدّ الطبقات بين الضيف والعتاد: في Type 1 طبقة واحدة (hypervisor)، وفي Type 2 طبقتان (VMM ثم النظام المضيف). وكلما زادت الطبقات زاد overhead وضعف العزل وسهل التثبيت.

What slide 22 says about Type 1

ما تقوله الشريحة 22 عن Type 1

"Unaware" and "needs drivers" are both true at different levels. An unmodified guest sees only virtual hardware and never learns the truth. For speed, clouds install paravirtual ("enlightened") drivers in the guest, so such a guest is partly aware by choice.

عبارتا "لا تعلم" و"تحتاج drivers" صحيحتان كلتاهما على مستويين مختلفين. فالضيف غير المُعدَّل لا يرى إلا عتاداً افتراضياً ولا يعرف الحقيقة أبداً. لكن السحابات تُثبّت لأجل السرعة drivers من نوع paravirtual (أو enlightened) داخل الضيف، فيصبح ذلك الضيف مُدركاً جزئياً باختياره.

The comparison table (slide 24)

جدول المقارنة (الشريحة 24)

This is the table to reproduce on the exam. Each row follows from the layer count.

هذا هو الجدول الذي يجب أن تعيد كتابته في الامتحان. وكل صف فيه ينتج من عدد الطبقات.

PropertyالخاصيةType 1 (bare metal)Type 1 (على العتاد مباشرة، bare metal)Type 2 (hosted)Type 2 (مستضاف، hosted)
Runs onيعمل علىDirectly on hardwareمباشرة على العتادInside a host OS, as an appداخل نظام تشغيل مضيف، كتطبيق
Overhead vs bare metalOverhead مقارنة بالعتاد المباشر≈ 5%≈ 10%
Resource managementإدارة المواردDirect, by the hypervisorمباشرة، بواسطة hypervisorIndirect, through the host OSغير مباشرة، عبر نظام التشغيل المضيف
AdministrationالإدارةMore complex, needs skillsأعقد، وتحتاج مهارةEasier, install like any appأسهل، يُثبَّت مثل أي تطبيق
IsolationالعزلMore (stronger)أكثر (أقوى)Less (weaker)أقل (أضعف)
Typical userالمستخدم المعتادCloud providers, data centersمزودو السحابة ومراكز البياناتDevelopers, students on laptopsالمطورون والطلاب على حواسيبهم المحمولة
ExamplesأمثلةVMware ESXi, Microsoft Hyper-V, KVM, AWS NitroOracle VirtualBox, VMware Workstation, Parallels Desktop

ملخّص الجدول: Type 1 يعمل مباشرة على العتاد، وoverhead له نحو 5%، ويدير الموارد مباشرة، وإدارته أصعب وتحتاج مهارة، وعزله أقوى، ويستخدمه مزودو السحابة، وأمثلته VMware ESXi وMicrosoft Hyper-V وKVM وAWS Nitro. أما Type 2 فيعمل كتطبيق داخل نظام مضيف، وoverhead له نحو 10%، ويدير الموارد بشكل غير مباشر عبر النظام المضيف، وإدارته أسهل، وعزله أضعف، ويستخدمه المطورون والطلاب على حواسيبهم، وأمثلته VirtualBox وVMware Workstation وParallels Desktop.

The slide's Type 2 bullet "less isolation than virtual environments" is garbled. Read it as "less isolation than Type 1". The 5% and 10% are rough rules of thumb from the slide, not constants: real overhead depends on the workload (CPU-bound code runs near native with Intel VT or AMD-V; I/O pays more).

عبارة الشريحة في Type 2 "عزل أقل من البيئات الافتراضية" مُشوَّشة، واقرأها على أنها "عزل أقل من Type 1". والنسبتان 5% و10% قاعدتان تقريبيتان من الشريحة وليستا ثابتتين: فالـ overhead الحقيقي يعتمد على نوع الحمل (الكود المعتمد على المعالج يقترب من السرعة الأصلية مع Intel VT أو AMD-V، بينما عمليات I/O تدفع أكثر).

Worked: what the overhead percentages cost a provider

مثال محلول: كم تكلّف نسب overhead المزوّد

Worked مثال محلول
a server delivers 100 units of work on bare metal.

  Type 1:  100 x (1 - 0.05) = 95 units sellable
  Type 2:  100 x (1 - 0.10) = 90 units sellable

  difference: 5 units per server, 5 / 95 ≈ 5.3% less

on a fleet of 10,000 servers that is the work of
about 10,000 x 5 / 95 ≈ 526 extra servers lost
to the host OS layer.

That is the slide's punchline: because of the performance benefit, CSPs use Type 1 hypervisors. Add isolation between strangers on the same box and the choice is not close.

وهذه هي خلاصة الشريحة: بسبب ميزة الأداء، يستخدم مزودو الخدمة السحابية (CSPs) Type 1 hypervisors. وأضِف إلى ذلك الحاجة إلى عزل عملاء غرباء على الجهاز نفسه، فلا يبقى مجال للمقارنة.

Why the cloud picks Type 1: AWS Nitro

لماذا تختار السحابة Type 1: AWS Nitro

AWS's Nitro Hypervisor is a minimal, KVM-based Type 1 hypervisor. It has no networking stack, no general-purpose file system and no peripheral drivers. Networking and storage I/O are offloaded to dedicated Nitro Cards, so the hypervisor does little more than partition CPU and memory. It is the Type 1 idea taken to its limit: less overhead means more capacity to sell, and a thinner layer between tenants means stronger isolation.

إن Nitro Hypervisor من AWS هو Type 1 hypervisor مُصغَّر مبني على KVM. لا يحتوي على networking stack ولا نظام ملفات عام ولا drivers للأجهزة الطرفية. وتُنقل عمليات الشبكة والتخزين (I/O) إلى بطاقات مخصصة تُسمّى Nitro Cards، فلا يكاد hypervisor يفعل شيئاً سوى تقسيم المعالج والذاكرة. إنها فكرة Type 1 في أقصى صورها: overhead أقل يعني سعة أكبر للبيع، وطبقة أرق بين العملاء تعني عزلاً أقوى.

Trap فخ

KVM is Type 1, even though it lives inside Linux as a kernel module (kvm.ko). It does not run on top of the kernel as an app; it turns the Linux kernel itself into the hypervisor. Some textbooks call it a hybrid, but the slide and Red Hat list it as Type 1. On the exam, say Type 1 and give that reason.

KVM من نوع Type 1، مع أنه يعيش داخل Linux كوحدة نواة (kvm.ko). فهو لا يعمل فوق النواة كتطبيق، بل يحوّل نواة Linux نفسها إلى hypervisor. بعض الكتب تسميه هجيناً، لكن الشريحة وRed Hat تصنّفانه Type 1. وفي الامتحان قل Type 1 واذكر هذا السبب.

Hyper-V is Type 1, even though you switch it on inside Windows. Enabling it changes the boot order: the hypervisor loads first, and your Windows moves into a privileged "root partition" on top of it, next to the guest "child partitions".

Hyper-V من نوع Type 1، مع أنك تفعّله من داخل Windows. فتفعيله يغيّر ترتيب الإقلاع: يُحمَّل hypervisor أولاً، وينتقل Windows الخاص بك إلى "root partition" ذات صلاحيات فوقه، بجانب "child partitions" الخاصة بالضيوف.

"Type 2 has better isolation" is false. Type 2 has weaker isolation: a compromise of the host OS exposes every guest. The direction is: Type 1 wins on overhead, resource control and isolation; Type 2 wins only on ease of administration.

عبارة "Type 2 عزله أفضل" خاطئة. فعزل Type 2 أضعف: اختراق النظام المضيف يكشف كل الضيوف. والاتجاه الصحيح: Type 1 يتفوق في overhead والتحكم بالموارد والعزل، وType 2 لا يتفوق إلا في سهولة الإدارة.

vSphere is not the hypervisor. The slide lists "VMware vSphere"; strictly, vSphere is the management suite and ESXi is the Type 1 hypervisor inside it. Either name matched to Type 1 is accepted; VMware Workstation is the Type 2 product.

vSphere ليس هو hypervisor. الشريحة تذكر "VMware vSphere"، لكن بدقة: vSphere هو حزمة الإدارة، وESXi هو Type 1 hypervisor بداخلها. ومطابقة أي من الاسمين مع Type 1 مقبولة، أما VMware Workstation فهو منتج Type 2.

Matching drill: product to type

تمرين مطابقة: المنتج ونوعه

ProductالمنتجTypeالنوعWhyالسبب
VMware ESXi / vSphereType 1Installed on an empty server, boots firstيُثبَّت على خادم فارغ، ويُقلع أولاً
Microsoft Hyper-VType 1Hypervisor loads first; Windows becomes the root partitionيُحمَّل hypervisor أولاً، ويصبح Windows هو root partition
KVMType 1Turns the Linux kernel into the hypervisorيحوّل نواة Linux نفسها إلى hypervisor
AWS NitroType 1Minimal KVM-based, I/O offloaded to Nitro Cardsمُصغَّر ومبني على KVM، وعمليات I/O منقولة إلى Nitro Cards
Oracle VirtualBoxType 2An app on Windows, macOS or Linuxتطبيق على Windows أو macOS أو Linux
VMware WorkstationType 2An app on a desktop OSتطبيق على نظام تشغيل مكتبي
Parallels DesktopType 2An app on macOSتطبيق على macOS

قاعدة المطابقة: ESXi وHyper-V وKVM وAWS Nitro كلها Type 1 لأنها تُقلع أولاً أو تحوّل النواة إلى hypervisor. أما VirtualBox وVMware Workstation وParallels Desktop فكلها Type 2 لأنها تطبيقات فوق نظام تشغيل مكتبي.

Everything on one card

كل شيء في بطاقة واحدة

Hypervisor cheat card

بطاقة ملخّص hypervisor

Check yourself

اختبر نفسك

Which of the following is a Type 2 (hosted) hypervisor?

أيّ مما يلي هو Type 2 hypervisor (أي hosted)؟

VirtualBox installs as an application on a host OS, so it is Type 2. KVM, Hyper-V and ESXi are all Type 1. KVM and Hyper-V are the two classic distractors because one lives in the Linux kernel and the other is enabled from inside Windows, but both end up owning the hardware.

يُثبَّت VirtualBox كتطبيق فوق نظام مضيف، فهو Type 2. أما KVM وHyper-V وESXi فكلها Type 1. وKVM وHyper-V هما المُشتِّتان الكلاسيكيان، لأن الأول يعيش في نواة Linux والثاني يُفعَّل من داخل Windows، لكن كليهما ينتهي به الأمر مالكاً للعتاد.

True or false, as an MCQ: "Type 2 hypervisors provide stronger isolation than Type 1 because the host OS adds an extra security layer."

صح أم خطأ، بصيغة اختيار من متعدد: "Type 2 hypervisors توفّر عزلاً أقوى من Type 1 لأن النظام المضيف يضيف طبقة أمان إضافية."

Slide 24: Type 1 has "more isolation of virtual environments", Type 2 has less. The host OS is a large, general-purpose attack surface sitting under every guest, not an extra wall between them.

الشريحة 24: Type 1 فيه "عزل أكبر للبيئات الافتراضية"، وType 2 فيه عزل أقل. فالنظام المضيف سطح هجوم كبير وعام يقع تحت كل الضيوف، وليس جداراً إضافياً بينهم.

Approximately what performance overhead does slide 24 give for Type 1 and Type 2 relative to bare metal?

ما نسبة overhead التقريبية التي تعطيها الشريحة 24 لكل من Type 1 وType 2 مقارنة بالتشغيل المباشر على العتاد؟

Type 1 ≈ 5%, Type 2 ≈ 10%. Option B is the swapped-direction error; remember that the type with the extra host OS layer pays more. The numbers are approximations that vary with workload.

Type 1 نحو 5%، وType 2 نحو 10%. والخيار B هو خطأ عكس الاتجاه، فتذكّر أن النوع الذي فيه طبقة النظام المضيف الإضافية يدفع أكثر. والأرقام تقريبية وتتغير بحسب الحمل.

Which statement best describes the AWS Nitro Hypervisor?

أيّ عبارة تصف AWS Nitro Hypervisor بشكل أدق؟

Nitro is deliberately stripped down: no networking stack, no general file system, no peripheral drivers. I/O moves to Nitro Cards, leaving the hypervisor to partition CPU and memory. That minimalism is why option C is wrong.

Nitro مُجرَّد عمداً: لا networking stack، ولا نظام ملفات عام، ولا drivers طرفية. وتنتقل عمليات I/O إلى Nitro Cards، فيبقى على hypervisor تقسيم المعالج والذاكرة فقط. وهذا التصغير هو سبب خطأ الخيار C.

A student says: "KVM must be Type 2, because it is a module inside the Linux kernel, and Linux is a host OS." What is the best response?

قال طالب: "لا بد أن KVM من Type 2، لأنه وحدة داخل نواة Linux، وLinux نظام مضيف." ما أفضل رد؟

KVM is not an app on top of the kernel; it is part of the kernel and uses Intel VT or AMD-V to run guests directly. Slide 22 lists it as Type 1, and AWS Nitro is built on it, which already rules out option D.

KVM ليس تطبيقاً فوق النواة، بل جزء منها ويستخدم Intel VT أو AMD-V لتشغيل الضيوف مباشرة. والشريحة 22 تصنّفه Type 1، وAWS Nitro مبني عليه، وهذا وحده يُسقط الخيار D.