Computer Programming
Linux
C Programming
Unix

Can you run a c or c program without an OS if yes how if no then where is unix or Linux code running?

User Avatar
Wiki User
2011-09-12 14:11:28

Yes and No.

Unix and Linux Kernel code is written such that it is not

dependent on external libraries. Thus, it can run without an OS -

it is, in effect, the OS. The same goes for any OS Kernel. It has

enough code to load device drivers and execute some form of

initialization program.

The Linux kernel is executed by a bootloader, which is generally

written in assembly or very low-level c, and must be told the

location of the kernel, or the location of a 2nd-stage bootloader

which is smart enough to "find" the kernel. An example of the

former type is LILO, an example of the latter type is GRUB.

Beyond this, higher-level C programs must execute within the

scope of a running kernel, which provides such functions as I/O

access, Network access, etc. If you "kill" the kernel, then no

applications are able to continue running, although kernels do have

debug modes, which are mini-kernels that provide enough

functionality to trace back the cause of a problem.


Copyright © 2020 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.