Thursday, April 25, 2013

Memory Segmentation of a Compiled Program

When a program is compiled and executed, it is loaded into the computer memory as binary codes.
Such binary codes of one program is structured in five segments, in the memory space. Each segment represents a special portion of the memory that is set side for a certain purpose.

Figure 1



The five segments of program memory are shown in figure 1. The first segment is called the Text segment, or Code segment. This is where the assembled machine language instructions of the program are located. Once started, the cpu will read and execute these instructions, one at a time. The register EIP always points to the next instruction to be executed. The execution of the instructions is not necessarily linear in the memory space, since the flow of execution is often redirected by control structures and functions.

The Data and Bss segments, are used to stored global and static variables. Specifically, the data segment is filled with initialized global and static variables, whereas the bss segment is filled with their  uninitialized  counterparts. Both data and bss segments are of fixed sizes.

The next segment down in the memory axis is the  Heap segment. It is a segment of memory that a programmer can directly control. Blocks of memory in this segment can be allocated and used. The size of the heap is dynamic, and it can be managed by allocator and deallocator algorithms. This means a programmer using the heap allocation functions can reserve and free memory on the fly. The growth of the heap moves downward toward higher memory addresses.

The last segment, Stack segment, is a very important a unique segment that deserves more explanation. In a modern program where a lots a functions are called by the main function, The flow of the instruction execution is managed by a mechanism call stack frame. When a function is called by the program, the program needs to remember a few things: the address of the next instruction to run after the function call is finished, the set of local variables associated with this function, the parameters passed to this function during this call. All of these information is stored collectively in the block of memory called stack frame. Each function call will create a stack frame in the stack segment. Figure 2 shows the content of one stack frame.

Figure 2


In the stack frame shown in Figure 2. Starting from the bottom of the stack, parameters passed to the functioned called are stored. The address of the instruction that the execution flow will return after the function call finish is stored above the parameters. The next slot up (lower address) is the so-called saved framed pointer, which is the address of the frame pointer of the previous stack frame. The address of this slot is stored in the EBP register, which always stores the frame pointer of the CURRENT stack frame. Above the saved frame pointer, the local variables are stored. The top of the current stack frame is always pointed by another register, ESP. If the function in question is calling another function, then the value in ESP will become the value of the frame pointer in the next stack frame. After the call of the function, the current stack frame will be popped out, and the previous stack frame then becomes the current stack frame.

Monday, April 15, 2013

US Imperialism and China

US imperial dreams, however, are hardly confined to setting the Middle East ablaze. Imperial ambitions—rooted in the capitalist logic of endless expansion—are inherently limitless. Thus, we see the US today readying to propel the greater Middle East into the abyss, while simultaneously “pivoting” to the Asia-Pacific in order to “contain” a rising China.

US imperialism, however, is destined for defeat (and sooner rather than later). The US, after all, can only use its immense military power to keep potential competitors in check for so long. The universal law of change cannot be held at bay by the barrel of a gun in perpetuity. As Lenin asked and answered in his pamphlet Imperialism: “Is it ‘conceivable’ that in ten or twenty years’ time the relative strength of the imperialist powers will have remained unchanged? Absolutely inconceivable.”

But imperial powers are always dangerously deluded by the strength of their power—impervious to its ultimate limits. As a George W. Bush administration official once remarked to the journalist Ron Suskind: “’We’re an empire now, and when we act, we create our own reality. And while you’re studying that reality—judiciously, as you will—we’ll act again, creating other new realities, which you can study too, and that’s how things will sort out. We’re history’s actors…and you, all of you, will be left to just study what we do.”
(One would be mistaken to believe that such hubris is not as present in the Obama White House as it was in the Bush administration.)

Such arrogance from the power elite—indicative of imperial rot—is but a byproduct of the imperialist imperative of endless expansion and conquest. And it is this very imperative that today compels US imperialism towards igniting a military conflagration in the Middle East threatening to ensnare the global powers. “A great cemetery,” as Luxemburg warned nearly a century ago, awaits such a triumph of barbarism."

