linux多进程开发

进程概述

image-20221228215047906

image-20221228215306624

image-20221228215654505

image-20221228215901391

image-20221228220002846

image-20221228220040153

进程状态转换

image-20221229101016175

image-20221229101342975

image-20221229101406309

image-20221229101746063

image-20221229102012591

image-20221229102702300

进程创建

image-20221229103352764

image-20221229104053711

父子进程虚拟地址空间情况

image-20221229110230024

image-20221229110602736

image-20221229111129606

GDB多进程调试

image-20221229111621037

image-20221229111826174

image-20221229112251375

exec函数簇

image-20221229140737521

image-20221229141249386

image-20221229141712476

image-20221229141833260

进程控制

image-20221230100428743

image-20221230100654982

image-20221230100912923

其中printf(“world”)由于没有刷新IO缓冲区,因此不会在终端打印出来。

image-20221230101116294

image-20221230102100422

image-20221230103505947

wait()

image-20221230104358498

image-20221230110357926

waitpid()

man waitpid

image-20230102093140143

image-20230102093526828

进程间通信

image-20230104105828130

image-20230104111012880

匿名管道(管道)

image-20230104140707645

image-20230104141330220

image-20230104141746748

image-20230104142401680

image-20230104142525262

管道的数据结构逻辑上的一个循环队列。

image-20230104142558094

image-20230104143202408

管道默认是阻塞的,如果管道中没有数据,read()阻塞,如果管道满了,write阻塞。

image-20230104165518456

image-20230104165655275

image-20230104165812022

设置管道非阻塞:

image-20230104171654377

有名管道

image-20230104172227532

image-20230104172624808

image-20230104172651413

image-20230104173234155

image-20230104174235961

有名管道的注意事项

image-20230104201207730

image-20230104201529338

有名管道和匿名管道都操作的是内核的缓冲区,有名管道创建的Pipe文件不存放数据。

image-20230105100833888

  • 版权声明: 本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!
  • Copyrights © 2022-2024 lk
  • 访问人数: | 浏览次数:

请我喝杯咖啡吧~

支付宝
微信