操作系统_一_A Tour Of Computer Systems_1.1-1.5

How the program translated into other forms?
At first ,we should understand about th

How the program translated into other forms?

At first ,we should understand about the complitation systems.

When we first meet the programming language,wo are curious about how can it really be convert into the word"hello world",we use the language that we can understand,but the machine will not read it.we should owe it to the hard word of some scientists who developed the compiler that down the gate of programming.

1.2 The Compilation Systems

1. preprocessing phrase:     tools:preprocessor

we use the directives(命令) that begins with the # character,such as"#include<stdio.h" (#include<iostream>in c++ instead),and the directives should be used.the preprocessor will insert the directives from the PC into the program text,causing the .i file.

2.Complitation phrase:         tools:complier

the complier translates the .i file into the .s file,which contains the assembly language.We should know that no matter how high-level langhage you are(c,c++,php,python,etc..),at last it will be generated in to the same assembly language.

3.assembly phrase:              tools:assembler

the assembly language is translated into machine langhage,package them at the recollatable object program(可重载项目),contained in hello.o.And it will be a binary file(二进制文件),that we can't read it by the text editor.

4.linking phrase:                    tools:linker

the linking will happen between function.o(like printf.o)and object program(like hello.o).the result is a executable object file(like hello)which will be loaded in the memory.


Tips:The GNU project really is a great miracle,it helps the wide_range of UNIX and free-opensource action.The computer environment today we can enjoy is built from this.


1.3 Why we shoulud understand about the Complitation Systems

This is a valuable question,yes,yet we have the sophisticated complitation systems and it will help us communicate with the hardware,why we still need to learn the compiler:

1.Optimizing program performance:  优化系统性能

Not only we should konw how will work,we should know more about why it works in such way.

To redece many avoidable bugs,we should know: the pointer,the array index,the efficiency of 3 loop ways,and so on.

an then we will understand the nature of the machine.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值