CS3204 – CS3511 Lab 1 Report – Virtual machines and containers Solved

$ 24.99
Category:

Description

Application

The application that has been developed to test the execution time in each environment has been a matrix multiplication. It is programmed in Python, in a file called matrix.py, which contains a function called matrix.

The function receives the maximum dimension of the matrices and in each iteration, it computes the matrix multiplication and records the execution time. The program uses certain libraries such as numpy, to generate the matrices, and csv, to export the results in a csv file:

Figure 1: matrix.py
Also, there has been created a main.py file to test the execution time with different values for the maximum dimension of the matrices:

Figure 2: main.py

The application has been run in a Windows 10 laptop with an Intel Core i7 1.80 GHz with 4 cores and 16 GB of RAM. The results obtained in the host machine (without virtualization) are the following:

Figure 3: Execution time in host machine

Virtual machines and containers

A virtual machine is a computer that runs on software, instead of running directly on hardware. Each virtual machine runs its own operating system and truly “believes” that is directly accessing hardware resources, but its system calls are processed by another software, which is the hypervisor. Hypervisor type 1 acts like a lightweight operating system and runs on hardware, whereas hypervisor type 2 runs on a host OS as an additional software layer.

A container is an encapsulated environment that runs applications. It shares the OS kernel and it only contains the application, the software libraries and environment variables that are necessary. It takes advantage of some Linux features, like namespaces and cgroups, to isolate processes and restrict resource utilization. They are a different approach to virtual machines, being lighter and faster to deploy.

The application has been tested in an Ubuntu 20.04 LTS guest OS using VirtualBox as hypervisor. The results obtained are the following:

Figure 4: Execution time in virtual machine

Also, the application has been tested in a Python container making use of Docker Desktop for Windows with the following results:

Figure 5: Execution time in Docker container

Execution time comparison

As mentioned before, the application has been tested in three different environments: in the host machine without virtualization, in an Ubuntu virtual machine and in a Docker container. If we plot the three curves together, we can notice several things:

Figure 6: Execution time comparison

Conclusions

With this lab we have put in practice what we though theoretically about performance in virtual machines and containers. It shows us that virtual machines can be useful for software development, but they give us less performance, making them less suitable for running applications where time is critical. On the other hand, we see the advantages of using containers in terms of performance, with lower results but close to those of the host machine. Furthermore, with containers we can take advantage of isolation, resource utilization and portability, because we can test and run our applications in different hosts using the same container image.

I did not encounter many difficulties in developing the matrix multiplication algorithm. Python is a very powerful programming language and when it is used with numpy it makes matrices handling very easy. At first, I tried to use the matrix multiplication function that numpy provides, but it was so efficient that I though that it would be more interesting to to use a slower algorithm to test the execution time better.

References

Link to application code in GitHub: https://github.com/SergiDelta/CS3204_Lab_1

Reviews

There are no reviews yet.

Be the first to review “CS3204 – CS3511 Lab 1 Report – Virtual machines and containers Solved”

Your email address will not be published. Required fields are marked *