Fundamentals of Linux C programming

Source: Internet
Author: User

1. What is an operating system?

The operating system is a series of software, is the program. We can understand the operating system like this, we operate the computer similar to the operation of the car, our car has body, power system, braking system, steering system and so on, I drive the car is not directly to operate the specific hardware, such as we want to turn the time is not their own direct final control steering wheel, Instead, it is controlled by the steering wheel provided by the car's operating system, where the car: The steering system provides the user with an interface: the steering wheel. The same power system provides the driver with: throttle interface, we can not directly push forward. Control the computer with the steering wheel, brakes, throttle, etc. provided by the car system. This control is safer, more precise, more efficient and more stable. Subsystems together are a complete car to get the operating system. The operating system is also the case, some of the program in charge of different hardware, composed of some small subsystems, and finally composed of computer systems.

2. Computer language History

Objective Concept Machine Language C language

Addition 1001,0001 Add +

Subtraction 1001,0010 Sub-

3. Architecture of the computer

First Layer: Application layer

Second layer: Operating system layer

Layer Three: Hardware physical layer

4. Procedure from source code to executable program

1. Pre-compilation

GCC-E Hello.c-o hello.i
CPP-E Hello.c-o hello.i//GCC integrated with the preprocessor CPP

In the C language program, all start with # are pre-processing instructions, which are given to the CPP preprocessing software. and remove the comment

GCC-E hello.c-o hello.i-v//Parameter-V shows the process of compiling

2. Compiling

Translate the HELLO.I compilation into a compilation Hello.s
At/T compilation Linux
X86 compilation
Gcc-s Hello.i-o Hello.s

3. Compilation

Translating assembly files into machine language is called assembly hello.o object file

Gcc-c Hello.s-o hello.o

4. Links

Run-time files, library files, startup code links link

GCC hello.o

Link the target file and the run-time file, the library file, to form an executable file.

5. HELLO.C source program hello.i preprocessed file Hello.s assembly language file hello.o target file, binary file

GCC Common Parameters-e preprocessing-s compiled to assembly language-C compile to the target file-o output file-v display the entire compilation process information

6. The above process is just a basic framework, there are links to the process of loading.

Fundamentals of Linux C programming

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.