0% found this document useful (0 votes)
78 views

Alternatives For Running Linux Aplications in Windows

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views

Alternatives For Running Linux Aplications in Windows

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

ECAI 2019 - International Conference – 11th Edition

Electronics, Computers and Artificial Intelligence


27 June -29 June, 2019, Pitesti, ROMÂNIA

Alternatives for Running Linux Applications in


Windows

Valeriu Manuel Ionescu Manan Patel Drashti Hindocha


Department of Computer Science ICT IT
University of Pitesti Marwadi University Marwadi University
Pitesti, Romania Rajkot,Gujarat, India Rajkot,Gujarat, India
[email protected] [email protected] [email protected]

Abstract—The Linux operating system is often used some of the current options for running Linux guests on a
alongside Windows in computer labs in universities for Windows host and investigates inter-process communication
research, laboratories and general purpose use. It is therefore performance and application speed, both key aspects in an
important to investigate the characteristics of some of the operating system. The following solutions will be tested and
possibilities available for students to run Windows and Linux compared: running the application in a virtual machine
applications, if possible at the same time, on the same (VirtualBox in this case); using Cygwin [3] which allows
computer. This paper compares the use of Windows Subsystem Linux programs to be re-compiled and run in a POSIX
Linux, Docker, Cygwin and Oracle VM VirtualBox as compatible environment on Windows; using Windows Linux
solutions for running Linux guest applications in a Windows
Subsystem that became available in 2016 for Windows 10,
10 host environment. The tests use simple C code that targets
which translates Linux system calls to Windows [4]; Docker
process creation, application performance and inter-process
communication performance. The conclusions show the Linux containers that allow running Linux applications,
advantages and disadvantages of using each solution for based on a different virtual machine Hyper-V. Even if
running Linux applications in a Windows host. Cygwin does not allow running native Linux applications, it
is included in this paper because when a program needs to be
Keywords— VirtualBox, Docker, Windows Linux Subsystem, ported from one distribution of Linux to another it often
Cygwin, performance needs to be re-compiled and even have minor source code
modifications. In these tests only POSIX features were
I. INTRODUCTION tested, making it possible to test run the same applications
The open source Linux operating system was released in across all environments. The paper conclusion will present
1991 and was written in C [1], departing from the previously the advantages and disadvantages for each solution.
existing MINIX code (that required a license fee at that
II. TECHNOLOGY OVERVIEW
time). This was performed by the addition of GNU Project
libraries which replaced all MINIX components. The Virtualization is a technology that allows hardware
development of Linux was conducted by both individuals abstraction and the creation of virtual resources with or
and enterprises, each variant being called a distribution and without hardware support. Its purpose was to provide for
extended from x86 computers to other architectures. Some of different users a custom set of resources based on a powerful
the most important distributions are: Fedora (with RPM hardware that can handle all the multiple requests. The
package management), Debian (with DEB package format), Hypervisor is the component that allows switching between
Slackware (an old Linux distribution), Gentoo Linux (that multiple virtualized contexts and manages the resources for
uses a source code distribution system) and Android (based the virtual systems. In this paper both a type 2 Hypervisor
on a modified Linux kernel that targets mobile devices). The will be used (the ones from Oracle VM Virtual Box) and a
large number of distributions has increased the user- type 1 Hypervisor (Hyper-V, included in Windows 10). The
friendliness of the GUI interface for these operating systems, difference between the two types is that Type 1 has direct
but has also fragmented the development effort. access to the hardware, while Type 2 runs on top of a
different operating system. The virtual system is called Guest
The use of the Linux kernel is usually seen as restricted and the OS where it runs is called the Guest. Hyper-V is
to the server environment and professional developers, but regarded as a Type 1 Hypervisor as it will control the start of
though Android, it actually has a majority of online usage the operating system that is being installed on and all other
since 2016 [2]. Because of this it is often necessary to virtualization software on that system (such as Virtual Box)
develop and test applications that work across multiple will stop functioning [5]. Compared to other Type 1
operating systems, in a predictable environment. This is also Hypervisors, it is a microkernel Hypervisor [6] that does not
the case in education, especially for engineering students in include the device drivers, and it is the hardware
Information Technology and Computer Science. manufacturer’s role to provide them as shown in Fig1.
There are multiple ways of running Linux at the same
time with Windows on a single computer. This paper surveys

