问题 单项选择题

在操作系统中,对信号量S的P原语操作定义中,()是使进程进入相应等待队列的条件。

A.S<0

B.S=0

C.S>0

D.S<>0

答案

参考答案:A

解析:信号量是表示资源的物理量,它只能供P操作和V操作使用,利用信号量S的取值表示共享资源的使用情况,或用它来指示进程之间交换的信息。在具体使用中,把信号量S放在进程运行的环境中,赋予其不同的初值,并在其上实施P操作和V操作,以实现进程间的同步和互斥。P、V操作是定义在信号量S上的两个操作原语:P(S):①S←S-1;②若S≥0,则调用P(S)的这个进程继续被执行;③若S<0,则调用P(S)的这个进程被阻塞,并将其插入到等待信号量S的阻塞队列中。V(S):①S←S+1;②若S>0,则调用P(S)的这个进程继续被执行;③若S≤0,则先从等待信号量S的阻塞队列中唤醒队首进程,然后调用V(S)的这个进程继续执行。信号量S>0时的数值表示某类资源的可用数量,执行P操作意味着申请分配一个单位的资源,故执行S减1操作,若减1后S<0,则表示无资源可用,这时S的绝对值表示信号量S对应的阻塞队列中进程个数。执行一次V操作则意味着释放一个单元的资源,故执行S增1操作,若增1后S≤0,则表示信号量S的阻塞队列中仍有被阻塞的进程,故应唤醒该队列上的第一个阻塞进程。

单项选择题 B1型题
阅读理解

阅读理解

     "BANG!" the door caused a reverberation (回声). It was just standing there, with father standing on

one side, and I on the other side.

     We were both in great anger. "Never set foot in this house again!" stormed father. With tears welling up in my eyes, I rushed out of the flat and ran along the street. The street lights were shining, causing rather

sad-feeling. I wandered aimlessly. A young father who held a child in his arms walked past me. I felt as if I saw my childhood from another space: happy and carefree.

     But now … I don't know whether it is because I have grown up or because dad is getting old. We

differ in our ways of thinking. He always put his opinions and codes of behavior on me. Whenever I do something wrong, he never admits it. We are just like two people coming from two different worlds. It feels

like there is an iron door between us that can never be opened.

     I wandered the streets, without a destination in mind. My heart was frozen on this hot summer night. As I walked on there were fewer and fewer people on the streets, until I had only the street lights to keep me company. When I finally reached the high-rise apartment block in which I lived ,I saw that the light was still on.

     I thought to myself: "Is father waiting for me, or is he still angry with me?" In fact, it was nothing.

Perhaps, dad was throwing away some of his old stamps. Perhaps he thought they were useless. I never

had the courage to tell him that I liked collecting stamps. I can't stand his outrageous(蛮横的)words: "I

can't throw you away, let alone these old papers?"

     All the lights were off except father's. Dad was always like this. Maybe he didn't know how to express himself. After shouting at me, he never showed any mercy or any moments of regret. After an argument he has the habit of creeping up in my sleep and then tucking(用……盖住) me underneath the covers.

     This was how he always was.He has been a leader for so long that telling everyone else what to do

has become his second nature.

     The light was still on. "Am I wrong?" I whispered, maybe…ith the key in hand, I was as nervous as I

had ever been. At last, I decided to open the door. As soon as I opened the door tears ran down my

cheeks. I suddenly realized that the iron door that I had imagined between us did not exist at all. Love-it's

second to none.

1. Decide which is the best order of the following according to what happened in the passage.

a. I opened the door and entered the house.

b. Sadly I ran out into the street.

c. I reached the place where I lived and saw my house still brightly lit.

d. I thought of my father's kindness towards me.

e. I walked about in the street without any aim.

A. b, e, d, c, a      

B. b, e, c, d, a    

C. b, e, a, c, d        

D. b, e, c, a, d

2. What made the writer think of his childhood ?

A. The sight of the street lights.

B. The sight of the empty street.

C. The sight of a father with a child in his arms. 

D. The sight of light in his own house.

3. Why do you think the father often shouts at his son?

A. perhaps the father is getting older and older.

B. perhaps the son has already grown up.

C. perhaps they never agree with each other.

D. perhaps the father has got used to doing that.

4. What conclusion can you come to after reading the passage?

A. The father treats his son in an unfair way.

B. The father is actually kind to his son.

C. The father is neither kind nor cruel to his son.

D. The father is always finding fault with his son.