Archive

Author Archive

APUE2e Exercise 10.6 – Solution C

February 16th, 2012 No comments

Using Standard I/O Library to read and write the file. Rather than using signal function, I used sigaction. Thus don’t need to call TELL_WAIT in the for body.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/**   
 * apue-chap10: exercise10-6c.c
 *
 * Description: Standard I/O Library + sigaction
 *
 * Created On: Feb 16, 2012 
 *
 * @author: Huang Zhu
 *
 * @email: zhuhuang.zp@gmail.com
 */
 
#include <apueerr.h>
#include <signal.h>
#include <stdio.h>
#include <fcntl.h>
 
#define __USE_POSIX199309	1
 
static volatile sig_atomic_t sigflag;
static sigset_t newmask, oldmask, zeromask;
 
struct sigaction act, oact1, oact2;
 
static void sig_usr(int signo)
{
	sigflag = 1;
}
 
void TELL_WAIT(void)
{
	act.sa_handler = sig_usr;
	sigemptyset(&act.sa_mask);
	act.sa_flags = 0;
 
	if(sigaction(SIGUSR1, &act, &oact1) < 0)
		err_sys("sigaction SIGUSR1 error");
 
	if(sigaction(SIGUSR2, &act, &oact2) < 0)
		err_sys("sigaction SIGUSR2 error");
 
	sigemptyset(&zeromask);
	sigemptyset(&newmask);
	sigaddset(&newmask, SIGUSR1);
	sigaddset(&newmask, SIGUSR2);
 
	//block SIGUSR1 and SIGUSR2, and save current signal mask
	if(sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0)
		perror("SIG_BLOCK error");
}
 
void TELL_PARENT(pid_t pid)
{
	kill(pid, SIGUSR2);
}
 
void TELL_CHILD(pid_t pid)
{
	kill(pid, SIGUSR1);
}
 
void WAIT_PARENT(void)
{
	while(sigflag == 0)
		sigsuspend(&zeromask);  //set mask and sleep and wait
	sigflag = 0;
 
	if(sigprocmask(SIG_SETMASK, &oldmask,  NULL) < 0)
		perror("SIG_SETMASK error");
}
 
void WAIT_CHILD(void)
{
	while(sigflag == 0)
		sigsuspend(&zeromask);  //set mask and sleep and wait
	sigflag = 0;
 
	if(sigprocmask(SIG_SETMASK, &oldmask,  NULL) < 0)
		perror("SIG_SETMASK error");
}
 
