MCPcopy Create free account
hub / github.com/YatSenOS/YatSenOS-Tutorial-Volume-1 / first_process

Function first_process

lab8/src/5/src/kernel/setup.cpp:31–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31void 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
54void second_thread(void *arg) {
55 printf("thread exit\n");

Callers

nothing calls this directly

Calls 2

forkFunction · 0.70
printfFunction · 0.70

Tested by

no test coverage detected