İşletim Sistemleri (Bahar-2016) Hafta-2

 

#include <iostream>
#include <unistd.h>

using namespace std;
int main()
{
	int x;
	cout<<"pid:"<<getpid()<<endl;
	cout<<"Sayi Giriniz:";
	cin>>x;
	cout<<"Sayi:"<<x<<endl;
	return 0;	
}

 

#include<iostream>
#include<unistd.h>

using namespace std;

int main()
{
	int x=0;
	cout<<"BASLA:"<<getpid()<<endl;
	fork();
	fork();
	fork();
	cout<<"PROC:"<<getpid()<<" SAYAC: "<<(++x)<<endl;
	
	return 0;
}

 

Share