978-1-7281-1624-2/19/$31.00 ©2019 IEEE

Authorized licensed use limited to: University College London. Downloaded on May 25,2020 at 11:38:51 UTC from IEEE Xplore. Restrictions apply.
Guest Guest Guest B. Windows Linux Subsystem
(with drivers and Windows Linux Subsystem was released in 2016 as a
virtualization Windows 10 feature that allows running different
stack) distributions of Linux via a Linux compatible kernel
Hypervisor (with Hypervisor
drivers and
Hypervisor
interface. WSL is providing the access to Bash and usual
virtualization Host OS command line tools. While the initial development for this
stack)
software was made in collaboration with Ubuntu, currently
Hardware Hardware Hardware there are multiple distributions available to download and
a) b) c) install using the Windows Store: Ubuntu, openSUSE, SUSE
Linux Enterprise Server, Debian and Kali Linux. Theur
limited number constitutes a disadvantage for this solution.
In the second version on WSL a Linux kernel will be
included creating full system compatibility. Other limitations
relate to the fact that WSL does not integrate a graphical user
Fig. 1. Virtualization Hypervisor types: a) Monolithic Type 1 Hypervisor interface (it is available however with third party tools), it is
b) Microkernel Type 1 Hypervisor c) Type 2 Hypervisor
not fully compatible with all system calls from Linux [11]
(WSL translates the system calls to Windows kernel using a
pico driver with a Linux System calls interface), supporting
only native amd64 applications [12] and having performance
issues that are not easy to correct in the current
implementation.
WSL’s strength is that it has no need for virtualization
and can be used in parallel with other virtualization
solutions, while having direct access to the host filesystem
and partially to its hardware [13]. In addition, the CPU
usage, memory, and storage are lower when compared to a
traditional virtualization system such as VirtualBox. For
installing Windows Linux Subsystem, in PowerShell, as
Administrator, we run the command:
Fig. 2. VirtualBox VM Storage settings with DVD selection Enable-WindowsOptionalFeature -Online -FeatureName
Microsoft-Windows-Subsystem-Linux
The operating systems running on different virtual
machines have complete isolation even though they are on After the required reboot, the Linux distributions can be
the same computer. Even if in the recent period many downloaded from the Windows Store, as seen in Fig. 3. For
security problems were uncovered [7][8] related to virtual this paper Ubuntu Linux was used, with the latest updates:
machine isolation and even the technology that the virtual sudo apt-get update upgrade
machines are running on [9][10], this technology represents
the basis of modern server hardware abstraction and C. Docker
workload separation. Docker [14] is a virtualization technology launched as
open source in 2013 that allows running software in
A. VirtualBox containers that are isolated from each other [15]. Docker is
Oracle VM VirtualBox is open source cross-platform based on the functionality included in the operating system
virtualization software using a Type 2 Hypervisor. Created in where available (Linux) or by using a virtual machine
2007 by Innotek GmbHit gained a widespread use because it (macOS and Windows). Docker uses images that represent
was free to use (under GNU General Public License version standalone units of software that include all the information
2 for the core features and Oracle VM VirtualBox Extension necessary to run: code, settings, etc. The images can be
Pack Personal Use and Evaluation License for the extension created automatically if a file called Dockerfile is present.
packs) and easy to install on top of an operating system. The Docker engine is the software that takes the images and
VirtualBox has a wide range of uses, from running software creates containers at runtime which are isolated from the
in a different OS than the host OS, to security analysis of hardware infrastructure. In this way the software will run in
viruses and other malware applications. Some experimental the same way regardless on hardware where it is being run
features are often used, such as hardware 3D acceleration, on. Once a container is closed, all its contents are destroyed.
DVD pass-thru and 2D video playback acceleration. There Running Linux inside Windows using Docker can be made
are few limitations that this software has with the most using Linux containers. These, however, run inside a Linux
important being that Oracle VM VirtualBox and Hyper-V Hyper-V virtual machine even if the Docker software hides
cannot run on the same host OS at the same time. [7]. most aspects of creation and management associated with the
Starting with version 6 it no longer supports 32 bit guest VM. The native Docker containers for Windows (that no
operating systems (last version that supports them being longer use virtualization but the primitives from the
version 5). For this paper version 5.2.22 was used. A new Windows kernel) introduced in 2016 for Windows 10 and
VM was created with 2GB of RAM and bridge network Windows Server 2016 or newer are only able to run
access type. The storage settings interface is visible in Fig. 2. Windows applications inside, therefore they will not be used
in this paper. Also due to the technologies used Hyper-V
(Linux software) and Windows native (Windows software)
cannot run at the same time. In order to install Docker

