问题 问答题

一个32位的计算机系统中,虚拟存储系统采用了物理地址扩展的三级分页方式,第一级页表占用地址的最高2位,第二、三级页表依次占用9位地址,最低12位用于页内偏移量,如下图所示。


一个进程的地址空间为4GB,每个页表项占用8个字节,请问:
(1)一个进程最多有多少个页面
(2)一级、二级以及三级页表各为多大一共占用多少存储空间
(3)为提高效率,一级页表和二级页表全部装入内存,三级页表只装入一页,若从OxC8000000开始顺序映射三级页表、二级页表和一级页表,请计算列出上述三组页表在内存中的地址范围。

答案

参考答案:[解答] (1)32位系统中,一个进程的大小为232=4GB,页面大小为212=4KB,所以,一个进程最多可以有4GB/4KB=1M个页面。
(2)一级页表2位,22=4项,占4×8B=32字节,占用1页。二级页表9位,29=512项,占512×8B=4KB大小,被一级页表索引,共4页,二级页表9位,29=512项,占512×8B=4KB大小,被二级页表索引,共4×512=2048页,因此,总共占用1+4+2048=2053页的存储空间。
(3)为提高效率,系统运行中仅调入一级和二级页表,三级页表只调入1页,共6页,因此,按三级、二级和一级的次序从内存0xC8000000开始存放,地址如下表:

0xC8000000
0xC8000FFF
三级页表(1页)
0xC8001000
0xC8004FFF
二级页表0
二级页表1
二级页表2
二级页表3
0xC8005000
0xC8005003
一级页表(4项)

解析: 虚拟存储管理系统中,虚拟页式是最常用的方法之一。通常,一个进程的地址空间由地址系统的位宽决定,所以,32位系统进程的逻辑地址空间为232=4GB。本题中,页面的大小占12位,即212=4KB,所以,一个进程最多可以有4GB/4KB=1M个页面,为寻址所有的逻辑地址空间,每个页面需要一个页表项,每个页表项占用8字节,则总共需要1M×8B=8MB,以本题为例,页面的大小是4KB,若将所有的页表项装入内存,总共需要8MB/4KB=2K页面。一个进程需要2K页面,大量并发进程需要占用巨大的内存资源,因此并不现实。解决的方法是将页面分组,亦即将页表分级,本题中将页表分为三级,第一级页表2位,共4项,占用4×8=32字节,一般占用1页(为节省内存,通常与其它进程共享这1页)。第二级页表9位,共29=512项,每项8字节,共4KB,正好占1页,对应于一级页表4项,一共有4页二级页表,三级页表也是9位,同二级页表一样每个页表占1页,这样的三级页表共有4×512=2048个。总共占用1+4+2048=2053页存储空间,正是这样,将页表全部装入内存是低效的。一般而言,一、二级页表可以全部装入内存,三级页表仅装入一页,在进程运行过程中,再按需调入。后面的计算过程就比较简单了。

阅读理解

In the 1930s a young traveler was climbing the French Alps(法国阿尔卑斯山).He arrived at big piece of land without living things.It was ugly.It was the kind of place you hurry away from.

Then,suddenly,the young traveler stopped on the way.In the middle of this large land there was an old man.On his back was a bag of seeds.In his land was an iron pipe(铁管).

The man used the iron pipe to make a hole in the ground.Then from the bag he took a seed and put it in the hole.He did this again and again.

Later the old man told the traveler,“I’ve planted over 100,00 seeds.Perhaps only a tenth of them will grow.”

The old man’s wife and son had died,and this was how he chose to spend his final years.

“I want to do something useful,”he said.

(1)二十年以后那个年轻的游客已不再年轻。 He retutned to the place.What he saw amazed him.He could mot believe his eyes.The land was covered with a beautiful forest two miles wide and five miles long.Birds were singing,animals were playing,and wild flowers were here and there.

(2)The traveler stood there remembering the lifeless picture of the place that it once was.A beautiful forest stood there now,all because someone cared.

小题1:Why did the ola man plant seeds?_____________________________________________

小题2:How many seeds did the old man think could grow,all of them or only some?___________

小题3:What amazed the young traveler when he returned to the place?______________________

小题4:将短文中画线句子(1)翻译成英语。___________________________________________

小题5:将短文中画线句子(2)翻译成汉语。___________________________________________

填空题