Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 140 Lecture Notes: Processes and ThreadsSlide 1 UNIX Fork/Exec Example int pid = fork(); if (pid == 0) { exec("foo"); } else { waitpid(pid, &status,

Similar presentations


Presentation on theme: "CS 140 Lecture Notes: Processes and ThreadsSlide 1 UNIX Fork/Exec Example int pid = fork(); if (pid == 0) { exec("foo"); } else { waitpid(pid, &status,"— Presentation transcript:

1 CS 140 Lecture Notes: Processes and ThreadsSlide 1 UNIX Fork/Exec Example int pid = fork(); if (pid == 0) { exec("foo"); } else { waitpid(pid, &status, options); }; Child process Parent process

2 CS 140 Lecture Notes: Processes and ThreadsSlide 2 Windows Process Creation BOOL CreateProcess( LPCTSTR lpApplicationName, LPTSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCTSTR lpCurrentDirectory, LPSTARTUPINFO lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation );

3 CS 140 Lecture Notes: Processes and ThreadsSlide 3


Download ppt "CS 140 Lecture Notes: Processes and ThreadsSlide 1 UNIX Fork/Exec Example int pid = fork(); if (pid == 0) { exec("foo"); } else { waitpid(pid, &status,"

Similar presentations


Ads by Google