SLIDE 1
Exercises for TDDD82, Processes I
January 26, 2018
- 1. Forking processes (based on [1] Excercise 3.4)
Using the program shown below, what will be the output at Line A? #include <sys/types.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> int value = 5; int main() { pid_t pid; pid = fork(); if (pid == 0) { /* child */ value += 15; } else if (pid > 0) { /* parent */ wait(NULL); printf("PARENT: value %d \n", value); /* Line A */ exit(0); } }
- 2. Which techniques could be used in the program of Exercise 1 in order to