A few months ago, James Baker remarked on the Charles Rose show that America is Greece if the dollar were not a reserve currency. Yet the US refuses to reduce Pentagon expenditure even though investment on infrastructure construction is much more productive. Obama's current strategy is that the US could pursue its war policies indefinitely as long as no Americans are killed. That is the reason why drones are extensively used all over the world. However, I firmly believe that this empire building policy is unsustainable and sooner or later the US will follow the Soviet Union as the next country that collapses economically due to military overspending.

Here is what Paul Craig Roberts (an editor of the Wall Street Journal and an Assistant Secretary of the U.S. Treasury) wrote recently:  "Why is Washington ramping up a new cold war?

The answer begins with President Eisenhower’s warning to the American people in his last public address about the military/industrial complex in 1962. I won’t quote the warning as it is available online. Eisenhower pointed out to Americans that unlike previous wars after which the US demilitarized, after World War II the cold war with the Soviet Union kept the power and profits flowing into the military/industrial complex, now known as the military/security complex. President Eisenhower said that the flow of power and profit into the military/industrial complex was a threat to the economic wellbeing and liberty of the American people.

No one paid any attention, and the military/security complex was glad to be rid of the five-star general war hero president when his second term expired."

"In other words, the problem with hot wars is that the need not to win them in order to keep them going (Korea, Vietnam, Iraq, Afghanistan are all long-term wars never won) in order that the profits and power continue to flow to the military/security complex demoralizes the US military and creates the world-wide impression that the “world’s sole superpower” cannot even defeat a few thousand insurgents armed with AK-47s, much less a real army.

In Iraq and Afghanistan more US soldiers have died from demoralization and suicides than from combat. In Iraq, the US was humiliated by having to end the war by putting the Sunni insurgents on the US military payroll and paying them to stop killing US troops. In Korea the US was stopped by an army of a backward third world country that lived on rice. What would happen today if the US “superpower’s” militarily confronted China, a country with an economy on which the US is dependent, about equal in size to the US economy, operating on its home territory? The only chance the evil in Washington would have would be nuclear war, which would mean the destruction of the entire world by Washington’s hubris.

Fortunately, profits are more important to Washington than ending life on earth. Therefore, war with China will be avoided, just as it was avoided with the Soviet Union.

However, China will be presented by Washington and its prostitute media, especially the New York Times, Washington Post, and Murdoch’s collection of whores, as the rising threat to America. The media story will shift the importance of America’s allies from Europe to countries bordering the South China Sea. American taxpayers’ money, or newly printed money, will flow into the “new alliance against China.”

China’s rise is a great boon to the US military/security complex, which governs america in which there is a pretense of “freedom and democracy.” China is the profitable replacement for the “Soviet threat.” As the days go by, the prostitute media will create in the feeble minds of Americans “The CHINA Threat.”

Soon whatever little remains of the US living standard will be sacrificed to Washington’s confrontation with China, along with the seizure of our pensions and personal savings in order to deter “the China threat.”
If only Americans were an intelligent people. Then they might have some prospect of holding on to their incomes, remaining wealth, and liberty. Unfortunately, Americans are so thoroughly plugged into the Matrix that they present as a doomed people, incapable of thought, reason, or ability to comprehend the facts that the rest of the world sees clearly."

All this hype about Iran, China, etc. is all designed to ensure that the Pentagon does not get hit by budget cuts!!!

Sunday, April 14, 2013

GNU Developer Tools

Here are a few debugging tools from the GNU developer toolkit. They are commonly available in most of the Linux distribution. My Linux box runs Ubuntu 12.10.

1. objdump: display hexadecimal and assembly representations of machine languages of an executable.

typical usage: objdump -D 'name-of-the-executable'

You need to understand assembly language to be able to tell what's in output.

