📜 ⬆️ ⬇️

Parallels Desktop: how we made friends make Mac and Windu

Now there are 75 new features in our latest version of Parallels Desktop 9 for Mac. Of these, 33 are somehow related to the integration of OS X and Windows. And in the very first versions of the product, these functions were simply basic. Today, especially for Habr, we write about how and how it was invented that Windows and Mac live together happily, why they “got introduced” to the “Explorer” and how they deceived the mouse.
image Alexander Grechishkin, Head of Integration Team in Parallels

- How did it all start?
A.G .: At first we had to use the technologies that were already on the market at that time. Virtualization and emulation have existed since the 1990s, and there have even been solutions for working with some operating systems on computers under other operating systems. Therefore, we had the following tasks in the first versions: first, to make the technologies and basic functions exactly the same as in the already existing solutions. Secondly, to invent something of their own, original. The Coherence mode (the ability to see and work with Windows programs on a Mac as if it were native OS X applications) and Shared applications (Windows program icons in the Dock application panel) became “their” unique features.

Coherence function allows you to completely hide Windows itself, leaving only the application itself. In common people, this mode is called “Do not show Windows desktop”. It sounds very simple, but it took a lot of effort to realize this opportunity. This is a very difficult technology associated with a variety of software problems and the need to solve them in non-standard ways. It is also difficult to maintain. And by the way, it is still evolving.
Of course, then - with each new version - we had to invent and implement more and more new things, which had no analogues. But initially we did half of the basic integration of Mouse Synchronization, Shared folders, Copy-Paste, Drag & Drop, Time-synchronization, by analogy with what was already in some form. For example, there were a lot of virtualization emulators (for different platforms) with its own set of functions. To release a new product without this kit would be simply meaningless.
Of course, we could create an emulator without integration at all, something like DOSbox (in which there are no inter-functions, but it perfectly launches old dos toys). By the way, we still have a certain number of users who work with Parallels Desktop on the same principle: they start a virtual machine, it runs Windows in a window, and they don’t need anything else.
But, of course, the development path of the overwhelming majority of software products is evolutionary: you first need to do the basic functionality, and then gradually expand it. The user needs to be motivated to upgrade to the new version (especially if it is paid). And not only by increasing the speed, supporting new technologies (for example, the new Direct X), improved stability and other things, but also attracting interesting and useful features. In our case, such customization - “tuning” of the product - is very often integration - at first it was with Windows, and then with other OSs.

- And what were you guided by among the existing technologies?
A.G .: In general, the idea was this: to implement virtualization technology in the way it was done by Apple. In 2005, Steve Jobs announced Apple’s plans to “finish off” the PowerPC on their computers and switch to Intel chips. In 2009, OS X 10.6 Snow Leopard appeared, the first Apple operating system that no longer supports PowerPC. But, most likely, they all started ten and a half years ago, when Apple began to schedule a modernization of its Mac OS and a plan for switching to x86.
They had to switch from Mac OS 9, sharpened for old hardware, to Mac OS X, and to support all existing programs, write their own emulator. They did it quite effectively, with high speed, and, importantly, this technology turned out to be very transparent and "invisible" to the user. The user clicks on the program, written under PowerPC, on his computer, and opens the same Coherence, the same window for this program. The only thing that it does not get along two different operating systems, and two Mac OS - the old and the new. In general, very similar to us.
Unfortunately, at that time, Parallels Desktop developers did not know about the existence of Rosetta technology in Mac OS X - a dynamic translator for running PowerPC applications on computers with Intel processors. I even had to bring them my computer from home to show it. He brought, showed - and the developers recognized our technology in Coherence, although it was implemented differently: something between Wine and a simple emulator. And as a result, we had a crystallized idea to do as Apple did in that the user would not be shown any boot images and virtual shells from Parallels Desktop. For example, to immediately open Word, and at the same time a regular user did not even guess that this application was not in the Application folder, but somewhere else.
')
- How was Coherence developed?
A.G .: Sergei Belousov wrote the idea (then the founder of the Parallels company) , he then went around the office and told everyone that there was a great idea - to remove the desktop, so that all windows would look exactly like Makovsky’s. We immediately realized that this idea is very good and we need to work on it. "Cut the window and remove the desktop" we could quickly and easily. And then the whole Coherence presentation technology was written by one and only person who still works with us - Sergey Kontsov. To achieve the fact that the user almost did not notice the differences between Windows and Mac applications, it took years of hard work.
image The proof that the idea was really good was that it was copied from us later. But in the beginning we were not sure that the technology would be revolutionary. And although Belousov assured us that everyone would work on it, we were still ashamed to put it by default when booting the virtual machine in the first version (note - on the left - a screenshot from version 2.5) . But as soon as they realized that it works and is popular, they immediately put it by default (from version 3.0). And this mode is still in the lead; almost 80% of users use it in Parallels Desktop.
They also implemented a simple installation of Windows through the Wizard, so that the user simply pressed a couple of buttons and got his own virtual OS. This technology was borrowed from OEM installers, but for the first time for end users it was implemented in our product.
We have been working with Coherence for so long also because this one-word name actually combines a lot of technology. In particular, it includes such a large function as Shared Applications, which forces the user to see the same Microsoft Word as the native application in the Mac. This is the most difficult thing. Externally, the function looks simple, but "inside" is hidden a lot of logic, on which we still continue to work.
15 person-years are invested in Coherence - a whole career as a programmer. And this code makes up about 8% of all source code for Parallels Desktop - this is so big and complex product.

