daily pastebin goal
18%
SHARE
TWEET

Untitled

a guest Nov 13th, 2012 28 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 자식 프로세스 소스입니다.
  2.  
  3. #include <stdio.h>
  4.  
  5. int main()
  6. {
  7.         int a=0,x,y,z;
  8.  
  9.         for(x=0; x<100; ++x)
  10.         {
  11.                 printf("*");
  12.  
  13.                 for(y=0; y<1000; ++y)  
  14.                 {
  15.                         for(z=0; z<1000; ++z)
  16.                                 a=x*y*z*y*z+(x+y+z)-99*x+x*y*z/97;
  17.                 }
  18.         }
  19.         return 0;
  20. }
  21.  
  22. 부모 프로세스입니다.
  23.  
  24. #include<stdio.h>
  25. #include<unistd.h>
  26. #include<sys/types.h>
  27.  
  28. int main()
  29. {
  30.  
  31.                         int a=0,x,y,z;
  32.  
  33.                         pid_t pid;
  34.                        
  35.           pid = fork();  
  36.  
  37.            if(pid<0)
  38.             {
  39.            fprintf(stderr,"Fork faild!!\n");
  40.                     exit(-1);
  41.             }
  42.                else if(pid==0)
  43.                    {
  44.                 execlp("./OS_process_child", "OS_process_child", NULL);
  45.                
  46.                     }
  47.                  else
  48.                    {
  49.                         for(x=0; x<100; ++x)
  50.                         {
  51.                             printf("-");
  52.  
  53.                             for(y=0; y<1000; ++y)
  54.                                 {
  55.                                  for(z=0; z<1000; ++z)
  56.                                   a=x*y*z*y*z+(x+y+z)-99*x+x*y*z/97;
  57.                                 }
  58.  
  59.                          }
  60.  
  61.                               wait(NULL);
  62.                              printf("Parent\n");
  63.                              exit(0);
  64.                         }
RAW Paste Data
Top