علماً أن الفكرة هي كتابة برنامج سي والذي ينشىء معالجين أطفال وينتظر لإكتمالهم. المعالج الطفل الأول ينبغي عليه انشاء ملف جديد بإسم "abc"
با ستخدام the 'open' system call
وبالنسبة للمعالج الطفل الآخر ينبغي أن يكتب رقم معالجه إلى Terminal
في نموذج readable
باستخدام the 'write' system call
وهذا هو الكود بس هذا اللي قدرت أسويه وياليت يا حلوين يا مشرفين المنتدى وأعضائه تتحفوني بتعليقاتكم الحلوة
وان شاء الله أكون لكم من الشاكرين والمقدرين
#include <sys/types.h>
#include <unistd.h>
main()
{
pid_t ch;
if((ch=fork())==0)
{
printf("Hello World\n");
}
else
{
pid_t ch2;
if((ch2=fork())==0)
{
pid_t gch01;
if((gch01=fork())==0)
{
printf("Process number1:%x\n", (long)getpid());
printf("Parent's process number:%x\n", (long)getppid());
}
else
{
pid_t gch02;
if((gch02=fork())==0)
{
printf("Process number2:%x\n", (long)getpid());
printf("Parent's process number:%x\n", (long)getppid());
}
}
}
}
}
#include <stdio.h>
