13
OS Homework #2 How to finish it ?

OS Homework #2

Embed Size (px)

DESCRIPTION

OS Homework #2. How to finish it ?. Compile. GNU C Compiler (GCC) Please use gcc file .c -o file -o option specify execute file instead of a.out For C++? g++. Compile. Compile one file and exe gcc hello.c -o hello ./hello Compile multiple files gcc main.c fn_hello.c -o newhello. - PowerPoint PPT Presentation

Citation preview

Page 1: OS Homework #2

OS Homework #2

How to finish it ?

Page 2: OS Homework #2

Compile

• GNU C Compiler (GCC)

• Please use gcc file.c -o file

• -o option specify execute file instead of a.out

• For C++? g++

Page 3: OS Homework #2

Compile

• Compile one file and exegcc hello.c -o hello ./hello

• Compile multiple filesgcc main.c fn_hello.c -o newhello

Page 4: OS Homework #2

Compile

• Creating object files

• Use –c option gcc -c main.c gcc -c fn_hello.c gcc main.o fn_hello.o -o hello

• Link Order?

Page 5: OS Homework #2

Makefile

Page 6: OS Homework #2

Makefile example

Page 7: OS Homework #2

Makefile

• dependency

Page 8: OS Homework #2

Debug

• Warning?

• Segmentation Fault?

• DDD (Data Display Debugger)

• GDB (GNU Debugger)

Page 9: OS Homework #2

Homework

• 1. producer-consumer

• 2. fibonacci

• 3. fibonacci using share memory

• 4. simple popen

• 5. mini-mini shell (optional)

Page 10: OS Homework #2
Page 11: OS Homework #2

Resource

• Please seehttp://www.cmlab.csie.ntu.edu.tw/~xdd/

OS07/resources.html

Page 12: OS Homework #2

Q&A

Page 13: OS Homework #2

Thank You