2009年4月28日火曜日

20090421のhomework

1. This week we have talked about system calls. Take your "Hello, world" program from last week and produce the assembler output from the compiler. Post the assembler file on your blog.
・the assembler file
1 .file "hello.c"
2 .section .rodata
3 .LC0:
4 .string "Hello, World!\n"
5 .text
6 .p2align 2,,3
7 .globl main
8 .type main, @function
9 main:
10 pushl %ebp
11 movl %esp, %ebp
12 subl $8, %esp
13 andl $-16, %esp
14 movl $0, %eax
15 addl $15, %eax
16 addl $15, %eax
17 shrl $4, %eax
18 sall $4, %eax
19 subl %eax, %esp
20 subl $12, %esp
21 pushl $.LC0
22 call printf
23 addl $16, %esp
24 movl $0, %eax
25 leave
26 ret
27 .size main, .-main
28 .ident "GCC: (GNU) 3.4.6 [FreeBSD] 20060305"

a. "printf" is the instruction that calls the string output function.
it is a library function.
printf はソフト割り込みをかけていないため
b.
pushl $.LC0. 1個

c. "call printf"

2.
Unfortunately, even "Hello, world" is a little bit complicated. Take the following even shorter program and repeat the above exercise.

1 .file "123.c"
2 .section .rodata
3 .LC0:
4 .string "123"
5 .text
6 .p2align 2,,3
7 .globl main
8 .type main, @function
9 main:
10 pushl %ebp
11 movl %esp, %ebp
12 subl $8, %esp
13 andl $-16, %esp
14 movl $0, %eax
15 addl $15, %eax
16 addl $15, %eax
17 shrl $4, %eax
18 sall $4, %eax
19 subl %eax, %esp
20 movl $.LC0, -4(%ebp)
21 subl $4, %esp
22 pushl $3
23 pushl -4(%ebp)
24 pushl $1
25 call write
26 addl $16, %esp
27 movl $0, %eax
28 leave
29 ret
30 .size main, .-main
31 .ident "GCC: (GNU) 3.4.6 [FreeBSD] 20060305"

a. "write". it is a system call.
b. 3個

3.
Find a list of all of the system calls on the OS of your choice, and post it (or a link) on your blog. How many are there?

319個
http://d.hatena.ne.jp/toshi_hirasawa/20081105/1225885030

4.How long did it take you to complete this homework?

for 1 hour.

2009年4月15日水曜日

System Software Home work

20090414の宿題

1. 送りました。

2.Demonstrate that you have a working compiler setup where you will be able to write programs for class. Capture the output of the compilation and execution of a simple program (such as "Hello, world") and post it on your blog. Include the amount of time it took you to complete this exercise.

> vi 20090414.c

1 #include
2
3 int main()
4 {
5 printf("Hello, World!\n");
6 return 0;
7 }

> gcc 20090414.c -o 20090414
> ./20090414
Hello, World!

3.Read the paper above (Levin) and post your notes about the papers on your blog. (It is not necessary to write up notes about the readings from the textbook.) 

「An Evaluation of the Ninth SOSP Submissions -or- How (and How not) to Write a Good Systems Paper」

 僕の卒論は、実際に運用されることを想定したシステムであり、この分の中ではリアルシステムにあたるものであるという認識をもって読みました。

 論文の評価基準をおさっぱに箇条書きすると
・新しいアイデアか
・新しいアイデアが簡潔に述べられているか
・解決した問題は何か
・既存研究との違い
・関連研究
・実際に実装した論文か
・論文から学んだことは何か
・論文を読むことで学べることは何か
・前提は何か
・文法・語彙は正しいか
という事を評価基準として意識するようにと書いてありました。

 新しいアイデアであるか、解決した問題点は何か、既存研究との違いは何か、は論文を書く上で非常に重要なものであるという認識は誰もが持っていると思います。しかし、関連研究については軽く考えてしまっている場合もあると思います。おそらく著者は限られたページ数の中で自分の研究を出来るだけ詳しく書きたいでしょう。そのため、関連研究などは短めに書いてしまうことも多いと思います。しかし、読み手は関連研究という比較対象がなければ、論文で述べられている研究の位置づけがはっきり見えてこなくなります。関連研究を詳しく述べることではなく、自分の研究との違いを述べることが重要だと思います。

 また、論文を書くときには、読み手がその論文から何かを学べるものでなければならないというのも、重要なことだと思います。事実、僕は卒業研究に手をつける前に、自分の研究に近い分野の論文を読むことで、必要な知識を得ていました。論文を書く際には、自分が陥ってしまったミスや、重要になる基本的な事項、将来それがどのように発展していくのかをはっきりと書くことが重要であり、論文を書いた自分自身や論文の読み手が学ぶものが多かったと感じることができる論文を書くという意識が大切だと思いました。


4.Start reading the Lampson paper; for non-native English speakers, it is apparently a long paper, so I will give you two weeks.
Lampson

5.If you have additional thoughts about the above discussion of programming experience, please email me or post them on your blog.

6.What are the following hexadecimal numbers, in binary二進法 and in decimal?
  1. 0x64 = 0b1100100 : 100
  2. 0x1000= 0b1000000000000 : 4096
  3. 0x100 = 0b100000000 : 256
  4. 0x400 = 0b10000000000 : 1024
  5. 0x1049 = 0b1000000001101 : 4109
7.Define the words "pointer" and "memory address".
・"pointer":ある関数や変数がなんらかの論理的位置情報でアクセスできるとき、その位置を表現する変数
・"memory address":コンピュータにおいてCPUやそのほかのハードウェアがデータの書き込み、読みだす時のメモリ上の位置を表す識別子