| 29 | } |
| 30 | |
| 31 | void first_process() |
| 32 | { |
| 33 | int pid = fork(); |
| 34 | |
| 35 | if (pid == -1) |
| 36 | { |
| 37 | printf("can not fork\n"); |
| 38 | asm_halt(); |
| 39 | } |
| 40 | else |
| 41 | { |
| 42 | if (pid) |
| 43 | { |
| 44 | printf("I am father\n"); |
| 45 | asm_halt(); |
| 46 | } |
| 47 | else |
| 48 | { |
| 49 | printf("I am child, exit\n"); |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | void second_thread(void *arg) { |
| 55 | printf("thread exit\n"); |