文章目录
- 0 前言
- 1 背景
- multiprogramming
- race condition竞争条件
- 同步
- The critical section problem
- 2 概念
- 3 tutorial
- 4 lab
0 前言
协同的进程可以影响或被系统中执行的其他进程所影响。协作进程可以直接共享逻辑地址空间(即代码和数据),也可以只允许通过文件或消息共享数据。前一种情况是通过使用线程实现的,本系列文章之前讨论过。但是,对共享数据的并发访问可能会导致数据不一致。在本章中,我们将讨论各种机制,以确保共享逻辑地址空间的协作进程有序执行,从而保持数据一致性。
1 背景
multiprogramming
多道程序编程. 当OS使用一个规划策略允许两个或更多进程并发共享一个CPU时,它称做多任务编程(multitasking)或多程序编程(multiprogramming)
Multiprogramming makes sure that the CPU always has something to execute, thus increases the CPU utilization.
race condition竞争条件
同步
协调进程的执行次序,使并发进程间能有效地共享资源和相互合作,保证数据一致性
协调执行次序
The critical section problem
The critical section problem refers to the problem of how to ensure that at most one process is executing its critical section at a given time. Important: Critical sections in different threads are not necessarily the same code segment!
2 概念
3 tutorial
4 lab