fork1 - sleep(1); } else { cout << "Child...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <unistd.h> #include <iostream> #include <cstdlib> using namespace std; u int main() { i long childPID; l cout << "1\n2\n3\n"; c if(childPID = fork()) { cout << "Parent process: pid " << getpid() << ", ppid " << getppid() << ", child " << childPID << endl;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: sleep(1); } else { cout << "Child process: pid " << getpid() << ", ppid " << getppid() << ", child " << childPID << endl; < } cout << "4\t5\t6\tfrom " << getpid() << endl; exit(0); }...
View Full Document

This note was uploaded on 04/11/2010 for the course CECS 326 taught by Professor Staff during the Spring '08 term at CSU Long Beach.

Ask a homework question - tutors are online