int main(void)
{
	int fd, pid, ppid, counter, round = 5;
	FILE* fp;
	char *filename = "counter.file";
	int i, j;
 
	if((fd = open(filename, O_RDWR | O_CREAT | O_TRUNC | O_SYNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0)
		err_sys("open error");
 
	if((fp = fdopen(fd, "r+")) == NULL )
		err_sys("fdopen error");
 
	if(fputc(0, fp) != EOF){
		printf("Writing initial value of the counter: 0\n");
		fflush(fp); //if fflush is not used, the change of counter cannot be seen instantly by other readers.
	}
 
	if(ferror(fp))
		err_sys("fputc error");
 
	TELL_WAIT();
 
	if((pid = fork()) < 0){
		err_sys("fork error");
	}else if(pid == 0){ //child
		ppid = getppid();
 
		for(i = 0;  i < round; i++){
			printf("\nChild: round %d\n", i+1);
			counter = -1;
 
			rewind(fp);
			counter = fgetc(fp);
			printf("Child: read counter from the file: %d\n", counter);
 
			counter++;
			printf("Child: increase counter to: %d\n", counter);
 
			rewind(fp);
			if(fputc(counter, fp) != EOF){
				printf("Child: Write counter to the file: %d\n", counter);
				fflush(fp);
			}
			if(ferror(fp))
				err_sys("Child: fputc error");
 
			TELL_PARENT(ppid);
 
			WAIT_PARENT();
		}
 
		counter = -1;
		rewind(fp);
		counter = fgetc(fp);
		printf("\nChild: read counter from the file: %d\n", counter);
 
		exit(0);
	}else{ //parent
		for(j = 0; j < round; j++){
			WAIT_CHILD();
			printf("\nParent: round %d\n", j+1);
			counter = -1;
 
			rewind(fp);
			counter = fgetc(fp);
			printf("Parent: read counter from the file: %d\n", counter);
 
			counter++;
			printf("Parent: increase counter to: %d\n", counter);
 
			rewind(fp);
			if(fputc(counter, fp) != EOF){
				printf("Parent: Write counter to the file: %d\n", counter);
				fflush(fp);
			}
			if(ferror(fp))
				err_sys("Parent: fputc error");
 
			TELL_CHILD(pid);
		}
	}
 
	fclose(fp);
	close(fd);
	return 0;
}

APUE2e Exercise 10.6 – Solution B

February 16th, 2012 No comments

Using Standard I/O Library to read and write the file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/**   
 * apue-chap10: exercise10-6b.c
 *
 * Description: Standard I/O Library
 *
 * Created On: Feb 16, 2012 
 *
 * @author: Huang Zhu
 *
 * @email: zhuhuang.zp@gmail.com
 */
 
 
#include <apueerr.h>
#include <signal.h>
#include <stdio.h>
#include <fcntl.h>
 
static volatile sig_atomic_t sigflag;
static sigset_t newmask, oldmask, zeromask;
 
static void sig_usr(int signo)
{
	sigflag = 1;
}
 
void TELL_WAIT(void)
{
	if(signal(SIGUSR1, sig_usr) == SIG_ERR)
		perror("signal(SIGUSR1) error");
	if(signal(SIGUSR2, sig_usr) == SIG_ERR)
		perror("signal(SIGUSR2) error");
	sigemptyset(&zeromask);
	sigemptyset(&newmask);
	sigaddset(&newmask, SIGUSR1);
	sigaddset(&newmask, SIGUSR2);
 
	//block SIGUSR1 and SIGUSR2, and save current signal mask
	if(sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0)
		perror("SIG_BLOCK error");
}
 
void TELL_PARENT(pid_t pid)
{
	kill(pid, SIGUSR2);
}
 
void TELL_CHILD(pid_t pid)
{
	kill(pid, SIGUSR1);
}
 
void WAIT_PARENT(void)
{
	while(sigflag == 0)
		sigsuspend(&zeromask);  //set mask and sleep and wait
	sigflag = 0;
 
	if(sigprocmask(SIG_SETMASK, &oldmask,  NULL) < 0)
		perror("SIG_SETMASK error");
}
 
void WAIT_CHILD(void)
{
	while(sigflag == 0)
		sigsuspend(&zeromask);  //set mask and sleep and wait
	sigflag = 0;
 
	if(sigprocmask(SIG_SETMASK, &oldmask,  NULL) < 0)
		perror("SIG_SETMASK error");
}
 
int main(void)
{
	int fd, pid, ppid, counter, round = 5;
	FILE* fp;
	char *filename = "counter.file";
	int i, j;
 
	if((fd = open(filename, O_RDWR | O_CREAT | O_TRUNC | O_SYNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0)
		err_sys("open error");
 
	if((fp = fdopen(fd, "r+")) == NULL )
		err_sys("fdopen error");
 
	if(fputc(0, fp) != EOF){
		printf("Writing initial value of the counter: 0\n");
		fflush(fp); //if fflush is not used, the change of counter cannot be seen instantly by other readers.
	}
 
	if(ferror(fp))
		err_sys("fputc error");
 
	if((pid = fork()) < 0){
		err_sys("fork error");
	}else if(pid == 0){ //child
		ppid = getppid();
 
		for(i = 0;  i < round; i++){
			printf("\nChild: round %d\n", i+1);
 
			TELL_WAIT();
 
			counter = -1;
 
			rewind(fp);
			counter = fgetc(fp);
			printf("Child: read counter from the file: %d\n", counter);
 
			counter++;
			printf("Child: increase counter to: %d\n", counter);
 
			rewind(fp);
			if(fputc(counter, fp) != EOF){
				printf("Child: Write counter to the file: %d\n", counter);
				fflush(fp);
			}
			if(ferror(fp))
				err_sys("Child: fputc error");
 
			TELL_PARENT(ppid);
 
			WAIT_PARENT();
		}
 
		counter = -1;
		rewind(fp);
		counter = fgetc(fp);
		printf("\nChild: read counter from the file: %d\n", counter);
 
		exit(0);
	}else{ //parent
		for(j = 0; j < round; j++){
			TELL_WAIT(); //set up signal handler
 
			WAIT_CHILD();
			printf("\nParent: round %d\n", j+1);
			counter = -1;
 
			rewind(fp);
			counter = fgetc(fp);
			printf("Parent: read counter from the file: %d\n", counter);
 
			counter++;
			printf("Parent: increase counter to: %d\n", counter);
 
			rewind(fp);
			if(fputc(counter, fp) != EOF){
				printf("Parent: Write counter to the file: %d\n", counter);
				fflush(fp);
			}
			if(ferror(fp))
				err_sys("Parent: fputc error");
 
			TELL_CHILD(pid);
		}
	}
 
	fclose(fp);
	close(fd);
	return 0;
}

APUE2e Exercise 10.6 – Solution A

February 16th, 2012 No comments

Using File I/O to read and write the file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
/**   
 * apue-chap10: exercise10-6a.c
 *
 * Description: FILE I/O
 *
 * Created On: Feb 15, 2012 
 *
 * @author: Huang Zhu
 *
 * @email: zhuhuang.zp@gmail.com
 */
 
#include <apueerr.h>
#include <signal.h>
#include <stdio.h>
#include <fcntl.h>
 
static volatile sig_atomic_t sigflag;
static sigset_t newmask, oldmask, zeromask;
 
static void sig_usr(int signo)
{
	sigflag = 1;
}
 
void TELL_WAIT(void)
{
	if(signal(SIGUSR1, sig_usr) == SIG_ERR)
		perror("signal(SIGUSR1) error");
	if(signal(SIGUSR2, sig_usr) == SIG_ERR)
		perror("signal(SIGUSR2) error");
	sigemptyset(&zeromask);
	sigemptyset(&newmask);
	sigaddset(&newmask, SIGUSR1);
	sigaddset(&newmask, SIGUSR2);
 
	//block SIGUSR1 and SIGUSR2, and save current signal mask
	if(sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0)
		perror("SIG_BLOCK error");
}
 
void TELL_PARENT(pid_t pid)
{
	kill(pid, SIGUSR2);
}
 
void TELL_CHILD(pid_t pid)
{
	kill(pid, SIGUSR1);
}
 
void WAIT_PARENT(void)
{
	while(sigflag == 0)
		sigsuspend(&zeromask);  //set mask and sleep and wait
	sigflag = 0;
 
	if(sigprocmask(SIG_SETMASK, &oldmask,  NULL) < 0)
		perror("SIG_SETMASK error");
}
 
void WAIT_CHILD(void)
{
	while(sigflag == 0)
		sigsuspend(&zeromask);  //set mask and sleep and wait
	sigflag = 0;
 
	if(sigprocmask(SIG_SETMASK, &oldmask,  NULL) < 0)
		perror("SIG_SETMASK error");
}
 
int main(void)
{
	int fd, pid, ppid, counter, round = 5;
	char *filename = "counter.file";
	char *rbuf, *wbuf;
	int i, j;
 
	rbuf = (char *)malloc(sizeof(int));
	wbuf = (char *)malloc(sizeof(int));
 
	if((fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0)
		err_sys("open error");
 
	if(sprintf(wbuf, "%d", 0) < 0)
		err_sys("sprintf error");
 
	if(write(fd, wbuf, sizeof(int)) > 0 ){
		printf("Writing initial value of the counter: %s\n", wbuf);
		fsync(fd);
	}
 
	if((pid = fork()) < 0){
		err_sys("fork error");
	}else if(pid == 0){ //child
		ppid = getppid();
 
		for(i = 0;  i < round; i++){
			printf("\nChild: round %d\n", i+1);
 
			TELL_WAIT(); //set up signal handler
 
			counter = -1;
 
			if(lseek(fd, 0, SEEK_SET) != 0)
				err_sys("Child: lseek error");
			if(read(fd, rbuf, sizeof(int)) < 0)
				err_sys("Child: read error");
			if(sscanf(rbuf, "%d", &counter) == EOF)
				err_sys("Child: sscanf error");
			printf("Child: read counter from the file: %d\n", counter);
 
			counter++;
			printf("Child: increase counter to: %d\n", counter);
 
			if(lseek(fd, 0, SEEK_SET) != 0)
				err_sys("Child: lseek error");
			if(sprintf(wbuf, "%d", counter) < 0)
				err_sys("Child: sprintf error");
 
			if(write(fd, wbuf, sizeof(int)) > 0 ){
				printf("Child: Write counter to the file: %s\n", wbuf);
				fsync(fd);
			}
 
			TELL_PARENT(ppid);
 
			WAIT_PARENT();
		}
 
		counter = -1;
		if(lseek(fd, 0, SEEK_SET) != 0)
			err_sys("Child: lseek error");
		if(read(fd, rbuf, sizeof(int)) < 0)
			err_sys("Child: read error");
		if(sscanf(rbuf, "%d", &counter) == EOF)
			err_sys("Child: sscanf error");
		printf("\nChild: read counter from the file: %d\n", counter);
 
		close(fd);
		exit(0);
	}else{ //parent
		for(j = 0; j < round; j++){
			TELL_WAIT(); //set up signal handler
 
			WAIT_CHILD();
			printf("\nParent: round %d\n", j+1);
			counter = -1;
 
			if(lseek(fd, 0, SEEK_SET) != 0)
				err_sys("Parent: lseek error");
			if(read(fd, rbuf, sizeof(int)) < 0)
				err_sys("Parent: read error");
			if(sscanf(rbuf, "%d", &counter) == EOF)
				err_sys("Parent: sscanf error");
			printf("Parent: read counter from the file: %d\n", counter);
 
			counter++;
			printf("Parent: increase counter to: %d\n", counter);
 
			if(lseek(fd, 0, SEEK_SET) != 0)
				err_sys("Parent: lseek error");
			if(sprintf(wbuf, "%d", counter) < 0)
				err_sys("Parent: sprintf error");
 
			if(write(fd, wbuf, sizeof(int)) > 0 ){
				printf("Parent: Write counter to the file: %s\n", wbuf);
				fsync(fd);
			}
 
			TELL_CHILD(pid);
		}
	}
 
	close(fd);
	return 0;
}

侄女

February 15th, 2012 No comments

小侄女慧欣,超可爱啊。

Categories: 生活点滴 Tags:

态度

February 14th, 2012 No comments

说态度决定一切,有点绝对。但面对事物,你抱有什么样的态度很大程度上决定了你能够做的事,生活,学术,情感都是如此。我需要好好修炼我的态度,不以物喜,不以己悲,强大内心,在这个蛋疼的世界中"高姿态"地活着。

Categories: 五味杂陈 Tags:

失败的2011,希望的2012

February 12th, 2012 1 comment

前几天翻看原臻的博客,看到他写的2012新年愿望,才发现我都没有理出这一年想要做的事,只写了一篇超短的“洗澡跨年”的文章,还是从微博上转过来的,越来越懒了。新年已经过去,不论新历还是农历,但我想还是要对自己负责点,不能太放肆了,补上一篇吧,虽然晚了点。

 

过去的2011年过得比较不顺心,没有论文发表,也没有其他可圈点的成果,我将它列为“失败”的一年。最重要的一个原因,我想,是自己变得懒惰了,没有什么“昂扬”的斗志,处于“混吃等死”的状态。

 

在合理利用时间的问题上一败涂地,把很多时间都奉献给了人人、微博、脸书、寄托、各种电影和电视。剩下的时间,一些用在了读书上,倒是看了不少的书,主要是技术和小说类;一些用在了找对象上,我真急了,不知为何会如此不淡定,被人催的还是自己不耐寂寞;一些用在聊天上,论坛也好,QQ也好,和各种各样的人;…。前天看到一篇文章《蛰伏——背后的黑暗》,深有感触。“过于纷乱的网络习惯让自己没有了读一篇长文章的耐心,自然也就失去了读书的耐性与安详。不断的买进各种精彩的,昂贵的书,痛下决心一定要读完,却总在读书三分钟后忍不住去刷豆瓣刷天涯狗血故事刷糗事百科草蛋网。思来想去,那些浮华的东西终归飘在脑袋顶上的高层,从未落在心底深处,既然这样,放弃又有何妨?”,我又何尝不是,已经无法集中注意力,专注的做一件事情,已经无法收放自如,自己自律,被社交网站、聊天工具给彻底打乱了。当然不是怪它们,它们存在的目的就是让人打发时间,只是自己不够自觉,自制力越来越弱。因此,浪费时间的问题应该列为本人2012年的重点整治对象。

 

记得刚开始做RA的时候,积极性非常高,认真读老板给的paper,自己去找感兴趣的paper读,做project不拖拉。等成了candidate之后,确切说,开始做CPS Framework之后,发现做研究真的需要很大的毅力和耐寂寞的强大内心。从因为2011没有什么成果就被我列为“失败之年”来看,我不太具备这两样东西。可能因为研究课题没有想象的简单,越往深处越复杂,可能因为做的东西偏向理论,没有什么实际的应用,看不到“喜人”的成果,可能因为自己对这课题没有太大兴趣,可能因为自己一个人单打独斗,而老板的支持又比较有限,课题进度异常缓慢,时间一长,就失去了原有的激情,原本计划在2011暑假完成的,拖到现在也没完成。我已经对自己无语了,都不知道两年前的我会有多鄙视现在的我。但是,我想自己还是有救的:因为我想要毕业,而这课题就是我的拦路虎,所以我有理由去战胜它;因为我能为了Cloud Computing而孜孜不倦地找论文看论文,所以还是有叫做“激情”的东西在我的骨子里;因为我知道什么是兴趣,什么是该做的,什么是不该做的,不会因为没有兴趣而不去做该做的事,该完成的任务我会完成;因为那么多的失败之后,我开始反思自己做过的一切,已经有点明白那些地方我做得不好,那些地方可以改进。这一年,我要让我的research开花结果。

 

人都说计算机找工作(实习)什么的简单,本人以亲身经历告诉大家,不简单。当然,我的这个结论只是基于我的自身条件和经历,有很多的exception。总计也投了三十几家公司,四五十个岗位,收到回复的(包括面试,据信,测试)不超过四分之一。实习相比正式工作来说,僧多粥少。有那么几家公司鸟我,我应该感到庆幸才对。而且,google和microsoft还给了我面试,虽然都以失败告终,但也可以够我臭屁一段时间(不过,我不是臭屁的人,这两个面试让我倍感郁闷,多好的机会啊,就这样没了)。找面试的过程中,让我深刻的明白了,学院派和工业界的区别。我学的很多东西,比如unix/linux编程,操作系统内核等,对工业界来说,只是基础,不能成为亮点,虽然我以为是,我需要“实战”的经验。而我的研究课题,在工业界找到相关岗位的可能性几乎为零,新方向,这是必然的。看了很多招聘岗位的需求描述,很多的技术我都没听过,太孤陋寡闻了。不过我还是要避免半桶水的情况出现,即虽然知道很多技术,但都是浅尝辄止。比起这个,我宁愿挑一两个顺眼的,好好研究一番。这一年,除了我的研究,我要为来年找工作做好准备,深入该深入的,了解该了解的,掌握该掌握的。

 

2011年应该是目前为止本人读书最多的一年。多读书有各种好处,不信你读读看。2012年,我要继续,除了那些花了重金买的技术书,也要多涉猎些其他类书籍,不管是小说,自传,还是科普,open choice,只要是好书。技术书重点放在操作系统上,包括Unix/Linux编程,系统内核,网络,Linux应用。其他的包括编程语言(C,C++,C#,Java),算法和数据结构(算法导论)。技术书之外的,目前可有想读的,可求推荐。

 

2011年是我玩得最多的一年,去了纽约,旧金山,丹佛,还去了两个国家公园,花了3K左右,玩得很开心。2012不打算出行,呆在屯里专心学术,存点钱。

 

总结一下,列出以下事项,2012年要好好努力完成,哪怕世界末日:

  1. 合理利用时间,少刷社交网站,多看书和论文,研究和自学的时间合理分配。
  2. 完成CPS Framework的架设,再发两篇或三篇论文。
  3. 多读一些论文,包括相关CPS领域的和自己感兴趣的,比如Cloud Computing,Database,Data Mining等。
  4. 专心研究操作系统,不当半桶水。
  5. 花些时间学习下Window Phone开发,写一个App,不以赚钱为目的,只为练手。
  6. 关注技术类网站,比如CSDN,Tech2IPO,36氪,果壳网,了解最新的科技信息,不做一个286。
  7. 多动手实践,多写代码,找项目做。练语言(主要是C,C++,C#),练算法,练技术(Hadoop,MapReduce等)。
  8. 不再买新书,把已买的书消化掉。
  9. 锻炼自己,包括身体和心理,做个阳光的人,不颓废,不猥琐,不纠结。
  10. 调整作息,规律生活,不做夜猫子。
  11. 存点钱,5K以上。
  12. 不要贪心,懂得舍弃,学术上,生活上,都是如此。
  13. 不因为要找对象而找对象,顺其自然,哪怕有人催。
  14. 宁可别人负我,也不我负别人。
Categories: 博士五年 Tags: , , ,

苦逼的PhD

February 7th, 2012 No comments

TAMU CSSA 2012 龙年春晚音乐小品《大龄学术男青年之歌》

开学第三周

February 4th, 2012 No comments

TA的课CIS450作业布置得比较频繁,lab,quiz,homework等,基本上每周都有两样作业要改。幸好都不难改,题目不难,题量也不大,不然得折腾死。这周有一个quiz,一个homework要改。现在周末时间都拿来改作业了。

去年11月份写完的paper到现在还在改着,第四遍大改,太煎熬了。我有预感,这之后还要继续改。比起第一篇paper,这一篇太折磨人了。原因的话,细想一下,应该有很多。这是篇理论paper,而第一篇偏向实现,文章大部分都在讲实现细节。理论paper最在乎严谨性,前两遍草稿在这方面做得很不好,因为自己急着想发文章,写的太浮躁,写完之后都没考虑一下自己写的东西是否能让自己看懂,能让自己信服(不能)。如果连自己都不能说服,那如何去说服别人。俺还太嫩,有很多东西要学,借此机会好好修理下浮躁的心态,还有急于求成的恶习。

这学期选了个CIS990,自主学习的课。以前选这类课都是跟老板,所以实际上不用做什么东西,继续我手上的活就行了。这次我向老板提了想看看和我的研究方向不同的东西(我的研究方向的参考文章也不多),我提了下cloud computing。这个太火了,我坐不住了,多少该了解一下。老师同意了,他给我找了两篇cloud computing和healthcare结合的paper。但这两篇主要谈cloud computing在healthcare上的应用,而且偏向cloud storage,看了用处不大。之后我自己搜了下cloud computing的文章,网上有很多好资源,比如Google Research, Google Code University,还有一些大学的group,比如https://sites.google.com/site/cloudcomputingwiki/cloud-computing-papershttps://wiki.engr.illinois.edu/display/SRG/Cloud+Computing+Papershttp://code.google.com/edu/parallel/。我挑了些入门的看,什么MapReduce,GFS,Eucalyptus,Hadoop, Bigtable, Dynamo等等。Cloud computing确实有点意思,看完各种感慨。

实习的事到现在还没着落,简历投了不少,大部分都是石沉大海。除了最初的gg和ms面试,之后就没有其他的了。下周Epic会给我一个30分钟的面试,希望能顺利。越来越觉得,找实习这事,对我来说,实力只是一部分,很多时候还要看运气。

Categories: 博士五年 Tags: , , ,

You get to learn how to fight back

February 4th, 2012 No comments

快奔三了,近三十年的日子里碰上了各种各样的人。现在的人,越来越自以为是,自私自利,不顾及他人感受,肆意地强奸他人的意志,耳朵,眼睛等,甚至都没有什么道德底线。而我又是老好人一个,遇事不喜欢与他人争辩,能退让就退让,能躲就躲。但很多时候有人并不领情,你越退让,人越得寸进尺。我想,有时候我该学着反驳,既有利于锻炼口才,提高思维的缜密性,又能教训下犯贱的人,何乐而不为。而且以后工作时很需要这样的,坚持自己的东西,不要让他人轻易磨灭的你的意志。

You get to learn how to fight back.

牢骚一篇

Categories: 五味杂陈 Tags:

Something about Cloud Computing

January 26th, 2012 No comments

Learn about cloud computing
From: http://open.eucalyptus.com/learn

What is cloud computing?

Cloud computing is the access to computers and their functionality via the Internet or a local area network. Users of a cloud request this access from a set of web services that manage a pool of computing resources (i.e., machines, network, storage, operating systems, application development environments, application programs). When granted, a fraction of the resources in the pool is dedicated to the requesting user until he or she releases them. It is called “cloud computing” because the user cannot actually see or specify the physical location and organization of the equipment hosting the resources they are ultimately allowed to use. That is, the resources are drawn from a “cloud” of resources when they are granted to a user and returned to the cloud when they are released. A “cloud” is a set of machines and web services that implement cloud computing.

What is the relationship between virtualization and cloud computing?

Virtualization is the ability to run “virtual machines” on top of a “hypervisor.” A virtual machine (VM) is a software implementation of a machine (i.e., a computer) that executes programs like a physical machine. Each VM includes its own kernel, operating system, supporting libraries and applications. A hypervisor provides a uniform abstraction of the underlying physical machine. Multiple VMs can execute simultaneously on a single hypervisor. The decoupling of the VM from the underlying physical hardware allows the same VM to be started on different physical machines. Thus virtualization is seen as an enabler for cloud computing, allowing the cloud computing provider the necessary flexibility to move and allocate the computing resources requested by the user wherever the physical resources are available.

How are clouds classified?

Given the broad definition of the term “cloud,” the current taxonomy differentiates clouds both in terms of cloud service offerings and cloud types. When categorizing cloud service offerings we often refer to clouds in terms of “service style“ depending on the portion of the software stack delivered as a service. Here we discuss the most common service styles referred to by the acronyms IaaS, PaaS, and SaaS. Cloud ”types“ (including public, private, and hybrid) refer to the nature of access and control with respect to use and provisioning of virtual and physical resources.

What are the most popular cloud service styles?

IaaS

IaaS (Infrastructure as a Service) style clouds provide access to collections of virtualized computer hardware resources, including machines, network, and storage. With IaaS, users assemble their own virtual cluster on which they are responsible for installing, maintaining, and executing their own software stack.

PaaS

PaaS (Platform as a Service) style clouds provide access to a programming or runtime environment with scalable compute and data structures embedded in it. With PaaS, users develop and execute their own applications within an environment offered by the service provider.

SaaS

SaaS (Software as a Service) style clouds deliver access to collections of software application programs. SaaS providers offer users access to specific application programs controlled and executed on the provider’s infrastructure. SaaS is often referred to as “Software on Demand.”

What are cloud types?

Public cloud

Public clouds provide access to computing resources for the general public over the Internet. The public cloud provider allows customers to self-provision resources typically via a web service interface. Customer’s rent access to resources as needed on a pay-as-you-go basis. Public clouds offer access to large pools of scalable resources on a temporary basis without the need for capital investment in data center infrastructure.

Private cloud

Private clouds give users immediate access to computing resources hosted within an organization’s infrastructure. Users self-provision and scale collections of resources drawn from the private cloud, typically via web service interface, just as with a public cloud. However, because it is deployed within the organization’s existing data center—and behind the organization’s firewall—a private cloud is subject to the organization’s physical, electronic, and procedural security measures and thus offers a higher degree of security over sensitive code and data. In addition, private clouds consolidate and optimize the performance of physical hardware through virtualization, and can thus markedly improve data center efficiency while reducing operational expense.

Hybrid cloud

A hybrid cloud combines computing resources (e.g., machines, network, storage, etc.) drawn from one or more public clouds and one or more private clouds at the behest of its users.

Why Cloud Computing?

Cloud computing is seen by some as an important forward-looking model for the distribution and access of computing resources because it offers these potential advantages:

  • Self-service provisioning: Allows users to deploy their own sets of computing resources (machines, network, storage, etc.) as needed without the delays and complications typically involved in resource acquisition; IT supports ongoing customization and enhancement of cloud user experience, while monitoring, managing, and expanding as required the underlying cloud infrastructure.
  • Scalability: Decouples the fluctuating needs of individual users from typical infrastructure constraints, thus easily accommodating rapid increases or decreases in resource demand.
  • Reliability and fault-tolerance: IT can focus on improving critical pieces of infrastructure to achieve pre-determined levels of reliability. Policies addressing expected levels of reliability can be continuosly reassessed and updated without user involvement.
  • Optimization/Consolidation: Maximizes the usage and increases the efficiency of existing infrastructure resources. Extends infrastructure lifecycle. Reduces capital expenditure.
  • QoS (Quality of Service): Allows IT to dynamically reassess the SLA associated with users or groups of users for the resources allocated. Allows the organization to react quickly to changing conditions without unnecessary user involvement or knowledge.
  • Well defined API: Using a well-defined and stable industry standard API avoids locking and ensures interoperability with an ever-growing number of tools and cloud service providers.
  • As-needed availability: Aligns resource expenditure with actual resource usage thus allowing the organization to pay only for the resources required, when they are required.
Categories: 转载转载 Tags: