问题 单项选择题

某工厂仓库有一名保管员,该仓库可存放n箱零件。该工厂生产车间有m名工人,只要仓库空闲,工人将生产好的整箱零件放入仓库,并由保管员登记入库数量;该工厂销售部有k名销售员,只要仓库库存数能满足客户要求,便可提货,并由保管员登记出库数量。规定工人和销售员不能同时进入仓库,但是工人和工人,销售员和销售员可以同时进入仓库,其工作流程如图7-7所示。


假设系统中P操作表示申请一个资源,当执行P操作时,对信号量减1,若信号量S≥O,则执行P操作的进程继续执行,否则等待。系统中V操作表示释放一个资源,当执行V操作时,对信号量加1,若信号量S>O,则执行V操作的进程继续执行;若信号量S≤0,则从阻塞状态唤醒一个进程,并将其插入就绪队列,然后执行V操作的进程继续。
为了利用PV操作正确地协调工人和销售员进程之间的工作,设置了信号量S1、S2和S3,它们的初值分别为n、0和1。图7-7中的a和b应填写 (65) , e和f应分别填写 (66) ,c、d、g和h应分别填写 (67)

A.P(31)、V(S1)、P(S2)、V(S2)

B.P(S1)、V(S1)、P(S3)、V(S3)

C.P(S2)、V(S2)、P(S3)、V(S3)

D.P(S3)、V(S3)、P(S3)、V(S3)

答案

参考答案:D

解析:

[分析]: 从试题描述来看,在本题中,信号量S1表示仓库空闲位置个数,初值为n; S2表示仓库中零件箱数,初值为0;S3用于实现对保管员的互斥访问,初值为1。
对于工人进程,首先应执行P(SU,看仓库中是否有空闲位置,若有,则将零件送入仓库,然后执行V(S2),表明仓库中已有一箱零件,通知销售员可以提货。然后执行P(S3),看保管员是否空闲,若空闲,登记入库数,然后V(S3),使保管员处于空闲状态。
对于销售员进程,首先执行P(S2),看仓库中是否有货物,若有,可以提货,然后执行V(S1),表明已经提走一箱零件,空闲出一个位置,工人进程可以放置货物;然后执行P(S3),看保管员是否空闲,若空闲,登记出库数,然后V(S3),使保管员处于空闲状态。

完形填空
完形填空。
     A gentle wind blew through Jennifer's hair. The golden red sun was 1. She was on the beach,
looking up at the ball. She was amazed by its  2 , deep red in the middle,  3 fading into yellow. She
could hear nothing but the  4  and the seagulls flying up above in the sky.
     The atmosphere  5 her. After all she had been through, this is what she  6 . "It's getting late,"she
thought,"I must go home, my parents will be  7 where I am." She wondered how her parents would
react, when she got home after the three days she was  8 .
     The sun had set by now and it was getting. She tried to imagine having her favorite 10  on until
she saw her front door. It seemed different.  11 had taken care of the outside garden for days. She
was 12 : her father was usually so strict about keeping everything clean and tidy, and  now… It all
seemed  13 . She couldn't understand what was going on.
     She entered she 14 . First,she went into the kitchen where she saw a(n) 15 written by her father.
It said:"Dear Ellen,there is some coffee ready,I went  16 ." Ellen was her motherbut-where was she?
On the right side of the hallway was her 17 room. She went in. Then she saw her mother,lying on the
bed sleeping. Her 18  looked so tired,as if she hadn't   19   for days. She was really pale. Jenny just
fell asleep beside her. When Jennifer woke up she found something  20 . She was in her cozy bed in
her nightclothes.
      It felt so good being back home. Suddenly she heard a voice. "Are you feeling better now, dear?
You know you got us very, very scared."
( ) 1. A. rising
( ) 2. A. shape  
( ) 3. A. quickly  
( ) 4. A. waves  
( ) 5. A. relaxed  
( ) 6. A. understood
( ) 7. A. discussing
( ) 8. A. alive  
( ) 9. A. sunny  
( )10. A. glasses  
( )11. A. Somebody
( )12. A. shocked  
( )13. A. beautified
( )14. A. garden
( )15. A. book  
( )16. A. looking  
( )17. A. own    
( )18. A. gesture  
( )19. A. studied  
( )20. A. different
B. setting
B. shadow
B. partly
B. boats
B. puzzled
B. considered
B. finding
B. asleep
B. warm
B. hat
B. Nobody
B. scared
B. rearranged
B. bedroom
B. note
B. working
B. parents'
B. body
B. slept
B. new
C. shining  
C. size    
C. softly  
C. trees  
C. disappointed
C. needed  
C. asking  
C. missing  
C. cold    
C. skirt  
C. Mother  
C. exhausted
C. deserted  
C. yard    
C. article  
C. fishing  
C. sister's
C. face    
C. exercised
C. precious  
D. smiling        
D. color          
D. probably        
D. sands          
D. interrupted    
D. regretted      
D. wondering      
D. hardworking    
D. cloudy          
D. jacket          
D. Father          
D. comforted      
D. destroyed      
D. house          
D. poster          
D. sightseeing     
D. brother's  
D. eyes            
D. moved          
D. dangerous      
单项选择题