南昌大学实验报告
姓名:王梦佳
学号:6103115097
邮箱地址:1571212666@qq.com
专业班级:计科153班
实验日期:2018.4.30
课程名称:LINUX程序设计
实验项目名称
Lab 4: Multi-processing in Linux
实验目的
• Understanding the mechanism of multi-processing
• Understanding the idea of process scheduling
• Understanding multi-thread programming
实验步骤
The Fork Question
Fork and fork more
The Collatz conjecture
进程是资源管理的最小单位,而线程是程序执行的最小单位。
实验数据或结果
Determine what will be output at the commented lines LINE X and LINE Y
for fork_problem.c
makefile文件内容:

frork-problem的结果:

• How many unique processes are created using the multi-fork?
three
Complete the code for function fork1 in fork1.c
Complete the code for function fork2 in fork2.c
完善文件内容:

Compile both and run them
fork1的结果:

fork2的结果:

Collatz问题:
Collatz.c直接运行的结果:

运用链表和多线程后的thrd-Collatz.c的运行结果:

网友评论