进程学习笔记(二)--进程间通信
    
            
摘要:server.c#include <stdio.h>#include <stdlib.h>#include <errno.h>#include <string.h>#include <time.h>#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <netdb.h>int main(int argc,char **argv){ i
        
阅读全文
 
        
            
    进程学习笔记(一)
    
            
摘要:进程好难啊,当初OS课仅仅是学了一些调度算法之类的东西,对wait之类的命令理解还不够,看来要尽快补上了。进程学习中提到了fork()叉子的概念,可以从主进程中拓展出一个子进程(pid==0)和一个父进程(pid>0)。如果换成vfork(),则不会产生这种效果#include <stdio.h>#include <unistd.h>#include <sys/types.h>int main(){ pid_t pid; char *message; pid = fork(); int n; if(pid==0){ ...
        
阅读全文
 
        
            
    线程学习笔记(一)
    
            
摘要:一直对多线程比较好奇,后来在移动编程课上学了基本的创建进程,加入进程。创建3个进程,加入3个进程代码如下:#include <pthread.h>#include <stdio.h>#include <string.h>#include <unistd.h>#include <stdlib.h>void *thread_function(int x){ while(1){ printf("I am thread %d\n",x); sleep(1); }}int main(){ int res...
        
阅读全文