Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Lab 7 
 
Name: 
 
1. Java code Consumer.java is contained inside the file 
/home/knowak/unix_env/lab_7/threads. Answer the following questions. 
(i) How long will it take after the program is started to get the first display 
“Producer waits”? _____ 
(ii) How many time displays that differ by a second from the previous 
time display are there? _____ How long does it take to print all the 
displays that differ by a second? _____  
Change the constant MAXQUEUE to 4, sleep time for the producer to 2000 and 
sleep time for the consumer to 3000. What are the answers to questions (i) and (ii) 
now (in (ii) change differ by a second to differ by two seconds)? (i) _____, (ii) 
_____, _____ 
  
2. (i) Time the Perl version of the Markov chain algorithm with the input file 
alice30.txt (copies of files are contained inside /home/knowak/unix_env/lab_7 
/markov) 
Timing result: _____ 
(ii) Modify the Perl program so that it takes one word for a prefix instead of two 
and run it with the input file alice30.txt. Timing result: _____ 
 
3. Write and run a Perl program, which will print out the word occurring most often 
inside the file alice30.txt. 
 
4. X-tra credit: Write and run a Perl program, which will print out the prefix-suffix 
pair occurring most often in the text alice30.txt.  
 
Instructor’s initials:  2(ii)  _____ 
   3      _____ 
   4 _____