Cheap and Secure Web Hosting Provider : See Now

[Answers] how can a program be OS-dependent?

, , No Comments
Problem Detail: 

I know the fact that you cannot run the same machine code on two different machines,

so the software must be machine dependent (i.e Arm program cannot run on either powerpc or x86).

but in reality the software is OS dependent (i.e linux programs cannot run on windows or mac).

how does this happen? my best guess for now is that every OS behaves like a virtual machine and the source is compiled for windows-machine,may be?? and this machine has its own assembly code?

Asked By : sihs

Answered By : gardenhead

You're asking a different question in the body than the title. I'll answer the question "how can a program be OS-dependent?".

There is no universal definition of an OS. At the very least you need a kernel (even then, are we building a monolith or microkernel?), but an OS also usually comes with standard (C) libraries and programs (including service daemons).

If a program uses dynamic linking to depend on a certain standard library (say the C math library), then we need to run on an OS on which that library is available. Likewise, a program may try to interact with other programs through IPC mechanisms, and if they're not running then the program will fail.

Even if we only make use of the kernel, different kernels may e.g. use different IPC mechanisms, and a program written using unix pipes will certainly not work on Windows.

Best Answer from StackOverflow

Question Source :

3.2K people like this

 Download Related Notes/Documents


Post a Comment

Let us know your responses and feedback