Time: 2025-02-20 Thursday 23:56:01
Author: Jackasher
操作系统
读写互斥
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| struct rw_lock{ 2 sem_t lock; 3 int reader; 4}; 5 6void reader_lock(rw_lock* rw) 7{ 8 ++reader; 9 if (reader == 1) 10 sem_wait(&rw->lock); 11} 12 13void reader_unlock(rw_lock* rw) 14{ 15 --reader; 16 if (reader == 0) 17 sem_post(&rw->lock); 18} 19 20void writer_lock(rw_lock* rw) 21{ 22 sem_wait(&rw->lock); 23} 24 25void writer_unlock(rw_lock* rw) 26{ 27 sem_post(&rw->lock); 28}
|
虚拟内存

是谁处理内存转换的?(cpu)



为什么要用页表而不是 Base Limit

页表转换

如何解决页表转换太慢

页表模型

Swap

文件读写也是有 Page Cache 的

一切皆文件


