Question

I'm programming for quite some years now, but there's one thing that I never understood exactly:

There are 2 types of programming languages. Compiled ones and interpreted ones, while compiled ones first need to be to compiled to a interpreted language, before they can be executed.

For example, C/C++ needs to be compiled to machine language first, before it can be executed.

And here comes my question: Who does actually run a compiled C/C++ Windows/Linux program? Is it interpreded by the CPU directly, or does the OS Kernel execute it and pass the commands to the CPU?

And if the CPU executes it directly, how can the Windows Kernel then deny some calls? Otherwise, does it mean that the Kernel understands machine language as well, or do non-kernel C/C++ programs not compile to machine language?

Was it helpful?

Solution

The program runs on the CPU. The CPU has different levels of privilege, so called "privileged instructions" may only be executed by the kernel - that's how security is enforced by the operating system.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top