Authorized licensed use limited to: University College London. Downloaded on May 25,2020 at 11:38:51 UTC from IEEE Xplore. Restrictions apply.
Desktop Community Edition (version 2.0.0.3) it is necessary Intel Core i5-6200U CPU @2.30GHz 2.40GHz, 8 GB RAM,
to create an account first, and then obtain the download link. Windows 10 Pro, Version: 10.0.18362.116.
After installation and Hyper-V activation the following
command chain was used: docker run -t -i ubuntu /bin/bash The first tested program will find the first 500000 prime
&& apt-get update && apt-get install gcc numbers in WSL (Distribution- Ubuntu), Cygwin and
VirtualBox (Operating System- Knoppix). This application
will stress the CPU. Only odd numbers will be tested. As
seen in Table I, there are 5 execution times and the
calculated average. The time taken by Docker to execute the
C program is the shortest of all, followed by WSL, with
VirtualBox three times slower and Cygwin an order of
magnitude slower. All the execution times are consistent
with no important variations. The C Code used is:
#include<stdio.h>
#include<math.h>
void main()
{
int i, num=500000, n;
for(n=2; n<num; n++)
Fig. 3. Linux Distributions in Windows Store for(i=3; i<= sqrt(n); i+=2) if (n%i == 0) break;
}
TABLE I. FINDING PRIME NUMBER RESULTS (IN SECONDS)

Tech WSL Cygwin VirtualBox Docker


Run (Ubuntu)

1 0.226 2.369 0.687 0.213


Fig. 4. The creation of a large number processes in a container can
generate errors 2 0.230 2.402 0.675 0.215

Finally this was the environment where frequently errors 3 0.220 2.357 0.719 0.244
were encountered on processes creation in a loop. It is a
known Docker issue [16] for both threads and processes (Fig. 4 0.221 2.328 0.668 0.223
4). Execution of further processes was no longer possible and
the container had to be closed. Creating processes with a 5 0.218 2.330 0.665 0.216
longer delay in between, thus giving the system time to
recover made the issue disappear. Average 0.223 2.3572 0.6828 0.222

