问题 问答题

在操作系统中引入并发可以提高系统效率。若有两个程序A和B,A程序执行时所做的工作按次序需要用CPU10s,设备一5s,CPU5s,设备二10s,CPU10s;程序B执行时所做的工作按次序需要用设备一10s,CPU10s,设备二5s,CPU5s,设备二10s。
请计算:

如果在并发环境下执行两个程序,则CPU的利用率又为多少

答案

参考答案:如果在并发环境下运行,则程序A使用CPU时,程序B可以使用设备来进行输入输出,而程序A使用设备时,B可以使用CPU。如果A、B同时加载到系统,则运行情况如下:
1)前10s:A使用CPU,B使用设备。
2)接下来5s:A使用设备,B使用CPU。
3)接下来5s:A等待,B使用CPU。
4)接下来5s:A使用CPU,B使用设备。
5)接下来5s:A使用设备,B使用CPU。
6)接下来5s:A、B均使用设备。
7)接下来5s:A使用CPU,B使用设备,并在此时间段结束运行。
8)接下来5s:A使用CPU。
这样A、B总计在系统中的逗留时间为45s,即总执行时间为45s。其中CPU被使用的时间为40s,CPU利用率为40/45=88.89%。由此可见,并发后CPU利用率大为增加。

单项选择题
单项选择题

During the last thirty years, the international economy has experienced a basic change. Improvements in the Internet and other communications have had important effects on world markets. Faster methods of transport from one place to another have made the world seem smaller to the businessmen. As a result, the world no longer consists of a number of separate economies under the control of different nations. Instead, the nations have been integrated into a single economy, and the integration is becoming more and more complete every year. For the first time in history, we can truly speak of a global economy.

The most dramatic example of this integration was the oil crisis of 1973 and 1974. It came as a great surprise to the public in the industrial nations to discover that they depended so heavily on imported oil. However, the best evidence for the growing integration is the rapid expansion in the volume of world trade. It went up by about 7% a year during the decade from 1990 to 2000, and in several quasi-industrial (半工业的) countries the growth was even more rapid. As a result. some imported products have become as common as domestic commodity. Some of them are too common for the public to any more realize they are foreign.

Production has also become international, which is manifested by the large corporations stepping across national borders and established branches and subsidiaries in several different countries. As an example, U. S. companies are building automobiles in Canada. Germany, Britain and Japan. In some cases, components of an automobile are produced abroad and shipped to the United States, where it is then finished with the imported parts. When even the United States has the largest number of such corporations, it is not the only. Other multinationals, for instance, are based in Japan, France, Germany, the UK and Italy.

Labor, too, is much more mobile than in the past. Both skilled and unskilled workers can now readily migrate from one country to another. In Europe, for example, there are large numbers of Turkish workers employed in the Germany Economy. Doctors, lawyers, and other professionals are also finding it easier to work in foreign countries. The labor market has become international, and the number of expatriate workers is continuing to grow.

The passage is mainly about ()。

A. the dependence of the industrial countries on imported oil

B. the fundamental change in world economy

C. the expansion of international corporations

D. the Internet and world economy