가상머신 Virtual Machine

MisCaminos·2021년 5월 3일
0

Cloud

목록 보기
1/1
post-thumbnail

가상머신을 통해 현재 내가 사용하고있는 computer/machine의 operating system과 조건이 다른 환경을 만들어서 필요한 application을 만들거나 구동시킬 수 있다. 그리고 그 특정 환경이 필요한 여러 가지의 작업을 할 수 있다.

즉, 내 컴퓨터 안에 다른 컴퓨터를 게스트로 하나 더 만들어서 호스트역할을 하는 내 컴퓨터에는 게스트 컴퓨터에서 하는 일들과 영향을 주고받지 않도록 (또는 주고받도록) 내가 제어하는 것이다.

컴퓨터에 가상머신을 만들고 실행시키는 software가 hypervisor이다. Hypervisor은 VMM(virtual machine monitor)이라고도 불린다. Hypervisor를 통해서 하나의 host 컴퓨터의 physical resources (e.g., memory, storage, processing, etc)를 함께 공유하는 여러개의 guest VM을 만들 수 있다. 여러 guest VM을 만들고, 이들을 실행시킬때 구동 순서나 resource 사용 순서 등을 관리한다.

Hypervisor은 두가지 type이 있다.

type1: Hyper-V (aka bare metal hypervisor)

Hypervisor이 host computer의 physical hardware에 바로 install된다. (type 1 hypervisors are installed natively on the underlying physical HW) 그래서 VM들은 hardware resources를 배분받기위해 hosts와 직접적으로 interact한다.

type 1 hypervisor을 구동하는 host machines는 virtualization만을 위해 사용된다. (it makes sense since the hypervisor is natively installed on the HW's) 그래서 datacenter나 기업의 server-based environment에서 주로 사용된다.

examples: Microsoft Hyper-V, VMware vSphere, Citrix Hypervisor(전 XenServer)

type2: VirtualBox (aka hosted hypervisor)

Host computer의 operating system위에서 hypervisor가 작동한다. Hosted hypervisor이 guest VM의 요청들을 host operating system으로 전송하고 host operating system이 physical resources를 각각의 guest VM들에게 어떻게 배분할지 관리한다.

type 2 hypervisor을 사용하면, type1을 사용할때보다 host OS를 거쳐야하는 점에서 속도가 더 느릴 수 있지만, guest VM들이 physical hardware에 묶여있어야하지 않기때문에 더 자유롭다. virtualization만을 위한 server / datacenter용 hardware를 갖추지않아도 되는 개인 PC또는 작은 기업에서 VM을 구현하는 용도로 사용된다. 그리고 type2를 사용하면 guest operating system을 physically 존재하지않는 hardware에서 실행할 수도 있다고 한다.

example: Oracle VirtualBox

Microsoft의 Azure 사이트에 가면 virtual machine을 아래 그림으로 설명해두었다.

그림에서 보이는것과 virtualization은 software을 기반으로 virtual version의 컴퓨터를 생성해서 이 가상의 컴퓨터들이 physical host computer의 CPU, memory, storage를 빌려서 사용하는 것이다. 이 host computer는 내 개인 PC가 될수도, cloud provider의 datacenter에 있는 remote server가 될수도 있다. Virtual machine은 computer처럼 동작하는 computer file과도 같다. ("image"라고 불린다고하네...왜지?)

직접 VirtualBox를 install해서 CentOS를 구동하는 VM를 만들어보았다. Window창 하나를 띄워서 그 안에서 operating system하나를 새로 깔고 구동시키는 작업을 해본것인데, 그 window창 밖의 세상(내 PC의 Windows)과는 완전히 분리되어서 CentOS(VM의 guest OS)가 실행된다. 신기방기하다.

VirtualBox를 처음 사용하면서 막히는부분들은 아래 manual 사이트에 들어가면 대부분 설명되어있다.

https://www.virtualbox.org/manual/

Microsoft Azure에서 말하는 몇가지 VM을 사용하는 목적들이다:
1. Building and deploying apps to the cloud.
2. Trying out a new operating system (OS), including beta releases.
3. Spinning up a new environment to make it simpler and quicker for developers to run dev-test scenarios.
4. Backing up your existing OS.
5. Accessing virus-infected data or running an old application by installing an older OS.
6. Running software or apps on operating systems that they weren't originally intended for.

VM으로 가상환경을 구축하면, 앞으로 다양한 머신러닝, 딥러닝 모델들을 구현해볼때에 내 PC의 Windows에 깔린 python과 다른 도구들과의 version이 맞지않아도 쉽게 구현해볼 수 있다. 위 여러가지 목적들중에 3번에 해당하는것같다.



References:

  1. The Basic Diffrence between Hyper-V and VirtualBox

  2. Hyper-V Technology Overview

  3. Oracle VirtualBox Online Manual

  4. What is a virtual machine(VM)? from Azure website

  5. What is a virtual machine? from Citrix website

profile
Learning to code and analyze data

0개의 댓글