A tour of computer systems

Information is Bits + Context

Machines only know bits, either 0 or 1.
Context tells us what do the bits mean. We can distinguish a bunch of bits only when we put them into some context. A String of the same bunch of bits in different contexts can have different meanings.

Programs Are Translated by Other Programs into Different Forms

Basically, we have four steps to translate our program into an executable object program that the system can run.

  1. Preprocessing phase(iso)
    When we write a C program called hello.c, we include system header files, for example, stdio.h.
    In this phase, The preprocessor, modifies the origin C program according to directives that begin with # character:
  • #include <stdio.h> command tells the preprocessor to read the content of stdio.h
  • insert the content of stdio.h into the program text, generate the result hello.i file, it's another C program.
  1. Compile
    In this phase, Complile translates hello.i into hello.s, it's a assembly-language program.
  2. Assemble
    In this phase, Assembler translates hello.s into machine language instructions, then packages them and stores the result into hello.o, it is a binary file whose bytes encode machine language but not characters anymore.
  3. Link
    In this phase, Linker merges hello.o with printf.o, and generates the result of hello file, which is an executable object file.
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末盹兢,一起剝皮案震驚了整個(gè)濱河市届宠,隨后出現(xiàn)的幾起案子禁荸,更是在濱河造成了極大的恐慌艺糜,老刑警劉巖,帶你破解...
    沈念sama閱讀 221,273評(píng)論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件兔仰,死亡現(xiàn)場離奇詭異茫负,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)乎赴,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,349評(píng)論 3 398
  • 文/潘曉璐 我一進(jìn)店門忍法,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人榕吼,你說我怎么就攤上這事饿序。” “怎么了友题?”我有些...
    開封第一講書人閱讀 167,709評(píng)論 0 360
  • 文/不壞的土叔 我叫張陵嗤堰,是天一觀的道長。 經(jīng)常有香客問我度宦,道長踢匣,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 59,520評(píng)論 1 296
  • 正文 為了忘掉前任戈抄,我火速辦了婚禮离唬,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘划鸽。我一直安慰自己输莺,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 68,515評(píng)論 6 397
  • 文/花漫 我一把揭開白布裸诽。 她就那樣靜靜地躺著嫂用,像睡著了一般。 火紅的嫁衣襯著肌膚如雪丈冬。 梳的紋絲不亂的頭發(fā)上嘱函,一...
    開封第一講書人閱讀 52,158評(píng)論 1 308
  • 那天,我揣著相機(jī)與錄音埂蕊,去河邊找鬼往弓。 笑死,一個(gè)胖子當(dāng)著我的面吹牛蓄氧,可吹牛的內(nèi)容都是我干的函似。 我是一名探鬼主播,決...
    沈念sama閱讀 40,755評(píng)論 3 421
  • 文/蒼蘭香墨 我猛地睜開眼喉童,長吁一口氣:“原來是場噩夢(mèng)啊……” “哼撇寞!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,660評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤蔑担,失蹤者是張志新(化名)和其女友劉穎露氮,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體钟沛,經(jīng)...
    沈念sama閱讀 46,203評(píng)論 1 319
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,287評(píng)論 3 340
  • 正文 我和宋清朗相戀三年局扶,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了恨统。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,427評(píng)論 1 352
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡三妈,死狀恐怖畜埋,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情畴蒲,我是刑警寧澤悠鞍,帶...
    沈念sama閱讀 36,122評(píng)論 5 349
  • 正文 年R本政府宣布,位于F島的核電站模燥,受9級(jí)特大地震影響咖祭,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜蔫骂,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,801評(píng)論 3 333
  • 文/蒙蒙 一么翰、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧辽旋,春花似錦浩嫌、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,272評(píng)論 0 23
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至溶其,卻和暖如春骚腥,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背握联。 一陣腳步聲響...
    開封第一講書人閱讀 33,393評(píng)論 1 272
  • 我被黑心中介騙來泰國打工桦沉, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人金闽。 一個(gè)月前我還...
    沈念sama閱讀 48,808評(píng)論 3 376
  • 正文 我出身青樓纯露,卻偏偏與公主長得像,于是被迫代替她去往敵國和親代芜。 傳聞我的和親對(duì)象是個(gè)殘疾皇子埠褪,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,440評(píng)論 2 359

推薦閱讀更多精彩內(nèi)容