星期四, 九月 24, 2009

[softwares]使用cron来测试

简单介绍一下如何在普通用户权限下使用cron。

1. 什么是cron
cron是一个系统的守护进程。你可以指定它在你想要的时间干活。让它干活的方法就是:
  • 写好一个脚本(bash/python/perl),里面包括你要干的活
  • 在你的cron配置文件中告诉cron在哪个时间去执行这个脚本。
2. 使用cron

创建一个脚本文件foo.sh,让脚本把当前时间存到文本里:
echo `date` >> ~/foo.txt
创建你的crontab文件:
crontab -e
输入:
* * * * * /path/to/foo.sh
表示每分钟执行foo.sh一次。
查看你的crontab文件:
crontab -l
删除你的crontab文件:
crontab -r

然后可以把foo.sh改成你要的任何脚本。用"crontab -e"把时间改成你想要的时间。关于crontab的脚本格式,查看[1][2]或者Appendix。



References:
1. Newbie: Intro to cron, http://www.unixgeeks.org/security/newbie/unix/cron-1.html
2. $ man crontab

Appendix
e.g.
01 * * * * echo "This command is run at one min past every hour"
17 8 * * * echo "This command is run daily at 8:17 am"
17 20 * * * echo "This command is run daily at 8:17 pm"
00 4 * * 0 echo "This command is run at 4 am every Sunday"
* 4 * * Sun echo "So is this"
42 4 1 * * echo "This command is run 4:42 am every 1st of the month"
01 * 19 07 * echo "This command is run hourly on the 19th of July"

星期五, 九月 18, 2009

[课程笔记:CS382M Advanced Computer Architecture]1.前言

读博士是件大事,怎么也得记录一下。关于为什么读博。一个原因是因为自己基础比较差。前几天和bamboo同学聊起,他从高中就开始信息学竞赛,相比自己 大学虽然也是计算机系,但真正认真学 计算机却是从大学毕业以后。这么算下来,我现在的积累,勉强算得上是一个优秀的本科生水平,在硕士生中是普通得不能再普通。接下去,读博士的时间,才真正 开始要努力超过身边的同龄人。当然,另外一个原因是因为对知识的兴趣。学习生活虽然很单调,但总有一些茅舍顿开的时刻,给生活增加一些亮点。

前面简单介绍下读博的原因,下面是主题。以后的博客会记一个[课程笔记:CS382M Advanced Computer Architecture]的学习笔记,作为一个系列。根据所里的规定,博士期间的两门专业课,可以是去听课,也可以用课程报告的方式完成。我已经修完一 门,另一门不想再去选一些跟研究方向关系不大的课程,所以决定自己找一个课程。

Advanced Computer Architecture这门课,很多学校都开。utexas, wisc, cmu, harvard等。之所以选 utexas的这个,主要原因有两个:一是因为Doug Burger最近来所里做了一次演讲,听完演讲后对他的工作非常敬佩;二是这个课程的project和自己的专业方向非常相关,即用模拟器来对体 系结构做 研究,具体到project来说就是用alphasim 模拟器来分析执行的关键路径并优化。





星期一, 九月 14, 2009

仅仅是好还不够

Plan 9 itself has never approached Unix in popularity, and was primarily a research tool. Plan 9 has been criticized as "seem[ing] to function mainly as a device for generating interesting papers on operating-systems research."[8] Eric S. Raymond in his book The Art of Unix Programming speculates on Plan 9's lack of acceptance:

"Plan 9 failed simply because it fell short of being a compelling enough improvement on Unix to displace its ancestor. Compared to Plan 9, Unix creaks and clanks and has obvious rust spots, but it gets the job done well enough to hold its position. There is a lesson here for ambitious system architects: the most dangerous enemy of a better solution is an existing codebase that is just good enough."

--link from Wikipedia: Plan 9

星期四, 九月 10, 2009

[研讨班]Three Generations of EDGE Architecture

Three Generations of EDGE Architecture
by Doug Burger

TRIPS -> TFlex -> E2

Challenge:
Easy to program & Power effficiency

CISC -> RISC -> EDGE?

1 of the 3 favourite paper: critical path prediction, 2001

Doug真是个精力充沛的家伙。昨天夜里刚赶完一篇paper,他还开玩笑地给我们看他的黑眼圈。在talk中他说到他05年解决他的TRIPS里面一个 store cache degree问题的时候,是在宿醉后半夜三点。与平庸的研究者不同,Doug对他正在做的事情充满了那种"我想与全世界来分享我的发现"的激情。整个演讲 过程中,他毫无保留地分享他所有的知识,还不停地问主持人要激光笔、黑板等等,——怕他没把某个问题说明白。
从01年开始,从micro architecture到ISA到compiler,这三个project垂直贯通体系结构的所有领域,在新的物理限制和旧的应用当中找到一个比原来更 强劲更省电的体系结构。
非常激励人。

星期四, 九月 03, 2009

游泳笔记

自由泳:
入水的时候水花一定要小,那样划水的效率才高。
在一手用力往后划时,一手迅速入水,切入水中。

蝶泳:
开始学蝶泳。
打水的技巧,用腰带动,双腿并拢。
划水尚缺乏心得。

另:
今天看到一个游得很慢的游泳高手。25米的泳道,划10下就到了。那些初学者划三下,他才划一下。游得还一样快。
好像在打太极一样,每一招都很慢。只有慢的能做好,才能快得起来。