« November 2004 | Main | January 2005 »

December 14, 2004

Memory-mapped I/O && port I/O

http://en.wikipedia.org/wiki/Memory_mapped_IO
http://www.informationblast.com/Memory_mapped_IO.html

Posted by Roy at 11:33 AM | Comments (0)

吐了一地

美国的小朋友们太牛了。。
看来中国教育真的有问题啊,还从来没听说过哪个中国小朋友有这么牛的,拿个奥赛金牌就很牛了吧?看看美国今年最优秀的male undergrad(CS领域):
http://www.cra.org/Activities/awards/undergrad/2005.patrascu.html

Mihai Patrascu is a junior at MIT, where he majors in Mathematics with Computer Science.

Mihai's research is in the area of data structures and algorithms. Mihai has solved three major open problems over his three years at MIT: in his freshman year, he solved a problem in data structures that had remained open for the last 20 years—tight upper and lower bounds on the partial-sums problem; in his third semester, he proved logarithmic lower bounds for several problems that were conjectured to require logarithmic time for over 20 years; and in his fourth semester, he made a major breakthrough in dynamic optimality. These and related results have been published in two papers at STOCS and FOCS, the top theory conferences, and in two separate papers at SODA, the premier algorithms conference. His publication record includes an additional four papers.

Mihai also has a perfect academic record, with a 4.0 GPA. Before entering MIT, he received numerous silver and gold medals in Informatics Olympiad competitions. Once at MIT, he worked as a volunteer to help organize the high-school Olympiads in Romania and the Balkans.

Posted by Roy at 11:14 AM | Comments (0)

December 13, 2004

老外真狠

今天是Darpa Site Visit,也就是Genesis组(几位老板合伙申请的项目,包括我老板在内,和UVA的校友现在CMU的Chenxi Wang,Wang看上去像是ABC,口语说的怪溜的)向Darpa汇报工作。看到了有Air Force的人,另外还有New Mexico的一位搞ISR的女教授,看上去非常的nice,还有一位Cornell的教授。还有一个是什么部门的?看来也是CS出身,经常提问题。

我要说的老外的狠处在于,今天中午安排了Working Lunch,我还以为会有什么好饭,上什么高档的西餐馆呢,老实说我还没吃过正经的西餐。没想到就是每人一盒快餐,里面一个三明治,一个cookie,that's all。当然饮料(Soda、Coffee)随便喝。ft了,大家边吃的时候我们组一个人还在边做报告。老外效率真是高啊,又省钱又省事。只是想不通美国人什么都牛,怎么就这个伙食上不去呢?也许就是因为把精力放在了吃以外,他们才这么牛的吧。郁闷,可怜我的胃。

Posted by Roy at 01:48 PM | Comments (0)

December 12, 2004

Computer Bus

Computer Bus:
http://en.wikipedia.org/wiki/Data_bus

The system bus is also called the frontside bus, memory bus, local bus, or host bus.
http://www.webopedia.com/TERM/S/system_bus.html

backside bus:
http://www.webopedia.com/TERM/B/backside_bus.htm

front side bus:
http://wombat.doc.ic.ac.uk/foldoc/foldoc.cgi?query=front+side+bus
http://en.wikipedia.org/wiki/Front_side_bus
On older computers where the L2 cache was not integrated into the CPU, the back side bus connects to the L2 cache, and using this was faster than accessing the RAM via the front side bus. With modern CPUs having L2 cache on the processor die itself, this bus no longer exists, as the CPU's cache is simply checked for the appropriate data before a read request is issued to main memory.

http://www.cnw.com.cn/issues/article.asp?filename=n12433.asp
将L2缓存集成到CPU本身的硅片上。这就减少了处理单元对空间的需求,降低了封装成本,使设计人员可以采用价格较低的静态RAM。由于不再需要连接CPU和内存的外部线路,因此芯片设计人员现在可以将后端总线集成到硅片中。目前几乎所有的主流处理器都将第二级缓存放到芯片上。后端总线现在在芯片上,确切地说,它不再是总线了。

