The history of Python dates back to the times of World Wide Web. Ask any techie in his mid 40s now and he would tell you how smoothly did IT transform to what it is today. Python was launched in February, 1991 and World Wide Web, some six months later in August same year. Since then the two had overlapped over a wide domain and co-existed, one complementing the other. Python was originally conceived in the year 1989 and released 2 years later. It was created keeping in mind exception handling and interfacing with the Amoeba Os. From being used to code arithmetic calculator to virtualizing physical machines, the language has undergone significant transformations.
Python is The New Way To Virtualize a Physical Machine
Here, in this blog, I will take you on a tour to explore Python, its applications in Physical, virtual servers and how they differ from each other. So, let’s get started.
Like all the other languages, Python too has its ideal use case. Because of its simplicity, it best suits to server-side scripting, which the server finds the easiest to understand. It might sound very contradictory but Python is an interpreted language and cannot be understood by the machine until it is translated to its native codes. But that is the philosophy underlying interpreter – to make the language as easy to comprehend as it might get.
Before we move on to discussing physical machines, we must know what machines are in the first place. Here “machine’ does not imply mechanical, moving devices but computer or server in general. In a broader scope, the term may be used for any device that computes.
Having understood the concept of machines, we must now know the different ways in which a server is classified. Based on hosting type, servers could be dedicated, virtual, or shared but when classification is narrowed to the underpinning technology, all servers are either physical or virtual.
Difference between physical server and virtual server
On a general note, everything you can see or feel or comprises of matter is physical. Physical servers are also defined the same way – servers that exist in reality. If you lease such servers, the provider will allocate you a particular machine from his data center. Means, your hosting will almost always have a physical existence in the form of a server.
Source – optimal network
Virtual machines are virtual in sense that they are only imaginary. Though a virtual server works just like a physical server, it is only imaginary. Even if you were to visit a data center, you would never know which server(s) gas your resources.
Source – Innov8tiv
Virtual machines are made following a concept called “Virtualization”, which basically means conceiving machines that don’t really exist. Computers can be virtualized in one of the following three ways -
Source – geeks for geeks
Para virtualization – is different from the above technique in a way that all the guest OS work in collaboration even though isolated. Also, each machine is aware whether other machines exist or not. Para virtualization also make use of a hypervisor, but it is somewhat less immersed.
Full virtualization – this technique has been deemed the most effective. Guest operating systems are completely unaware of each other’s existence and work as if they existed in solitary. A hypervisor manages the functioning of each OS and interacts with the CPU directly. Refer diagram below.
OS-level virtualization – this is perhaps the most mundane way of incorporating virtual machines in PCs. With OS-level virtualization, you can run one OS within another. It needs no hypervisor because the host operating system is completely aware that a guest system coexists with it.
All the above techniques share some common traits and differ in a few. Full and para virtualization is generally implemented where the CPU is powerful enough to handle resource dilation. OS-level virtualization is achievable even with a desktop, but it has its downsides that the host and guest OS should be the same or else it would lead to architectural conflicts. You can download free to use apps such as VMware if you are wondering to dabble with virtual machines yourself.
Why Python for VMs?
It is but natural to imagine why out of all apps, Python is the most suited for creating Virtual Machines. A closer look would tell you that the answer lies in Python’s simplicity.
As IT became more and more advanced, and with the dawn of AI and machine learning, more focus was made on alleviating logic for humans than the machine. As codes became more and more tough, programmers migrated towards simpler languages to lighten things to some extent. Python was the ideal choice from day one because coding with Python is not very different from what humans speak. To give you a brief idea on how easy it is to code with python, I have compiled some of the functions from my last program below -
Printing “Hello World”
Printing or displaying is the easiest with python. Unlike C++, where you would call the System function and then execute the print command, you can perform print in python in less than a few seconds.
You may omit parenthesis as well.
This is perhaps the function I personally think is the most useful. Also, this could have been why Python was cherry-picked for AI and ML.
In python, you need not define variable types. Also, variables can be allocated at any place you find convenient (make sure to define the same prior to its operation in the program)
You can perform functions without having to unnecessarily think of relevant data type to define with it.
A single p2v operation may involve thousands of variables – or more – and it helps if you could define variable only as and when their needs arise.
Logical operators like OR and AND, in other languages, are defined with || and && respectively. Not only is defining logic with unconventional signs difficult, but also prone to exceptions, given that codes won’t execute with a single missing character.
Luckily, in Python these operators are defined by their name (in lower case). This may have further simplified a lot of operations where physical to virtual conversion was required.
# Example "use of Python in Virtual Machines"
print("both are equal")
Even with all its functionalities, python may not be as useful as C in some places. To tackle this problem developers coded a reference implementation of Python in C. Called Cpython. It is both an interpreter and a compiler, compiling Py codes into bytecodes before executing. To date, CPython is the most widely used implementation of Python.