什么是程序,什么是进程,有什么区别
程序是静态的概念,gcc xx.x -o pro,磁盘中生成的pro就是程序。
进程是程序的一次运行活动,通俗的讲就是程序跑起来了,系统中就多了一个进程。
在Linux里面怎么查看系统中有哪些进程
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
//pid_t getpid(void);
pid_t pid;
pid=getpid();
printf("我的pid是:%d\n",pid);
return 0;
}
什么是父进程,什么是子进程
进程A创建了进程B,那么A叫做父进程,B叫做子进程,父子进程是相对概念,理解为人类中的父子关系。
C程序的存储空间是如何分配的
如图
堆:类似malloc的动态分配;栈:类似函数调用