LIN 69321 Unix Lecture 3 Hana Filip. LIN 69322 UNIX Resources UNIX Tutorials UNIX help for.
unix-fork
-
Upload
manish-123 -
Category
Documents
-
view
212 -
download
0
Transcript of unix-fork
-
8/15/2019 unix-fork
1/2
4/16/2016 web.mst.edu/~er cal/284/UNIX- for k- exec/For k- Exec-2.cpp
http://web.mst.edu/~ercal/284/UNIX-fork-exec/Fork-Exec-2.cpp 1/2
#include #include #include #include
using std::cout;using std::endl;using std::cerr;
int main(int argc, char * argv[]){
int pid = ‐1;
// Create a child processpid = fork();
if(pid == 0){
cout
-
8/15/2019 unix-fork
2/2
4/16/2016 web.mst.edu/~er cal/284/UNIX- for k- exec/For k- Exec-2.cpp
http://web.mst.edu/~ercal/284/UNIX-fork-exec/Fork-Exec-2.cpp 2/2
else if(pid > 0){
wait(0);
// We know for sure that the child is dead, so print a line of stars// after the ls.cout