Can I execute any c made prog without any os platform?

后端 未结 9 656
失恋的感觉
失恋的感觉 2021-01-30 23:46

I googled about it and somewhere I read ....

Yes, you can. That is happening in the case of embedded systems

I think NO, it\'s not poss

9条回答
  •  南方客
    南方客 (楼主)
    2021-01-31 00:31

    You can run a program in a system without an Operating System ... and that program need not be an Operating System itself.

    Think about all the computers (or processors if you prefer) inside a car: engine management, air conditioning, ABS, ..., ...
    All of those system have a program (possibly written in C) running. None of the processors have an OS.

    The Standard specifically differentiates between hosted implementations and freestanding implementations:

        5.1.2.1 Freestanding environment
    1   In a freestanding environment (in which C program execution may take place
        without any benefit of an operating system), the name and type of the
        function called at program startup are implementation-defined. Any library
        facilities available to a freestanding program, other than the minimal set
        required by clause 4, are implementation-defined.
    2   The effect of program termination in a freestanding environment is
        implementation-defined.
    
        5.1.2.2 Hosted environment
    1   A hosted environment need not be provided, but shall conform to the
        following specifications if present.
        ...
    
    

提交回复
热议问题