但是,独立后端总线的时代并没有完全过去。例如,苹果公司用于Power Mac G4、Cube 以及Titanium笔记本电脑的400MHz和500MHz PowerPC G4处理器继续采用后端总线设计。G4处理引擎采用处理器上的1MB后端L2缓存和一条与100MHz前端总线相匹配的64位后端总线,以获得最大为800Mb/s的额定数据吞吐量。

Intel和Compaq公司也没有放弃后端总线。提供第三级缓存的高级芯片包括Intel的64位Itanium 处理器和Compaq的Alpha EV8处理器,这两种处理器将继续使用这种总线设计来保持数据传输。

此外,独立的缓存还为采用一个以上处理器的PC或服务器提供更有效的多处理技术开辟了道路。如果每个处理器都没有自己的缓存,那么它就必须与CPU共享内存资源,随着处理器越来越多地占用宝贵的资源,这就会降低总体系统性能。

http://publish.it168.com/cWord/1228.shtml
外频与前端总线频率的区别:前端总线的速度指的是CPU和北桥芯片间总线的速度,更实质性的表示了CPU和外界数据传输的速度。而外频的概念是建立在数字脉冲信号震荡速度基础之上的,也就是说,100MHz外频特指数字脉冲信号在每秒钟震荡一万万次,它更多的影响了PIC及其他总线的频率。之所以前端总线与外频这两个概念容易混淆,主要的原因是在以前的很长一段时间里(主要是在Pentium 4出现之前和刚出现Pentium 4时),前端总线频率与外频是相同的,因此往往直接称前端总线为外频,最终造成这样的误会。随着计算机技术的发展,人们发现前端总线频率需要高于外频,因此采用了QDR(Quad Date Rate)技术,或者其他类似的技术实现这个目前。这些技术的原理类似于AGP的2X或者4X,它们使得前端总线的频率成为外频的2倍、4倍甚至更高,从此之后前端总线和外频的区别才开始被人们重视起来。

Posted by Roy at 08:19 PM | Comments (0)

会引起中毒的蔬菜

http://tech.163.com/2004w11/12751/2004w11_1101737991391.html

鲜黄花菜

 鲜黄花菜中含有秋水仙碱,秋水仙碱进入人体后使人中毒,出现腹泻、呕吐等症状。但秋水仙碱易溶于水,因此,鲜黄花菜在加工时只要用清水充分浸泡、晒干,菜中的秋水仙碱就会消失,食用后一般不会中毒。

发芽的土豆

 发芽的土豆或其变青的表皮中,含有龙葵碱,食用后对胃肠粘膜有较强的刺激性和腐蚀性,对中枢神经有麻痹作用,往往危及生命。因此,食用时,要深削芽胚部分,用冷水浸泡,充分加热煮烧,以消除其毒性。

无根豆芽

 市场上有一种无根豆芽,是用化肥催发的,所用的化肥都含有氮类的化合物。人食用后这种豆芽后,氨在肠道细菌的作用下会转化为亚硝胺,这是一种强致癌物,可使人患胃癌、肝癌、食道癌等。

四季豆和菜豆

 这两种艘中含有皂甙和胰蛋白酶抑制物。如果食用没有煮熟的外表呈现青色的四季豆、菜豆,便会发生中毒。因此,烹调时先将豆煮熟捞出,再加上调味佐料焖煮,便可解除毒性。

新鲜木耳

 含有一种卟啉类光感物质,对光线极为敏感,人食用后经太阳照射可引起日光性皮炎,个别严重的还会因咽喉水肿而发生呼吸困难。因此,新鲜木耳要晒干后方可食用。

紫菜

 如水发后呈蓝紫色,说明生长时已被一种叫环状多肽的有毒物质污染,切不可食用。

