问题 完形填空
完形填空。
     It's a small gas station that has snacks, drinks, cigarettes, and candies. The young man behind the
counter knows his   1   by name and what they normally want to buy. He treats children and adults with
equal    2  . He reads science fiction behind the counter when business is   3  .
     One day, three people rushed in and grabbed food off the shelves as fast as they could,    4    not
intending to pay for it. He hit the "panic button" , then went over the counter and   5    the front door. It
was obvious that they were homeless, and  equally obvious that they weren't going     6    with their
illgotten gains. They    7    the food and simply crowded together in panic-knowing the police were   8   
the way.
     Imagine what they must have felt like when they were told they didn't have to steal if they were that    9  . "We have food in the back, expired (到期) but still    10    to eat. If you need food, you    11    
have some."  
     They were told to   12   what they had dropped and put it back, and then asked to straighten out the
mess. They were doing just that    13     the police arrived. The officers were told the situation was under
control and the police were no longer    14  .
     This wasn't what they had    15  . They were being treated as human beings who could right the wrong
they'd done. Shocked, they quickly followed orders to take turns and use the restroom to clean up.
Soon three    16    people walked out with all the    17    their arms could hold. They were   18    that, if
they needed to come back again, they were to ask and not just grab.
     And then the young man went back to read until the next customer came in. He would be the   19   
person in the world to claim he was a hero. But he gave three people something they were in desperate
need of-a   20   amount of selfrespect and a little bit of hope.
( )1. A. friends
( )2. A. respect  
( )3. A. slow    
( )4. A. bravely  
( )5. A. opened  
( )6. A. nowhere  
( )7. A. hid     
( )8. A. in      
( )9.  A. anxious
( )10. A. safe  
( )11. A. must  
( )12. A. hold up
( )13. A. when  
( )14. A. popular
( )15. A. wanted  
( )16. A. dirtier
( )17. A. money  
( )18. A. reminded
( )19. A. first  
( )20. A. large  
B. neighbors
B. pride      
B. busy      
B. reasonably
B. locked    
B. somewhere  
B. lifted    
B. on        
B. cautious  
B. easy      
B. can        
B. hand out  
B. after      
B. necessary  
B. desired    
B. cleaner    
B. cigarettes
B. warned    
B. last      
B. fair      
C. customers  
C. wisdom     
C. heavy      
C. hardly    
C. closed    
C. anywhere  
C. swallowed  
C. off        
C. courageous  
C. sweet      
C. should    
C. pick up    
C. before    
C. reliable  
C. expected  
C. cleverer  
C. drinks    
C. ordered    
C. best      
C. small      
D. passengers     
D. privilege      
D. swift          
D. obviously      
D. broke          
D. everywhere      
D. dropped        
D. by              
D. hungry        
D. unique          
D. need            
D. hand in        
D. since          
D. important      
D. admired        
D. quicker        
D. food            
D. persuaded      
D. worst          
D. full            
答案

1-5: CAADB   6-10:  CDBDA    11-15: BCABC     16-20: BDABC

单项选择题
问答题

阅读下列说明和图,回答问题1到问题3,将解答填入对应栏内。

[说明]

操作系统中,死锁(Deadlock)是指多个进程在运行的过程中因争夺资源而造成的一种僵局。当进程处于这种僵持状态时,若无外力作用,它们都将无法再向前推进。

面对死锁问题有两个解决方案:预防死锁和避免死锁。

预防死锁是一种较简单和直观的事先预防方法。该方法是通过设置某些限制条件,去破坏产生死锁的四个必要条件中的一个或多个,以此来预防死锁的发生。预防死锁由于较易实现,已被广泛应用,但由于所施加的限制条件往往太严格,可能会导致系统资源利用率和系统吞吐量的降低。

避免死锁同样是属于事先预防的策略,但它无须事先采取各种限制措施去破坏产生死锁的四个必要条件,而是在资源分配过程中,用某种方法去防止系统进入不安全状态,从而避免发生死锁。

银行家算法(Banker’s algorithm)是Dijkstra于1965年提出的一个经典的避免死锁的算法。形象地描述银行发放贷款不能使有限可用资金匮乏而导致整个银行无法运转的思路,也就是说每次请求贷款,银行要考虑他能否凭着贷款完成项目,并还清贷款使银行运转正常。令Request(i)是进程P(i)请求向量,如果Request(i)[j]=k则进程P(i)希望请韵类资源k个。具体算法步骤如下:

(1)如果Request(i)>Need(i)则出错(请求量超过申报的最大量),否则转到(2);

(2)如果Request(i)>Available则P(i)等待,否则转(3);

(3)系统对P(i)所请求的资源实施试探分配,并更改数据结构中的数值;

(4)Available=Available-Request(i);

A1location(i) =Allocation(i) +Request(i);

Need(i)=Need(i)-Request(i);

(5)执行安全性算法,如果是安全的,则承认试分配,否则废除试分配,让进程P(i)继续等待。

所谓系统是安全的,是指系统中的所有进程能够按照某一种次序分配资源,并且依次运行完成,这种进程序列P1,P2,…,Pn)就是安全序列。如果存在这样一个安全序列,则系统是安全的;如果系统不存在这样一个安全序列,则系统是不安全的。

简述产生死锁的四个必要条件。