One Size Doesn’t Fit All: Why Software Isn’t Universally Compatible
Pinterest Stumbleupon Whatsapp
Advertisement

You’ve just downloaded a feature-packed update to your favorite open source app. Everything is working well, and you use it on your other devices — so it is time to roll it out to those, too.

Except your shiny new Linux laptop isn’t compatible with your Windows installation package. How about your Android tablet? iPhone? PS4? Why can’t you just take that piece of software and use it wherever you like? Let’s explore some different barriers to the dream of “buy once, run anywhere.”

Software Development and OS Architecture

Understanding why software doesn’t work across operating systems requires a little (just a little, I promise) knowledge of how software is made.

The Software Development Process

In a very basic software development flow for desktop, server, and mobile (i.e. not web Programming vs. Web Development: What's the Difference? Programming vs. Web Development: What's the Difference? You might think application programmers and web developers do the same job, but that's far from the truth. Here are the key differences between programmers and web developers. Read More ), a programmer will:

  1. Type some code into one or more files.
  2. Compile the code into something the computer can execute.
  3. Test to make sure the program works as expected.
  4. Package and distribute/deploy the software.

software os compatibility dev process

It is a combination of the first and second steps that concerns us here. The process of compiling software, or turning it from code into the ones and zeroes that a computer understands (machine language) is complex. We won’t get in to it in great detail, but it is useful to understand at a high level what happens.

OS Architecture

One important point to understand is that an operating system isn’t a single entity. Rather, it’s made up of layers of software.

Operating System Kernels

An operating system’s kernel is responsible for communicating with the hardware of the computer. Software communicates its commands to the kernel, which in turn issues commands to the hardware to (for example) read a file from the hard disk, or draw a window on the screen. It basically coordinates all the information (whether it’s stored data, calculations, or user input) between hardware and various pieces of software. The kernel makes all this functionality available to software via system calls.

software os compatibility kernel basics
Image Credit: Wikimedia Commons

Each operating system’s kernel will implement system calls differently, in terms of which ones are available, what they’re called, or what options they take. As a result, software needs to take into account the system calls supported by the kernel of each OS it targets. The system call you use to send data to the GPU in Linux may have a different name, list of information you need to provide, or both in Windows. That exact call may not even be there at all.

System Libraries

In many cases software doesn’t call directly to the kernel. Instead, it calls to system libraries, or collections of basic functions. Libraries exist so (for example) each and every program that saves files to the hard drive doesn’t need to write a function to do so. Instead, it simply links to a system library and uses an existing function. The GLibC library for Linux is a prime example, as are the .DLL files in the Win32 API or the contents of a Mac’s /System/Library directory How To Access The OS X Library Folder & Why It's Handy How To Access The OS X Library Folder & Why It's Handy Most OS X Library folders are best left alone, but it's useful to know your way in and around the User Library. Read More .

software os compatibility system libraries
Image Credit: ScottXW via Wikimedia Commons

System libraries act as a kind of translator between applications and the kernel for routine tasks. Applications make function calls to these libraries, which handle a lot of the low-level details. They may also make system calls to the kernel for convenience. As you might have guessed, this means these libraries are written for a particular kernel, and therefore can’t be used across operating systems with different kernels.

Operating System Execution Headers

The last roadblock to universal software is the format of executable files for the operating systems. An OS expects the files it runs to follow a particular binary file format Everything You Need to Know About File Formats and Their Properties Everything You Need to Know About File Formats and Their Properties We use the word file interchangeably: music, image, spreadsheet, slideshow, and so on. But what makes a file a "file," anyway? Let's try and understand this fundamental part of computing. Read More . For example, the Executable and Linkable Format (ELF) files that run on operating systems such as Linux and FreeBSD must specify certain properties of the file in certain bytes, as shown in the below image.

software os compatibility elf header

The application binary interface (ABI) shown able is of particular importance. A combination of the calls available from processor, kernel, and system libararies, an ABI is similar to an application programming interface (API) in that it defines how two programs communicate with each other. But the API is something used by programmers (humans) in source code to indicate two pieces of software should talk to each other. The ABI is what actually allows them to do so once the software is compiled and run. Each operating system implements a particular ABI, which may or may not change between versions of that same OS.

In general, operating systems implement their own ABI, determined by a combination of the type of processor, the kernel, and any standard system libraries. But sometimes an OS will implement more than one. FreeBSD has support for Linux binaries, for example, because it provides a Linux ABI as an add-on to the FreeBSD kernel (instead of the Linux kernel). This is different from virtualizatiton programs What Is a Virtual Machine? What Is a Virtual Machine? Virtual machines allow you to run other operating systems within your current operating system, but why does that matter? What are the pros and cons? Read More such as VMWare or VirtualBox, which use software to simulate an entire machine (hardware and all). As a result this type of ABI-compatibility is faster, but much more effort to maintain. This is why it’s rare, although Microsoft recently saw the value Ubuntu Is Now Available on the Windows Store Ubuntu Is Now Available on the Windows Store Windows Insiders can now download and install Ubuntu onto Windows 10. This brings Linux and Windows together in an unholy union few ever imagined they'd live long enough to witness. Read More in doing it.

Exception: Interpreted Software

Based on the above we’ve learned that developers write software for one, and only one, type of target system. Except when they don’t. There are many applications that you can download and run on a Mac, then copy and run on Windows, and maybe even copy again and run on Linux with no issues. How is this possible?

Was I lying up until now?

As it turns out, there’s a category of software that looks on the surface like it just “runs everywhere.” You can download and run it on any supported platform — the key word being “supported.” In fact, you’re downloading the source code for the application, while another application (the interpreter) is sort of running the source code directly in real time. This is something of an oversimplification, so let’s look at exactly how this works with a couple languages.

Java

When Java first released, it’s promise was (literally) “write once, run anywhere.” The idea was to create applications by using Java functions for how to save files, make calculations, or create an application window. Then a Java Runtime Enviornment (JRE) for each supported computer platform would run the code, and translate these to native OS functions. The trick to Java, then, is that it doesn’t run “directly” on the operating system. It runs in a part of the JRE called the Java Virtual Machine and that’s what runs on the operating system.

By inserting this additional software layer between the application and the OS, Java allows you to focus on a set of functions that’s the same across operating systems. You tell Java what you want to do, and let the JVM for your system worry about how to actually do it. The below picture shows this in action, where JIDE Software’s Java Desktop Application Framework displays the same application for Mac (top), Windows (middle-left), “pure Java” (middle-right), and Linux (bottom).

software os compatibility jide jdaf
Image Credit: JIDE Software

Java programs don’t precisely “compile” themselves in realtime. Rather, the Java compiler will render them into “bytecode.” You can think of bytecode as a half-baked program. When the developer releases the application it’s compiled as much as it can be without knowing which OS it’s going to run on. When you actually launch it, the JVM will “bake it the rest of the way” to fit the functions particular of the host OS.

Python

A popular interpreted language is Python 5 Reasons Why Python Programming Is Not Useless 5 Reasons Why Python Programming Is Not Useless Python -- You either love it or you hate it. You might even swing from one end to the other like a pendulum. Regardless, Python is a language that's hard to be ambivalent about. Read More . When you run a Python script, the Python interpreter will translate code into instructions for the OS. It can also function similarly to Java: when you “import” code from outside your application it’s compiled to bytecode the first time it’s run. Then the interpreter will know if, on subsequent runs, the original code has changed, at which point it will re-compile it to new bytecode.

A cool byproduct of this “on-demand” running is that you can use the interpreter to develop your scripts interactively. By simply typing “python” at the command line you’ll start up the interpreter, and you can run code and see the results immediately.

software os compatibility python interpreter

This means developers can play around and tweak things “live.” Then, once a line of code does what they want, copy and paste it into a script file (which is much more efficient than the “code-compile-test” cycle that non-interpreted language programmers have to do).

Even When Software Is the Same, It’s Probably Not

Unfortunately for users, the tech industry hasn’t developed a truly “universal” format. And it may never do so. Introducing these types of standards often result in a “least common denominator” solution, with concessions in the interest of getting everyone’s approval.

What do you think? Would you rather have universally-compatible software, even if it meant it wasn’t as good? Or are you OK with the operating system you’re using, and have no interest in the apps from other platforms? Let us know below in the comments!

Image Credits: Masterchief_Productions/Shutterstock

Leave a Reply

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

  1. Mike Walsh
    August 28, 2017 at 5:14 pm

    It's an interesting one, this.

    Java is a case in point. I know Java has got itself a reputation for being a terrible security risk.....but, for all that, it's a truly versatile programming language. And it's probably the only one out of all of them that has managed to come closest to the 'universal solution', due to the fact of the Java Virtual Machine for each OS being the actual interpreter; the 'program' being, as you say, simply the source code.

    I've 're-discovered' Java's versatility anew this last few months. I've run Linux for the last 3 1/2 years, after spending decades fighting everybody's favourite 'whipping boy' from Redmond. Common wisdom in Windows says to dump Java unless you absolutely need it. I've spent 3 years or so distro-hopping, finding the one that suits me (in my case, Puppy Linux!), then settling down to really get to know it inside out. I run multiple Pups on my old Compaq desktop. Pup has a particularly powerful & very easy-to-use sym-link function, which makes it easy to run apps remotely from outside the OS itself.....this ability lending itself to the scenario where one common program/app can be used by multiple OSs. (Perfectly possible, since you can only run one at any given moment in time..!)

    The extension of this scenario includes the ability to run Java in those multiple Puppies, by sym-linking each into a common JRE. Which works brilliantly; in my case, I like to run broadly the same range of core apps in each one of my Pups. This way, I can get on with the same work, no matter which one I decide to use for the day..!!

  2. fcd76218
    August 23, 2017 at 11:12 pm

    Universal software may be convenient but, as you said, by necessity it must be the "lowest common denominator" and therefore, not really optimized for any O/S.

    I prefer software written and compiled for a specific O/S because the code can be made tighter and the resulting program will be more efficient.

    There is no technical reasons that applications for one O/S cannot/should not be ported to other O/Ss. The only reasons preventing that from happening are corporate policy. Ex. Adobe refuses to port its products to Linux. It's not because it can't be done and it's not because they would not make money. It's because of corporate obstinacy.

    • Aaron Peters
      August 26, 2017 at 4:39 am

      I think we're on the same page. :)

      I'd only add that companies may not porting their products to certain platforms just to be jerks, but because they don't see any return on that investment.

      • fcd76218
        August 26, 2017 at 2:06 pm

        "they don't see any return on that investment."
        Chicken - egg conundrum.
        Does a company count its existing customers for the port, or does it port first then hope for pent-up demand?

        I think Adobe, Intuit and many other companies are missing out on good profits by not porting their products to Linux. Unless they are afraid that any Linux version users of their products would be those that are currently using the Windows version via Wine or dual-booting. IOW, it would be a wash.

        I, for one, would welcome a Linux version of TurboTax or TaxAct because the current Linux product, while serviceable, is woefully short on features in comparison.

        • Aaron Peters
          August 28, 2017 at 3:55 pm

          Don't get me wrong, I totally agree. I'm even one of those heretics who would be happy to see a Linux version of Office (OneNote is my org tool of choice at the moment, and I need a copy of Word to ensure writing submissions are formatted correctly).

          But I have to believe there's a financial analyst at Adobe or Intuit or wherever who's looking at the cost of the software port and deciding its more than the number of copies they think they'll sell. Are those sales estimates right? Who knows. But I don't think they're making any arbitrary decisions on it.

    • Mike Walsh
      August 28, 2017 at 5:23 pm

      The optimum 'follow-through' from that is, of course, to run something like like Gentoo.....where every single app and utility is compiled to run with YOUR specific hardware (and no other).

      Maximum efficiency..!