2. gdb: debugger to allow programmer to step through a compiled program and examine program memory and processor registers.

A GDB session can be launched as followed:

gdb -q 'name-of-the-executable'

Then one can interactively enter commands to control the start, pause, quit the program, or set breakpoints and examine register values. Common commands used in gdb are:

-break 'function_name': set breakpoint at the entry of a function
-run: start the program (until breakpoint)
-disassemble function: disassemble a function into assembly language
-info registers: see the values in the registers
-info register name-of-register: see the values stored in a particular register
-x/Nxw $name-of-register: examine the content of the memory, pointed by the register. N indicates the number of words to after that starting address.
-x/i: examine the assembly instruction pointed by an address.
-x/s: examine the string pointed by an address.
-continue: continue (until the next breakpoint or the end of the program)
-quit: quit the program

3. Hexdump: to display the hexadecimal content of a file. Common options:

- hexdump -C filename: to display the content of the file in hex, one byte at a time, followed by character

- hexdump -x filename: to display the content of the file in hex, two bytes at a time.

Thursday, March 28, 2013

中国房市泡沫化

中国的房价很明显已经泡沫化。数据(见图)显示,北京房价是当地人民平均年收入的30倍。相比之下,纽约才8倍。房价收入比靠前的国家基本都是腐败落后,贫富分化严重的国家(除了罗马)。任志强说中国的房价是由市场决定。这个没错。但是这个所谓市场是富人和官商勾结的市场,不是平民百姓的市场。



Wednesday, March 27, 2013

HDI Development in Korea

Korea has experienced dramatic changed in the last three decades, specifically in economic development. Although the rate of its economic growth is similar to China, its improvement in education and health clearly outpaces those of China (see figure 1).


Tuesday, March 26, 2013

日本材料技术的世界领先地位