- What else was just as difficult to do?
A.G .: The complexity may be different. Software complexity, algorithmic, complexity to understand how to implement a thing or how it will work. Often we had to go completely nontrivial way.
For example, I will tell you about the function for which I had to climb into the inside of Windows. We have such a technology - SmartMount. That is its essence: when a user inserts a USB flash drive into a Mac computer, then it appears only on the Mac desktop. A person working in Coherence mode wants complete integration - that is, to see the contents of his flash drive in Windows. But in order for it to appear there, it needs to be reconnected into a virtual machine, and in fact it is very inconvenient to do this each time. We decided to use Shared Folders. Since this function is a network file system driver and is shown in Windows as a network medium, then when the USB flash drive connects to a Mac, we forward it through Shared Folders to Windows. Then it automatically enters the Network location. But the user is not clear that he should find his USB flash drive in the Network location: he is used to it, that it is a USB device that looks a certain way and is shown exactly where all removable media is. In standard ways, it is impossible to make the network ball appear as a plug-in device in the device list and also be reflected as USB. And our developer Vasily Zhdanov "took root" (let's call it that) in the "Explorer", and intelligibly "explained" to this program that this thing should be shown that way. And now we have SmartMount showing USB flash drives as external drives.

image
Insert a USB flash drive

image
Saw a USB flash drive

Or you can cite as an example the original way of solving the problem Smart Mouse - a technology that allows a computer mouse to adapt to the application with which the user is currently working. If this is an office application, it behaves in one way, if the toy is different.
In Parallels Desktop, there are two mouse modes - an absolute pointing device, which allows the cursor in both Windows and Mac to move in the same way - with the same speed, movement. It uses only the host mouse. And there is a relative mouse mode, in which the mouse runs inside the virtual machine at its own speed. The latter mode is used in computer games, since they are not at all sharpened under the absolute pointing device. Previously, the cursor in games began to move at a breakneck speed and it was impossible to play. We came up with a way to detect the desired mode without any bindings to the names of programs, libraries or files. It's very simple: if a cursor is visually observed on the screen while the program is running, then an absolute pointing device is needed. In games, the standard cursor almost always turns off and the game draws it itself, therefore, in this type of program, relative mode is needed. Selecting a mouse mode on this principle, as it turned out, works correctly in 95% of cases.

- What kind of team does the whole integration?
A.G .: Now there are 6 people in the Integration team, and they are very different people. Something similar, but not the same. Almost the whole team I typed myself. The only one who was already working when I came was the already mentioned “Father of Coherence” Sergey Kontsov. So I became the head of the department of 1 person, where he himself acted as a playing coach.
All the integration in the first version was done by these two people - and Shared folders, and the work of the mouse, and copy-paste, and drag & drop, and Coherence - almost all the basic integration. A little later, Vasily Zhdanov appeared. Then - Andrei Pokrovsky, who made Shared applications for the first version. And, interestingly, he did it very quickly. When we finished the product and already wanted to sell it, we realized that without icons in the Dock application panel, the main coherence looks unfinished. Kohl came (approx. - Nikolai Dobrovolsky, vice president of PC virtualization) and asked if we could quickly implement it. And Andrew did it in one weekend, writing and debugging about 2000 lines of code. Applications were shown where necessary, they could be run from the Dock. This can be called a truly productive work.
But, for example, Vasily Zhdanov, about whom we have already spoken, is very good at reverse engineering. He quickly delves into the insides of programs, which is very necessary for the implementation of integration, since in this process there is a lot to do in standard ways. And Basil loves to do it very much: he just comes to work and sticks in without being distracted by hunger and well-being. He does not see or hear anything at all. Often, he does not even know the status of the project; he is interested only in his specific task at the moment.
In general, they all know different things, and their performance is different. But they are a TEAM. They are absolutely all able and willing to work, they all have extensive and deep knowledge (which over the years have become VERY great knowledge), and they have a very high level of programming. For seven years, their level has risen so much that they can do almost any task that we have.

- That is, six is ​​enough?
A.G .: At this stage, no longer. We have very short development cycles, and, as I said, we have about 30 integration functions every year. It turns out that you need to do about 3 features per month. Here it should be noted that there are many integration features, but not all of them are made by our team.
In general, I now need 3 people in the Integration team. These are vacancies for those who want to program for all platforms and understand Windows, Mac and Linux (or at least one of these operating systems). The main languages ​​are C ++ and Objective C.
So those who want to work at Parallels in the OS Integration team can write to me personally at alexg@parallels.com. One thing I can definitely promise - interesting non-standard tasks are guaranteed. The rest will be discussed on the spot.

Source: https://habr.com/ru/post/206470/


All Articles