当前位置: 技术问答>linux和unix
请问怎样查看自己写的程序执行的进程的信息?ps?top?
来源: 互联网 发布时间:2015-10-30
本文导语: 源代码如下:很简单: #include #include #include int main(int argc, char *argv[]) { pid_t pid; printf("Now only one process n"); printf("Calling fork...n"); pid=fork(); if( ! pid ) printf("I`m the childn"); else if( pid >...
源代码如下:很简单:
#include
#include
#include
int main(int argc, char *argv[])
{
pid_t pid;
printf("Now only one process n");
printf("Calling fork...n");
pid=fork();
if( ! pid )
printf("I`m the childn");
else if( pid > 0 )
printf( "I`m the parent.child has pid %dn",pid );
else
printf("Fork fail!n");
cout
#include
#include
#include
int main(int argc, char *argv[])
{
pid_t pid;
printf("Now only one process n");
printf("Calling fork...n");
pid=fork();
if( ! pid )
printf("I`m the childn");
else if( pid > 0 )
printf( "I`m the parent.child has pid %dn",pid );
else
printf("Fork fail!n");
cout