OS Homework #2

Preview:

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

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 exegcc hello.c -o hello ./hello

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

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?

Makefile

Makefile example

Makefile

• dependency

Debug

• Warning?

• Segmentation Fault?

• DDD (Data Display Debugger)

• GDB (GNU Debugger)

Homework

• 1. producer-consumer

• 2. fibonacci

• 3. fibonacci using share memory

• 4. simple popen

• 5. mini-mini shell (optional)

Resource

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

OS07/resources.html

Q&A

Thank You