问题 单项选择题

某台按字节编址的8位计算机系统中,采用虚拟页式存储管理方案,页面的大小为1KB,且系统中没有使用快表(或联想存储器)。如图7-3所示的是划分成6个页面的用户程序。

图7-3中“swap A,B”是16位的指令,A和B表示该指令的两个16位操作数。swap指令存放在内存的1023单元中,操作数A存放在内存的3071单元中,操作数B存放在内存的5119单元中。执行swap指令将产生()次缺页中断。

A.3

B.4

C.5

D.6

答案

参考答案:C

解析:

由于该8位计算机系统采用虚拟页式存储管理方案,操作系统将进程的每一页离散地分配到主存的多个物理块中,因此,系统需要为每个进程建立一张页面映射表(简称页表),用于记录每个页面在主存中对应的物理块号。通常,页表存放在主存中。

进程在执行时,首先查找页表,然后再取指令或者取数据。可见执行16位的swap指令时,首先需要取指令,即先访问页表,取指令的高字节,接着再一次访问页表,取指令的低字节,共需访问主存4次。然后取操作数A,访问页表,取操作数A的高字节,再访问页表,取操作数A的低字节,共需访问主存4次。同理,取操作数B也需要访问主存4次。由以上分析可知,执行swap指令共需要访问12次主存。

在虚拟(请求)分页存储系统中,由CPU的地址变换机构根据页表中的状态位判断是否产生缺页中断,然后调用操作系统提供的中断处理例程。缺页中断的特殊性主要体现在以下两个方面:

①缺页中断在指令执行期间产生和进行处理,而不是在一条指令执行完毕之后。所缺的页面调入之后,重新执行被中断的指令。

②一条指令的执行可能产生多次缺页中断。

由于内容按字节编址,页面的大小为1KB,“swap A,B”是16位的指令,因此对于swap指令存放在内存的1023单元中,其实际上需要存放在第0页的最后一个单元和第1页的第1个单元中。同理,操作数A存放在第2页的最后一个单元和第3页的第1个单元中;操作数B存放在第4页的最后一个单元和第5页的第1个单元中。因为swap指令本身和两个操作数A、B都跨越相邻外存页的分界处,所以将产生5次缺页中断,且必须由CPU硬件确保对多个现场的保存。

填空题
阅读理解

“Dining out”, or “eating out”, is a phrase people use in Britain when they eat in a restaurant or a pub. Eating out is more popular in Britain today than ever before.

However, eating out can be expensive. Restaurants are normally more expensive than pubs, though many pubs serve very good, simple food. As British people don’t dine out every night of the week, eating in a restaurant is often seen as a special occasion. When going for the first date, or if celebrating an anniversary or a birthday, many people like to go to a restaurant. People often eat in a restaurant before going to the cinema or the theatre.

As in all cultures, there are many rules of etiquette (礼节)surrounding food and eating, and nowhere is this more pronounced than when eating in a smart restaurant. People are almost always expected to eat with a knife and fork and these should be held in the correct hand and used in the correct way. It is also impolite to have your elbows on the dining table when you are eating.

There’re many such “unspoken” rules — they are normally only important when eating in a very elegant and expensive restaurant, and vary slightly from restaurant to restaurant and place to place. A recent nationwide survey showed that there was a divide in manners between the north and south of Britain — the “worst” manners were in Scotland and the northeast, and the “best” in Wales and the southeast! However, this survey was almost certainly conducted by someone in the southeast, so it may not be entirely fair.

Naturally, restaurants vary greatly in quality and price. However, almost all British cities have a vast range of food and cooking styles to choose from as well as traditional British food,. from the very cheap to the very expensive — French, Italian, Indian, Greek, Thai, Japanese and many more. In fact, when asked what their favorite food is, many British people say an Indian curry (咖喱菜)rather than any other dish!

As well as dining in a restaurant, when people are too tired to cook after work they often get a “takeaway”. This means they order from a takeaway or takeout restaurant by phone, then go to collect it and take it home to eat. Many takeout restaurants also deliver to your house. While you can normally find a takeout restaurant for almost any cuisine, the most popular are Italian, Indian and Chinese — and all you have to do is to open the door, pay and eat!

小题1:What can be concluded from the first two paragraphs?

A.The British spend more eating out than cooking at home.

B.The British pay great attention to eating in a restaurant.

C.The British often dine out when celebrating festivals.

D.People tend to eat in a restaurant after watching a movie.小题2:The underlined word pronounced” in Paragraph 3 probably means “_____”.

A.polite

B.expensive

C.strange

D.obvious小题3:According to the passage, which of the following statements is true?

A.There exist great differences of rules in different restaurants.

B.People from Wales and southeast Britain are the most polite.

C.Your order in a takeout restaurant can be sent to your home.

D.Traditional British food is seldom served in British restaurants.小题4:What does the passage mainly talk about?

A.Restaurant culture in Britain.

B.Table manners in Britain.

C.Different restaurants in Britain.

D.Traditional and foreign foods in Britain.