OSTEP - Virtualization - Processes API

Unix creates a process with a pair of system calls: fork() exec() A third system call can be used by a process to wait until a process it has created to complete. wait() fork() It is used to create a new process In the following example: #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char* argv[]) { printf("Hello world (pid:%d)\n", (int) getpid()); // rc = return code int rc = fork(); if (rc < 0) { // Fork failed fprintf(stderr, "Fork failed\n"); exit(1); } else if (rc == 0) { // Child (new process) printf("Hello, I'm a child (pid:%d)\n", (int) getpid()); } else { // Parent goes down this path printf("Hello, I am a parent of %d (pid:%d)\n", rc, (int) getpid()); } return 0; } A new child process is created when fork() is called.
Read more

OSTEP - Virtualization - Processes

This series contains my notes on the free on line book Operating Systems: Three easy pieces. As a user wants to be able to run multiple processes at once, we have to be able to create the illusion that there are as many processors as each program needs. The OS does this by virtualizing the CPU. (Executing instructions from one process and then changes to another program) This allows multiple programs to run at once.
Read more