Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Gx Os
Index -> Programming, Turing -> Turing Submissions
Goto page Previous  1, 2, 3
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mirhagk




PostPosted: Mon Dec 14, 2009 3:17 pm   Post subject: RE:Gx Os

don't think i'd be that good lol
Sponsor
Sponsor
Sponsor
sponsor
DtY




PostPosted: Mon Dec 14, 2009 6:38 pm   Post subject: Re: RE:Gx Os

DemonWasp @ Sun Dec 13, 2009 11:56 pm wrote:
@DtY: No, the type of assembly code used is dependent on the hardware. Modern Apple computers (the last 3 years or so) have shifted to using chips based on the x86 instruction set, probably because it was too expensive to compete both in software and in hardware with the giants backing the x86 instruction set (IBM, Microsoft, Intel, AMD). Previously, Apple computers had used a different chipset that ran on a RISC instruction set; x86 and its 64-bit extension, x86_64, are both CISC. Their instructions would be very different.

What would be dependent on the OS is how system calls are made - not the mechanism of the system call, but which calls are available and their exact behaviour. This is part of why apps compiled for Linux don't work in Windows, Windows apps won't run on OSX and OSX apps won't run on Linux. Applications like Wine attempt to solve this problem.
So, for the same reason that machine code is OS dependant, isn't assembly OS dependant?
Or are there libraries to make assembly work the same across OSes or something?
DemonWasp




PostPosted: Mon Dec 14, 2009 7:30 pm   Post subject: RE:Gx Os

I don't know why you think "machine code" is OS dependent. It is not. The kind machine code instructions contained in the actual executable are dependent solely on the architecture. Their exact alignment and order is based on the compiler and its settings (and even then, many machines will execute instructions out-of-order). In fact, the step from assembly to machine code is a translation step that's barely a second-year university-level CS assignment, if that.

No libraries or other magic can make a program compiled for x86 run on a PowerPC (though this may prove possible with Virtual Machines, provided the guest OS was an x86 OS and that the Virtual Machine could handle said setup...that's in the realm of emulation). It may also prove possible to "translate" from one set of instructions to another, but is not generally easy nor is it guaranteed to be feasible; even if you could, system calls would be difficult.

Executable format is often different (see ELF).

System calls are OS-dependent. These, however, are NOT in the domain of "machine code", as the hardware has an established mechanism for making system calls, but no specification or implementation of those system calls. In fact, the system call API presented by the operating system is often entirely different from one OS to another, as there are many different ways of handling basic problems like I/O, process manipulation, communication, and other requests for access to hardware.
DtY




PostPosted: Mon Dec 14, 2009 8:17 pm   Post subject: RE:Gx Os

So my point was that if you use assembly to write a program that runs on an x86 mac, it will not run on x86 windows, or x86 Linux.
That's right, right?

I'm not talking about asm programs running on different architectures, just different OSes.
DemonWasp




PostPosted: Mon Dec 14, 2009 11:06 pm   Post subject: RE:Gx Os

That depends on what your program does, and how you make it an executable on the various platforms. In general though, a program assembled for one OS will not run on another.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 3 of 3  [ 35 Posts ]
Goto page Previous  1, 2, 3
Jump to:   


Style:  
Search: