Systems Programming | Inter Process Communication

preview_player
Показать описание
Inter Process Communication code example
Рекомендации по теме
Комментарии
Автор

and also i thought the switch expression is evaluated once. The value of the expression is compared with the values of each case
If there is a match, the associated block of code is executed.The break statement breaks out of the switch block and stops the execution.The default statement is optional, and specifies some code to run if there is no case match.

but its like in the second code with the switch, each case if executed, yet it even has a break at the end of each case.
am confused on how it is even possibly working

MUJUZIDENIS-nw
Автор

There something i didn't understand clearly. in the first code we got the child's pid in the parent work space "if(id>0){
printf("Parent process: My child's pid is %d\n", id);
//sleep(3);
wait(NULL);
}"
but then in the second code in the same workspace we are only able to get the parent pid "default:
wait(NULL);
printf("Parent process: child terminated successfully\n");
printf("Parent process: My pid %d\n", getpid());
printf("fork returned %d to the parent process\n", pid);
break;"

MUJUZIDENIS-nw