D. Cygwin The second program uses FIFO special file for inter-
The project Cygwin was created in 1995 by Steve process communication. As the FIFO file in the filesystem is
Chamberlain, an engineer working in the company Cygnus actually only a reference for the processes to read and write
Solutions as an emulation layer that offers Portable data (with data transfer occurring via the kernel), the storage
Operating System Interface) system calls. It gain quick system it not stressed in this test. As seen in Table II, the
support as it was a cross compilation tool that allowed the time taken by VirtualBox to execute the code is the shortest
creation of executable code for different operating systems with Cygwin and WSL being significantly slower. As an
(Windows, Linux, Sun) without having to change the code observation, the Docker times were the only ones to
significantly[6]. Cygwin gives access to shells (like bash, zsh experience significant variations between runs. The C Code:
and tcsh) and utilities for many programming languages (C,
#include <stdio.h>
Python, Ruby), all available in packages that are optional to #include <string.h>
install. Cygwin is a very light weight tool in terms of #include <fcntl.h>
memory and disk space usage, which can be used to access #include <sys/types.h>
familiar Linux tools. There are some limitations however, for #include <sys/stat.h>
example the end of line conversions that make difficult the #include <unistd.h>
use of functions such as lseek for searched in text and binary void main(void)
files [3]. For compiling C code in Cygwin, the software {
should be downloaded and in the package selection the gcc- pid_t num; int fd;
mknod("test", S_IFIFO | 0666, 0);
core should be selected.
num=fork();
III. PERFORMANCE TESTS if(num<0){ printf(“error”); }
if(num==0){
In this chapter the execution performance will be tested int i;
in regard to CPU performance and disk access speed. The for (i=0;i<20;i++){ fd = open("test", O_WRONLY);
tests were performed multiple times in order to measure the write(fd, "Hello", 5); }
values more accurately. The programs were written in C and }
compiled using the gcc compiler. The tests were performed else{ int j;
for(j=0;j<20;j++){fd = open("test", O_RDONLY);
on a computer with the following specifications: processor: char c[10];

Authorized licensed use limited to: University College London. Downloaded on May 25,2020 at 11:38:51 UTC from IEEE Xplore. Restrictions apply.
read(fd, c, 5); } complex approach (like starting an Xserver) to make this
} work or are incapable altogether. In comparing the usage of
} RAM, Cygwin occupies the least amount followed by
The final program creates a “fork bomb” by calling fork Docker, VirtualBox and then WSL (Ubuntu). From the
in a loop resulting in a large number of processes being execution speed perspective, Docker proved to be the fastest
created. The results (Table III) show that VirtualBox and followed by WSL, but it was the first to experience problems
Docker handle the best the process bomb with VirtualBox if a large number of processes was created in a short amount
only showing greater execution times if the code is run in a of time as shown in Fig.4 (because the programs were tested
loop. Cygwin is the slowest and the process creation is in a loop). Docker also had problems with the execution
visible in Windows Task Manager. The C Code is: times that fluctuated greatly during different runs. The fork
bomb code is handled the best by VirtualBox, as is the IPC
#include <unistd.h> communication using FIFO, with Cygwin being slowest. In
void main() the future the tests will be extended to include I/O and
{
int i;
storage access speed that will allow creating a complete
for (i=0; i<10; i++) fork(); perspective for these solutions of running Linux applications
} in Windows.

TABLE II. FIFO COMMUNICATION RESULTS (IN SECONDS) REFERENCES


