I want know if compiler interacts with operating system during compilation process.And if yes then which part of compiler interacts with which part of operating system

  • $\begingroup$ There is already a partial answer to this question at cs.stackexchange.com/a/19464/9550 $\endgroup$ Jan 3, 2014 at 18:15
  • $\begingroup$ You may be interested in this project which puts forward an interesting thesis: "I think of operating systems as being special cases of programming languages. The environment that programs run in is the language and the operating system that implements that environment is the language interpreter." losak.sourceforge.net/os_as_compiler.html $\endgroup$
    – PuercoPop
    Feb 25, 2015 at 19:14

1 Answer 1


Compilation is only a process of converting your code to assembly language. To achieve this task there is no need to interact with OS kernel.

If you also mean linking, interaction with OS is again not a requirement. However, if certain optimizations, or naming conventions and versions are involved, linking might access operating system information. Still, again no code is executed in the kernel level.

  • $\begingroup$ Do assembler also not interact with os in compilation process $\endgroup$ Jan 3, 2014 at 18:39
  • $\begingroup$ Nope, conversion to assembler is just a conversion from one language to another. (Just like converting Java to C). Executing an assembler code might pass through OS, depending on the OS, but this is not the "compilation" step either. Linking on the other hand, is building an OS compliant executable and again different than compilation. $\endgroup$ Jan 3, 2014 at 18:45
  • $\begingroup$ So is assembler specific to a processor ? how does it finds instruction set of processor? $\endgroup$ Jan 3, 2014 at 18:59
  • $\begingroup$ Yes it is. You write your assembly code (or convert to it) using the instructions provided to you by your vendor, such as Intel. Different CPUs such as Intel or ARM have different instruction sets. $\endgroup$ Jan 3, 2014 at 19:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.