这个问题是在一个请求分页系统中,使用不同的页面置换算法fifo、lru和opt,假如有一个作业的页面走向为4、3、2、1、4、3、5、4、3、2、1、5,当分配给该作业的物理块数m分别为3、4时,求分别使用这三种页面置换算法的缺页次数。 请给我每次的过程模拟
时间: 2023-12-28 20:05:06 浏览: 52
好的,我们来分别模拟一下使用三种页面置换算法的过程,先从m=3开始:
1. FIFO算法:
| 页号 | 1 | 4 | 3 | 2 | 1 | 4 | 3 | 5 | 4 | 3 | 2 | 1 | 5 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 物理块 | 1 | 4 | 3 | | | | | | | | | |
| 缺页 | X | X | X | X | X | | X | X | | | X | X |
2. LRU算法:
| 页号 | 1 | 4 | 3 | 2 | 1 | 4 | 3 | 5 | 4 | 3 | 2 | 1 | 5 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 物理块 | 1 | 4 | 3 | | | | | | | | | |
| 缺页 | X | X | X | X | X | | X | X | | | X | X |
3. OPT算法:
| 页号 | 1 | 4 | 3 | 2 | 1 | 4 | 3 | 5 | 4 | 3 | 2 | 1 | 5 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 物理块 | 1 | 4 | 3 | | | | | | | | | |
| 缺页 | X | X | X | X | X | | X | X | | | X | X |
现在我们再来看一下m=4的情况:
1. FIFO算法:
| 页号 | 1 | 4 | 3 | 2 | 1 | 4 | 3 | 5 | 4 | 3 | 2 | 1 | 5 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 物理块 | 1 | 4 | 3 | 2 | | | | | | | | |
| 缺页 | X | X | X | X | X | | X | X | | | | X |
2. LRU算法:
| 页号 | 1 | 4 | 3 | 2 | 1 | 4 | 3 | 5 | 4 | 3 | 2 | 1 | 5 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 物理块 | 1 | 4 | 3 | 2 | | | | | | | | |
| 缺页 | X | X | X | X | X | | X | X | | | | X |
3. OPT算法:
| 页号 | 1 | 4 | 3 | 2 | 1 | 4 | 3 | 5 | 4 | 3 | 2 | 1 | 5 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 物理块 | 1 | 4 | 3 | 2 | | | | | | | | |
| 缺页 | X | X | X | X | X | | X | X | | | | X |
以上就是使用不同页面置换算法的分页过程模拟。
阅读全文