• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Eric.cpp
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理

随笔分类 -  OS(Process&Pthread)

 
进程学习笔记(二)--进程间通信
摘要: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 阅读全文
posted @ 2012-12-26 12:11 Eric.cpp 阅读(252) 评论(0) 推荐(0)
进程学习笔记(一)
摘要:进程好难啊,当初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){ ... 阅读全文
posted @ 2012-12-02 12:18 Eric.cpp 阅读(184) 评论(0) 推荐(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... 阅读全文
posted @ 2012-12-02 12:03 Eric.cpp 阅读(174) 评论(0) 推荐(0)
 

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3