os homework #2
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 PresentationTRANSCRIPT
![Page 1: OS Homework #2](https://reader036.vdocuments.site/reader036/viewer/2022081508/56812d0c550346895d91e20f/html5/thumbnails/1.jpg)
OS Homework #2
How to finish it ?
![Page 2: OS Homework #2](https://reader036.vdocuments.site/reader036/viewer/2022081508/56812d0c550346895d91e20f/html5/thumbnails/2.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022081508/56812d0c550346895d91e20f/html5/thumbnails/3.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022081508/56812d0c550346895d91e20f/html5/thumbnails/4.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022081508/56812d0c550346895d91e20f/html5/thumbnails/5.jpg)
Makefile
![Page 6: OS Homework #2](https://reader036.vdocuments.site/reader036/viewer/2022081508/56812d0c550346895d91e20f/html5/thumbnails/6.jpg)
Makefile example
![Page 7: OS Homework #2](https://reader036.vdocuments.site/reader036/viewer/2022081508/56812d0c550346895d91e20f/html5/thumbnails/7.jpg)
Makefile
• dependency
![Page 8: OS Homework #2](https://reader036.vdocuments.site/reader036/viewer/2022081508/56812d0c550346895d91e20f/html5/thumbnails/8.jpg)
Debug
• Warning?
• Segmentation Fault?
• DDD (Data Display Debugger)
• GDB (GNU Debugger)
![Page 9: OS Homework #2](https://reader036.vdocuments.site/reader036/viewer/2022081508/56812d0c550346895d91e20f/html5/thumbnails/9.jpg)
Homework
• 1. producer-consumer
• 2. fibonacci
• 3. fibonacci using share memory
• 4. simple popen
• 5. mini-mini shell (optional)
![Page 10: OS Homework #2](https://reader036.vdocuments.site/reader036/viewer/2022081508/56812d0c550346895d91e20f/html5/thumbnails/10.jpg)
![Page 11: OS Homework #2](https://reader036.vdocuments.site/reader036/viewer/2022081508/56812d0c550346895d91e20f/html5/thumbnails/11.jpg)
Resource
• Please seehttp://www.cmlab.csie.ntu.edu.tw/~xdd/
OS07/resources.html
![Page 12: OS Homework #2](https://reader036.vdocuments.site/reader036/viewer/2022081508/56812d0c550346895d91e20f/html5/thumbnails/12.jpg)
Q&A
![Page 13: OS Homework #2](https://reader036.vdocuments.site/reader036/viewer/2022081508/56812d0c550346895d91e20f/html5/thumbnails/13.jpg)
Thank You