Computer Science Notes

Notes From CS Undergrad Courses FSU

This project is maintained by awa03

Genesis From Hardware To Process

Booting Sequence

Booting

OS Loaders

Booting Sequence Brief

Linux Initialization

Process 1

Runlevels

  1. shutdown
  2. single-user
  3. multi-user
  4. full multi-user
  5. X11

Process Creation

System Calls

Parent Process

pid_t pid;
if((pid = fork()) == 0) {
	while(1){
		print("childs return value %d: I want to play.\n", pid);
	}
} else {
	while(1) {
		print("parent's return value %d: After the project.\n", pid);
	}
}

Child Process

pid_t pid;
if((pid = fork()) == 0) {
	while(1){
		print("childs return value %d: I want to play.\n", pid);
	}
} else {
	while(1) {
		print("parent's return value %d: After the project.\n", pid);
	}
}

Output

childs return value 0: I want to play.\n
childs return value 0: I want to play.\n
childs return value 0: I want to play.\n
...// context switch
parent's return value 3218: After the project.
parent's return value 3218: After the project.
parent's return value 3218: After the project.
...// context switch
childs return value 0: I want to play.\n
childs return value 0: I want to play.\n
childs return value 0: I want to play.\n

Why Clone a Process?

Thread Creation