Why can't Windows run Linux binary executables?

This is a discussion on Why can't Windows run Linux binary executables? within the Tech Board forums, part of the Community Boards category; And then... Why can't Linux run Windows programs? Is the kernel the issue here? Couldn't the kernel coders allow some ...

  1. #1
    UT2004 Addict Kleid-0's Avatar
    Join Date
    Dec 2004
    Posts
    656

    Why can't Windows run Linux binary executables?

    And then...
    Why can't Linux run Windows programs?

    Is the kernel the issue here?
    Couldn't the kernel coders allow some "emulation" of some other OS's system calls so that the executable that runs on that OS runs just as fast on the one with the "emulation"?

    The big question I'm asking is:
    Could Windows add functionality to itself, to run Linux binary executables (ELF) efficiently and natively, if they really wanted to?
    Is it possible?

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    There are two main reasons that binarys from one OS can't be run on another OS. First is the fact that the binarys are in different formats. Linux uses ELF, and Windows uses PE. Now that compatibility can easlily be overcome, but the other problem is the OS library functions that all applications use must be ported over as well. Applications need to use OS system functions to do just about anything at all. This includes printing to the console, opening/closing files, creating windows, etc.

    There is a project called WINE which is attempting to port all the windows system libraries over to linux, but it still has a long ways to go before it is complete.

  3. #3
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Why can't a person that spoke only ancient greek speak to a person who only spoke german?

  4. #4
    Rad gcn_zelda's Avatar
    Join Date
    Mar 2003
    Posts
    942
    Really, though, why would anybody care to speak ancient greek?

  5. #5
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    What would be the chances they'd understand you when you tell them to shove it?

  6. #6
    UT2004 Addict Kleid-0's Avatar
    Join Date
    Dec 2004
    Posts
    656
    Quote Originally Posted by bithub
    There are two main reasons that binarys from one OS can't be run on another OS. First is the fact that the binarys are in different formats. Linux uses ELF, and Windows uses PE. Now that compatibility can easlily be overcome, but the other problem is the OS library functions that all applications use must be ported over as well. Applications need to use OS system functions to do just about anything at all. This includes printing to the console, opening/closing files, creating windows, etc.

    There is a project called WINE which is attempting to port all the windows system libraries over to linux, but it still has a long ways to go before it is complete.
    But what if a user on Windows double-clicks an ELF executable, and somehow the kernel can figure out that its ELF, and so it knows when something like this happens... write(1, "sup foo", 8); the kernel could somehow replace the call with a macro that does: windows_version_of_write("sup foo", 8, CONSOLE_OUT); or whatever.

    Or Windows could just copy the whole open source linux library and just pipe the executable to use that instead of Window's. Then they could rewrite the Linux library to mingle with its own API innards.

    The problem I see with WINE is that it's slow, but if WINE was at the kernel level, then perhaps it could run faster since it would be closer to the machine, or something.

    I know it would be hard for someone to create a kernel-like-emulation for Windows on Linux. But a Linux on Windows, think of the power, Windows could become a WinLinux super system! I know there is a program that runs Linux programs on Windows, but if Microsoft could release Windows with Linux kernel capabilities, then Windows would be an unstoppable giant!

  7. #7
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    You do realize that there is a linux emulator for windows right?

    The problem is that no matter what you'll need a translator to go from one format to another.

  8. #8
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    Well you're talking about running Linux programs on Windows, and there isn't any need to do any of this fancy emulation stuff for that. 99% of Linux programs are open source, and so they can easily be ported to Windows. In fact, I'm having trouble coming up with any notable Linux user application that doesn't exist on Windows.

  9. #9
    UT2004 Addict Kleid-0's Avatar
    Join Date
    Dec 2004
    Posts
    656
    Quote Originally Posted by Thantos
    You do realize that there is a linux emulator for windows right?
    That's what I said in my last post:
    Quote Originally Posted by Kleid-0
    I know there is a program that runs Linux programs on Windows...
    But emulators are slow. If Windows wants to run all Linux apps full throttle, then Windows needs to run ELF apps close to itself, built-in to the system, so that the apps run as fast as possible.

    Quote Originally Posted by Thantos
    The problem is that no matter what you'll need a translator to go from one format to another.
    I'm not totally sure what you're saying.

    Quote Originally Posted by bithub
    Well you're talking about running Linux programs on Windows, and there isn't any need to do any of this fancy emulation stuff for that. 99% of Linux programs are open source, and so they can easily be ported to Windows. In fact, I'm having trouble coming up with any notable Linux user application that doesn't exist on Windows.
    What about assembly? I read about people having problems switching between Operating Systems (mainly from Windows MASM -> ?? Linux) ex: http://groups.google.com/group/alt.o...fd93d1e6c6a2dc
    I feel that there are problems between OS machine code portage, and that can be solved through kernel binary executable discovery. Wouldn't it be nice on Windows if you could download the same EXEs that Linux people download and run the application at the same speed as people on Linux?

    Then Microsoft would conquer because there would be no reason to be on Linux anymore. All of the Linux apps run natively on Microsoft because of something called binary executable discovery that figures out if its an ELF or not.

    I believe this is something close to DOS (16-bit) emulation in XP, not sure though.

  10. #10
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Quote Originally Posted by Kleid-0
    I'm not totally sure what you're saying.
    what he's saying is that no matter how you cut it, you need something to change the basic machine-level code from one OS to the other, wether it's a layer between the binary and OS (an emulator), or a part of the OS itself (it would still be a layer, just not a standalone layer)

    basically, this is how it works:
    you write: print this to the screen
    the compiler writes: since you're on linux, you have to use method L to write it

    when you run your program on Linux:
    the program says: use method L to write this.

    when you run your program through an emulator on windows:
    the emulator sees: use method L to write this.
    the emulator says to the OS: use method W to write this.

    if windows had a built-in emulator (I'm theorizing here):
    windows sees: use method L to write this
    windows figures out that method L is native to linux (or the user configures windows to assume this for this binary)
    windows uses a built-in emulator to translate that to: use method W to write this
    windows' built-in emulator passes that further into the kernel.

    as you can see, even if that were somehow embedded in the kernel, it would still be there, and it would bulk up the kernel, making it less efficient overall.

    the big answer to your big question:
    yes, windows could build that in, but microsoft is in the business of building windows. They do not want to build windows+linux+mac+whatever supergod operating system. it's too much work and really not worth it. plus, I can't imagine that really be good for anything anyway... besides, that would take ALOT of money, and processing power, and if you wanted to add mac in the mix you'd need an insanely huge amount of hardware knowhow. it'd be near impossible in fact.

    the small answer to your big question:
    yes, but how would that benefit microsoft?
    Last edited by major_small; 11-13-2005 at 07:31 PM.
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  11. #11
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    Then Microsoft would conquer because there would be no reason to be on Linux anymore.
    Except that people don't run Linux for the applications, they run it for the operating system.

  12. #12
    UT2004 Addict Kleid-0's Avatar
    Join Date
    Dec 2004
    Posts
    656
    Quote Originally Posted by major_small
    the big answer to your big question:
    yes, windows could build that in, but microsoft is in the business of building windows. They do not want to build windows+linux+mac+whatever supergod operating system. it's too much work and really not worth it. plus, I can't imagine that really be good for anything anyway... besides, that would take ALOT of money, and processing power, and if you wanted to add mac in the mix you'd need an insanely huge amount of hardware knowhow. it'd be near impossible in fact.
    Hmmm...ok you're probably right on that, that Microsoft would have no motive to natively run Linux applications on its Windows operating system.

    BUT, I do believe Linux would want to run Windows apps natively.
    Now, if I was a super genius, could I convert WINE to allow the kernel to be able to read the Windows executable file format?
    ^^^
    The super big question lol


    The kernel would become much bigger, but that's a given...

    So what would happen, is something like this:
    Code:
    $: ./flashmx
    ... the kernel recognizes that this is a windows application
    ... initiates the windows library filled with window calls wrappers
    ... the app calls those wrapper functions
    The wrapper functions would be like this:
    Code:
    void showWindow(Win32Window& _w)
    {
      // This would go to a linux library GUI function
      Gtk::window *w = get_gtk_window_from_win32_window(_w);
      gtk_show_window(w);
    }
    And the kernel knows to call those because the disassembler code looks like this:
    Code:
    push eax
    push ebx
    call win32_call_showWindow
    Except the kernel probably wouldn't use the disassembler code for the win32 app, because it's super smart! (because it can read the Windows executable file format somehow).

    Why do this instead of WINE?
    - Because the Windows apps are faster in the kernel
    - The vision of playing Doom 3 as fast as it runs on Windows

    Why NOT to do this?
    - Kernel crashes (because WINE crashes a lot)

    The plans?
    - To make it a module for the kernel, that way when you're not running a windows app, you can simply unload the module:
    Code:
    modprobe -r WinRunner
    Now...is this vision realistic?

  13. #13
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Most windows apps don't run in kernel mode they run in user mode even user32.dll which is used to create windows, dialog boxes and other user interface elements is run in user mode.
    If you ported a linux app to windows it's going to run faster then if the binary was run thru an emulator.
    Another problem is that even program that are designed to be portable loose some efficancy because they don't take advantage of the structure of a particular OS they have to work for all supported OSs. This problem would be even worse in an emulated environment.

  14. #14
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,528
    What is more realistic is a dual boot setup. Just use one or the other.

  15. #15
    UT2004 Addict Kleid-0's Avatar
    Join Date
    Dec 2004
    Posts
    656
    Quote Originally Posted by Quantum1024
    This problem would be even worse in an emulated environment.
    But is my vision an emulation?

    Or is it a kernel feature? If the windows execution format is inside of linux as an internel system (much like how Linux handles ELF) (like an exact copy of Windows runtime built into Linux), then I doubt it would be called an 'emulation', and thus wouldn't be slow.

    Quote Originally Posted by Quantum1024
    Another problem is that even program that are designed to be portable loose some efficancy because they don't take advantage of the structure of a particular OS they have to work for all supported OSs.
    And if this system was built by a super genius, then people could create binary executables for Windows, or Linux, and it would all run at the same speed and just as efficiently on Linux...then Linux would have no problem at becoming the best OS.

    then of course there's the kernel bulge.

    Quote Originally Posted by kermit
    What is more realistic is a dual boot setup. Just use one or the other.
    True, but I'm thinking of an all-in-one package. People wouldn't need Windows anymore to run [the current windows apps that WINE can run], but rather they could use this super version of Linux that can run it all (most), and run it just as quickly as Windows!



    Is this possible?

Page 1 of 3 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Build linux on windows
    By baash05 in forum Linux Programming
    Replies: 6
    Last Post: 02-19-2008, 10:12 PM
  2. How to run windows based application in linux
    By Bargi in forum Linux Programming
    Replies: 5
    Last Post: 02-07-2008, 12:46 AM
  3. programming in linux or windows?
    By rtunez33 in forum C Programming
    Replies: 11
    Last Post: 09-19-2004, 08:22 PM
  4. linux and windows lookup host processes
    By Lynux-Penguin in forum Tech Board
    Replies: 0
    Last Post: 09-01-2003, 12:54 AM
  5. linux vs. windows
    By muttski in forum Linux Programming
    Replies: 18
    Last Post: 04-07-2002, 10:03 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21