[1] L.B. Torvalds, "What would you like to see most in minix?".
Tech WSL Cygwin VirtualBox Docker Newsgroup: comp.os.minix, 26.07.1991,
http://groups.google.co.uk/group/comp.os.minix/
Run (Ubuntu)
[2] www.w3counter.com, “Browser & Platform Market Share, April
2019”, web, Accessed 20.05.2019,
1 0.016 0.036 0.001 0.005 https://www.w3counter.com/globalstats.php?year=2019&month=04
[3] Cygwin authors, “Cygwin User’s Guide”, web,
2 0.013 0.044 0.004 0.004 Accessed:20.05.2019,https://www.cygwin.com/cygwin-ug-
net/cygwin-ug-net.pdf
3 0.014 0.042 0.001 0.004 [4] M. Gerwitz, “GNU/kWindows”, web, Accessed: 20.05.2019,
https://mikegerwitz.com/2016/04/gnu-kwindows
4 0.012 0.032 0.005 0.005 [5] C. Chris, “Hyper-V: Microkernelized or Monolithic”, February 23,
2011, web, Accessed 20.05.2019,
5 0.014 0.033 0.003 0.004 https://blogs.technet.microsoft.com/chenley/2011/02/23/hyper-v-
microkernelized-or-monolithic/
Average 0.0138 0.0374 0.0028 0.0044 [6] J. Shropshire, “Analysis of Monolithic and Microkernel
Architectures: Towards Secure Hypervisor Design”, HICSS '14
Proceedings of the 2014 47th Hawaii International Conference on
TABLE III. FORK BOMB RESULTS (IN SECONDS) System Sciences, Pages 5008-5017, ISBN 978-1-4799-2504-9/14,
2014, DOI 10.1109/HICSS.2014.615
Tech WSL Cygwin VirtualBox Docker [7] J. Geffner, “Venom Virtualized Environment Neglected Operations
Run (Ubuntu) Manipulation, CVE-2015-3456”, web, Accessed 20.05.2019,
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-3456
1 1.022 1.025 0.001 0.005 [8] National Vulnerability Database, “CVE-2018-2694 Detail”, web,
Accessed: 20.05.2019, https://nvd.nist.gov/vuln/detail/CVE-2018-
2 1.252 1.168 0.001 0.007 2694
[9] P. Kocher, D. Genkin, D. Gruss, W. Haas, M. Hamburg, M. Lipp, S.
Mangard, T. Prescher, M. Schwarz, Y. Yarom. “Spectre attacks:
3 1.107 1.406 0.001 0.006 Exploiting speculative execution”, arXiv:1801.01203. 2018 Jan 3.
[10] M. Lipp, M. Schwarz, D. Gruss, T. Prescher, W. Haas, A. Fogh, J. Horn,
4 0.990 1.395 0.001 0.005 S. Mangard, P. Kocher, D. Genkin, Y. Yarom, “Meltdown: Reading
kernel memory from user space”, 27th USENIX Conference on Security
5 1.069 1.462 0.001 0.006 Symposium, 2018, ISBN: 978-1-931971-46-1, pg. 973-990.
[11] J. Hammons, “WSL System Calls”, June 8, 2016, web,
Average 1.088 1.2912 0.001 0.0058 Accessed:20.05.2019,https://blogs.msdn.microsoft.com/wsl/2016/06/
08/wsl-system-calls/
[12] -, “Support for 32-bit i386 ELF binaries”, 18.05.2016, web,
IV. CONCLUSIONS Accessed:20.05.2019, https://github.com/Microsoft/WSL/issues/390
Comparing the presented solutions from the point of view [13] J. Hammons, "Windows Subsystem for Linux Overview", 22 April
of the ease of installation, WSL proved easy to install, 2016, web, Accessed: 20.05.2019,
followed by Cygwin because the user needs to choose https://blogs.msdn.microsoft.com/wsl/2016/04/22/windows-
subsystem-for-linux-overview/
download source, download site and select all the required
[14] S. Goasguen, “Docker Cookbook”, Ed. O’Reilly, 2016, ISBN: 978-1-
packages. VirtualBox requires that the user’s PC support 491-91971-2
virtualization for x64 hosts while Docker requires Hyper-V [15] Docker Inc.” Isolate containers with a user namespace” , web, Accessed:
active making unusable other virtualization techniques. 20.05.2019, https://docs.docker.com/v17.12/engine/security/userns-remap/
From the point of view of usability, VirtualBox allows GUI [16] -, “ulimit should check limits with the container usage; not with the
applications without complex solutions because it is a host usage”, web, Accessed 20.05.2019,
complete virtual machine. The other solutions require more https://github.com/docker/for-linux/issues/654

Authorized licensed use limited to: University College London. Downloaded on May 25,2020 at 11:38:51 UTC from IEEE Xplore. Restrictions apply.

You might also like