İşletim Sistemleri (Bahar-2016) Hafta-7/1
#include<iostream> #include<unistd.h> using namespace std; int main() { cout<<"Merhaba ISTE:"<<getpid()<<endl; sleep(5); cout<<"Hoscakal ISTE"<<endl; }
#include<iostream> #include<unistd.h> using namespace std; int main() { cout<<"Basla::"<<getpid()<<endl; execl("merhaba","merhaba",NULL,NULL); cout<<"Bitis"<<endl; }
#include<iostream> #include<unistd.h> #include<sys/wait.h> using namespace std; int main() { pid_t id; cout<<"Basla::"<<getpid()<<endl; id=fork(); if(id==0) execl("merhaba","merhaba",NULL,NULL); // yeni pid else{ waitpid(id,0,0); cout<<"Bitis"<<endl; // annede } }