材料学的水平极大程度决定一个国家的最高新科技的水平。好的装甲需要好材料,导弹的外壳需要好材料,飞机发动机叶片需要更优异的材料,最高精尖的军用雷达半导体元器件也需要更好的材料。
而 在材料方面,日本已经甩开了第二名美国极大的身位,剩下的俄罗斯中国之类已经远远不在一个档次,这里以人类的最高精尖的三种材料技术——制作洲际弹道导弹 喷管和壳体以及飞机骨架的高强度碳纤维材料;制作最高性能主动相控阵军用雷达的宽禁带半导体收发组件材料;制作最新式涡轮发动机涡轮叶片的高性能单晶叶 片。
三种顶级科技说明日本远远领先于其他地球国家的最顶级科技。
1,首先是最新式的涡轮发动机叶片的五代单晶材料。
因为涡轮叶片工作环境极为恶劣,并且要在极度高温高压下保持数万转的高转速,所以对于高温高压下的抗蠕变性能的要求是非常高的。这个目前科技最好的解决方法就是让晶体约束朝一个方向伸展,使其材料相比于常规材料来说无晶界,这可以大大提升高温高压下的强度和抗蠕变性能。
[ 转自铁血社区 http://bbs.tiexue.net/ ]
目前人类科技的单晶材料共有五代。
我 们可以发现,越到后面一代,已经没有美国和英国的影子了,老毛子那更是不知道甩到猴年马月去了。如果说四代单晶还有法国作为西方的希望苦苦支撑的话,那么 第五代单晶就是东瀛的独舞——人类最顶级的单晶材料,就是日本的第五代单晶TMS-162/192,日本是目前世界上唯一一个能制造第五代单晶材料的国 家。
有些人可能不知道这意味着什么,我们贴出美国F-22和F-35使用的F119/135发动机的涡轮叶片材料CMSX-10三代高性能单晶作为对比。
我们可以看到,三代单晶的典型代表CMSX-10的抗蠕变性能如下:1100度,137Mpa,220小时。这是西方的顶级水平了。
日本的第五代TMS-162呢?同样条件,寿命高达959小时,接近1000小时寿命,相比于美国材料寿命足足达到4倍有余。
事实上,在这个伟大的技术革新面前,传统的材料学和发动机技术的欧洲顶尖水平公司RR已经选择了屈服。英国罗罗大批进口日本的单晶材料用于制造自己的Trent系列发动机。
[ 转自铁血社区 http://bbs.tiexue.net/ ]
2,再看碳纤维材料。
众所周知,碳纤维因为质量轻巧,强度极高而被视为理想的导弹,特别是最顶尖的洲际弹道导弹材料。包括美国侏儒以及三叉戟D5还有法国M51的新式洲际弹道导弹都用碳-碳和碳-树脂复合材料用于制造洲际导弹的壳体和喷管。在这项技术上日本同样领先于世界水平。
碳纤维分为两种——高强度和高拉伸模量
上面的是日本东丽公司的碳纤维材料,下面是美国大力神公司的
其中IM7被用作制造三叉戟D5的壳体。
而东丽的T1000强度高达7060mpa,拉伸模量在高强度碳纤维中也很高(达到了284Gpa),这些都超过了美国的IM9的美国最高水平。
[ 转自铁血社区 http://bbs.tiexue.net/ ]
碳纤维目前勉强处于同一水平线的只有美日(虽然美国相对较差),其他国家与这两个国家相比都不值一提。
我们来看看俄国人到达了一个怎么样的水平吧
纤 维复合材料特别是碳纤维有机复合材料,在现代飞机上获得了广泛应用。与西方比较俄罗斯这种材料,研究及应用时间稍晚一些,上世纪70年代才着手研究。当时 前苏联国家石墨结构材料研究所、全苏聚合物纤维研究所,以及今日的全俄航空材料研究院,生产出拉伸强度2500~3000MPa、拉伸模量250GPa的 高强度碳纤维,以及模量400~600GPa的高模量碳纤维。后来又研究出4000~5000MPa的中模量碳纤维。总体上看俄罗斯的碳纤维产品,性能水 平不如美日水平高。从高强度纤维产品来看,俄罗斯的YKH、BMH比目前通用的,T300大约低1000Mpa。俄罗斯高模量纤维400~600GPa, 与日本M40J、M60J相近。在中模碳纤维方面与美国的,T800H及T1000G有一定差距,在模量相同的条件之下,后者的强度高出 500~1000MPa。
俄国人最强的水准也不过5000mpa封顶,和美日完全不是一个档次,这还是毛子的实验室水平。
业 内专家告诉记者,目前,全世界碳纤维生产厂家中日本的东丽、东邦和三菱3家公司,代表着目前世界上最先进水平。我国碳纤维的质量、技术和生产规模与 国外差距很大,其中高性能碳纤维技术更是被西方国家垄断和封锁。我国虽然经过多年研究和试生产,但至今尚未掌握高性能碳纤维的核心技术。从技术研发到产业
化难度更大,因此碳纤维要真正实现国产化需要一个漫长的过程。
[ 转自铁血社区 http://bbs.tiexue.net/ ]
可以看到,中国的T800级别的碳纤维也只能在实验室里生产。
而日本的远远强于T800的T1000碳纤维已经走入了市场大量制造了。
事实上,T1000只是东丽80年代的制造水平。可见美日在碳纤维领域领先其他国家20年以上。
3,再看看雷达。
大 家知道,主动相控阵雷达的最关键技术就在于一个个T/R收发组件。事实上,AESA雷达就是数千个收发组件单元组建成一台整的雷达。而T/R组件就是由少 则一个,多则4个MMIC半导体晶片材料封装而成。这个芯片是将雷达的电磁波收发组件集成起来的一个微型电路,既负责电磁波的发出,也负责接收。而这个芯 片就是在整个半导体晶元上蚀刻出电路来的。所以,这个半导体晶圆的晶体生长是整个AESA雷达最关键的技术部分。
这就是F-35的诺斯罗普.格鲁曼公司的APG81雷达的MMIC芯片,APG81雷达由数千个一模一样的这样的MMIC芯片组成。这个芯片是以GaAs为基体蚀刻构筑的。
[ 转自铁血社区 http://bbs.tiexue.net/ ]
但是事实上,GaAs材料因为其禁带过窄,其击穿电压过低,其发射功率是上不去的。所以,迫切需要新一代宽禁带的半导体材料。而这个材料目前已经找到了,就是GaN材料。
而GaN材料的晶体生长是非常困难的,目前也是东瀛率先攻克了GaN薄膜的大规模制造工艺。
1994 年日本日亚化工突破了GaN材料成核生长的关键技术,不久P型GaN采用退火技术得以实现,随后GaNled研制成功。近几年,通过外延技术的提 升,GaNLED的内量子效率大大提升,结合粗化、倒装、PSS衬底等提高光输出效率的技术,GaN基LED已广泛应用于全彩显示、交通信号灯、汽车灯 具、液晶背光、室内照明和路灯照明等领域,半导体照明已经日臻成熟,走进千家万户。
目前,绝大部分GaN基 LED均采用价格相对低廉的蓝宝石为衬底材料制备。然而,蓝宝石衬底与GaN材料有高达17%的晶格失配度,如此大的晶格失配造成了很高的位错密度,导致 GaNLED中的非辐射复合中心增多,限制了其内量子效率的进一步提升。SiC衬底与GaN材料的晶格适配度只有3%,远小于蓝宝石衬底与GaN材料间的 晶格适配度,因此在SiC衬底上外延生长的GaN材料的位错密度会更少,晶体质量会更高,同时SiC的热导率(4.2W/cm.K)远大于蓝宝石,有利于 器件在大电流下工作。
但是SiC衬底的制备难度较高,外延生长GaN的成核也具有一定难度。因此,SiC衬底上 制备GaNLED的技术仅限于以美国CREE为代表的少数掌握SiC衬底囗制备技术的公司手中。目前,美国Cree公司生产的GaNLED封装成白光后, 流明效率已经超过200lm/W,远远超过其他同行厂家。
美国由于无法大规模制造SiC基体的GaN材料,所以求助于日本。可以预见,下一代美国的雷达的材料都将是Made in Japan。
[ 转自铁血社区 http://bbs.tiexue.net/ ]
日前LED上游大厂美国Cree表示,该公司已与三菱化学签订独家授权合约。根据双方协议,三菱化学将可制造、贩卖独立的氮化镓(GaN)基板,并有权签订类似专利范围的再授权协议(similarly-scoped sublicenses)。
据了解,三菱化学光电事业部门总经理Yasuji Kobashi在声明中指出,上述授权合约可望帮助该公司在光电产品领域中拓展氮化镓基板业务。
事 实上,美国F-22的雷 达用日本技术从来就不是什么秘密。早在90年代初,也是日本率先攻克GaAs晶圆的生长工艺,逼着美国购买日亚化工的GaAs晶圆技术用以制造F-22的 APG77雷达。正是日本日亚化工向美国的半导体材料制造的技术许可和转让,美国才得以在90年代后半期发力,利用军用雷达的AESA革命甩开其他国家。

美国富人控制舆论

美国富人控制舆论,核心是压制平民的独立思维.有六种兵器.

1)让政治辩论变得丑陋.金钱+语言游戏=摧毁所有独立思维的平台.让你厌倦,绝望和怀疑自己 的思维.

2)提供注意力寄托.竞技体育,娱乐圈提供注意力的避难场所,也促进政治厌倦.

3)政治正确性的控制.如反犹太,社会主义和不爱国等帽子.

4)平 常积累媒体credibility,关键时候用来造假愚众。用"市场决定论"回应对媒体的质疑.

5)留余地.关键问题上放一点讨论空间,非关键问题上全面 放开,作为民主自由的证据.

6)大力宣传极少数平民变富翁的故事,让99%的人对American dream保持希望.