问题 单项选择题

某书店有一个收银员,该书店最多允许n个购书者进入。将收银员和购书者看作不同的进程,其工作流程如图7-8所示。利用PV操作实现该过程,设置信号量S1、S2和Sn,初值分别为0,0,n。则图7-8中a1和a2应填入 (69) , b1和b2应填入 (70)


A.P(Sn)、V(S2)

B.V(Sn)、P(S2)

C.P(S1)、V(S2)

D.P(S2)、V(S1)

答案

参考答案:C

解析:

[分析]: 根据试题描述,在本题中,Sn显然是代表允许进入书店的购书者的人数,初值为n,表示可以进入n个购书者。S2用于实现对收银员的互斥访问,初值为0,表示收银员空闲,可以付款。S1代表有多少顾客等待付款,初值为0,表示没有顾客付款。
整个工作流程描述如下:首先是收银员上班,执行P(S1),看是否有顾客付款,如果没有,则阻塞。否则,开始收费,收费完毕后,再执行V(S2),表示收银员空闲。购书者进入书店后,执行P(Sn),然后购书,当要付款时,执 行V(S1),表示多了一个顾客在等待付款,然后执行P(S2),看收银员是否忙,如果忙,则阻塞。否则,开始付款。顾客离开书店时,执行V(Sn)。

问答题

Ladies and Gentlemen,
It is my pleasure to address you as a United Nations Goodwill Ambassador to this Second WorldAssembly on Ageing, an honour which I truly welcome, and one which has provided me with an excellentopportunity to promote awareness of ageing. I congratulate the Secretary-General of the United Nations, thechairmen and the executive heads of the organizations of the United Nations system on their excellent work,the Chairman and Vice-Chairmen of the Preparatory Committee on their dedication, and the many individualswho have helped to make this Second World Assembly possible. [TONE]∥[TONE]
We are honoured to be hosting this world event in Spain. Our interest stems from our realization thatthe ageing of the population presents a challenge for which we must prepare ourselves and that we must beready to take advantage of the abilities of older persons. Therefore, in offering to be the host country, Spainwished to demonstrate its interest in policies for the integration of older persons and to give impetus to aninnovative debate in our society. [TONE]∥[TONE]
We are living through a period of major demographic change. The elderly are ever more numerous.That people are living longer and under better conditions, as a result of social progress, is one of humanity’sgreatest achievements. Older persons are a universal force with the potential to transform the future. Thisglobal transformation is going to affect individuals, families, communities and virtually every area of society.[TONE]∥[TONE]
Accordingly, we must prepare ourselves for this new challenge by promoting changes in attitude towardsthis demographic revolution, which is taking place because of the increase in the number of older personsin the world. Achieving a society for all ages involves analysing society from a broader perspective andhighlights the role played by relations between the various generations making up society. Solidarity betweenthe generations in all areas of family, community and national life is essential for social cohesion. [TONE]∥[TONE]

We younger people must be increasingly aware that, in order to move forward in building a more just society, we must recognize the advances made by older generations and value their experience and currentabilities appropriately. At the same time, we must be able to transmit such values to coming generations.Inter-generational solidarity is a natural setting within which encounter, learning and exchange take placeamong individuals. It offers advantages to all and helps in achieving a more integrated society. [TONE]∥[TONE]
Together we will build a positive image of ageing, which should involve not simply prolonging life, but also ensuring that old age is healthy, independent, active and fully integrated in society. Ageing should be seen as astage in life during which men and women can still develop their skills, as active agents in our societies, in whichthey should continue to participate as full citizens with full social recognition. [TONE]∥[TONE]
I hope that all the proposals that result from this World Assembly will enable our society to face the challenges posed by the ageing of the population, and that they will be translated into practice by the greatestpossible number of countries in such a way that older persons will benefit from them as soon as possible.
Thank you. [TONE]∥[TONE]

单项选择题