蚕豆

 有人吃蚕豆后,会得溶血性黄疸,被称为蚕豆病或蚕豆黄,主要原因是由于这些人体内的红细胞缺乏6-磷酸葡萄糖脱氢酶所致。这种病有遗传性多见于1-3岁的儿童。因此,有此病家族史的应禁食蚕豆。

青番茄 

含有同发芽土豆相同的有毒物质-龙葵碱。食后会产生恶心、呕吐、流涎、头晕等中毒症状,对生命威胁很大。

Posted by Roy at 12:27 PM | Comments (0)

December 11, 2004

一个真的很赞的cooking主页

Berkeley EECS的mm,人又牛,做的菜也awesome...
哈喇子掉了一地,有空要多学习。

http://bwrc.eecs.berkeley.edu/People/Grad_Students/huifangq/food/main.htm

Posted by Roy at 05:32 PM | Comments (0)

December 06, 2004

C startup and exit codes

Read csu/elf-init.c, sysdeps/i386/elf/start.S, && sysdeps/generic/libc-start.c of glibc.
You'll know more!!
Also some important cleanup codes are in
libio/genops.c and stdlib/exit.c

Also there're some nice references:
http://linuxassembly.org/articles/startup.html
On http://linuxassembly.org/resources.htm there's a collection of cool resources, including ABI specs, etc.

Posted by Roy at 12:09 AM | Comments (0)

December 05, 2004

Building toolchain

By "toolchain" here I mean binutils+gcc+glibc.
I didn't read any documentation carefully, so there may be errors.
Of course you should think about why you want to build a new toolchain by yourself?
I'm not doing a cross compilation, so my tools don't need to be self-contained.

First I build binutils, then I build gcc.
Here I pass to gcc's configure two more options:
--with-as=/usr/local/toolchain/bin/as --with-ld=/usr/local/toolchain/bin/ld, which tells gcc where to find binutils.

Otherwise, gcc will use the native binutils to compile glibc later. (And this will be a potential problem if I'm building an older glibc than my system.)

Then when building glibc this option must be passed:
--with-headers=/usr/include
Otherwise it can't find the correct kernel header for glibc.

An interesting problem was when I decided to build another version of glibc using my just obtained gcc.
But at that time gcc would automatically use the glibc I just built.
So when I configure glibc, the configure program will generate some programs to do some tests (for platform independence), something bad will happen. (Because I've modified glibc and normal program won't compile)

The symptom is like this:

checking size of long double... configure: error: cannot compute sizeof (long double), 77


And I think http://sources.redhat.com/ml/crossgcc/2004-05/msg00004.html is a good reference for this article.

Posted by Roy at 10:16 PM | Comments (0)

同学的幽默

今天心血来潮,浏览了一遍当年老同学的blog。
摘录一段如下:

 学校地势高高低低,每天都要骑自行车来回两趟,感觉是此起彼伏,高潮一波接着一波,还真颇有一点“兜风”的味道。不仅如此,每次骑自行车,还能让你觉得自己年轻了好几把,享受到青春年少的意境,个子也长高了,学习成绩也提高了。嘿,还真对得起我那几十刀。
 骑车当然不能只是认真骑车,偶尔也会想想问题,思考一下人生,比如说蓓蓓现在起床了没有?回家烧什么吃?还有什么菜?今天哪里会不会有什么deal? 老马有没有给wp介绍女朋友?小栋有没有变矮?陈安有没有洗澡?王二有没有戒烟?Breezy有没有打老婆?等等等等。

Posted by Roy at 02:20 PM | Comments (0)

December 03, 2004

Compiling glibc

glibc needs kernel headers.
Before building it look at "What's going on with the kernel headers ? " first.
http://www.kernelnewbies.org/faq/

For Redhat, you can search glibc-kernheaders package.
For Debian, it's much easier and I love DEBIAN!!

For general tarball, http://ep09.pld-linux.org/~mmazur/linux-libc-headers/

Posted by Roy at 11:29 PM | Comments (0)