Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
The passage processor will read a series of passage file names from passages.txt. A thread will be created for each
passage that builds Trie with words in the passage text, receives requests for longest word searches, searches the
trie for the longest word and asynchronously returns the longest word. The Passage Processor will read each
prefix request from the System V ipc queue using a Java Native Call, sends the requests to each worker, retrieves
responses from each worker and sends them back to the search manager via the system V queue. For each prefix
request, the trie should be searched for the longest word that starts with that prefix. In the case that a word is
found, the longest word will be sent to the SearchManager via the System V ipc queue via a Java Native call. The
response will include the prefix id, the passage id, the passage name, the number of passages, present = 1, and the
longest word. In the case that the prefix is not found, the response will include the prefix id and present = 0.
Format: java -cp . -Djava.library.path=. edu.cs300.TextSamples
Worker-0 (Sense_And_Sensibility.txt) thread started …
Worker-1 (Mansfield_Park.txt) thread started …
Worker-2 (The_Call_Of_The_Wild.txt) thread started …
Worker-4 (Peter_Pan.txt) thread started …
**prefix(1) con received
Worker-2 1:con ==> not found
Worker-3 (Tale_Of_Two_Cities.txt) thread started …
Worker-3 1:con ==> not found
msgsnd Reply 2 of 5 on 1:con from The_Call_Of_The_Wild.txt present=0 lw=—-(len=4) msglen=144
msgsnd Reply 3 of 5 on 1:con from Tale_Of_Two_Cities.txt present=0 lw=—-(len=4) msglen=144
Worker-1 1:con ==> contemptible
Worker-4 1:con ==> conspicuous
msgsnd Reply 1 of 5 on 1:con from Mansfield_Park.txt present=1 lw=contemptible(len=12) msglen=144
msgsnd Reply 4 of 5 on 1:con from Peter_Pan.txt present=1 lw=conspicuous(len=11) msglen=144
Worker-0 1:con ==> constant
msgsnd Reply 0 of 5 on 1:con from Sense_And_Sensibility.txt present=1 lw=constant(len=8)
msglen=144
**prefix(2) pre received
Worker-2 2:pre ==> not found
Worker-0 2:pre ==> not found
msgsnd Reply 2 of 5 on 2:pre from The_Call_Of_The_Wild.txt present=0 lw=—-(len=4) msglen=144
msgsnd Reply 0 of 5 on 2:pre from Sense_And_Sensibility.txt present=0 lw=—-(len=4) msglen=144
Worker-4 2:pre ==> not found
msgsnd Reply 4 of 5 on 2:pre from Peter_Pan.txt present=0 lw=—-(len=4) msglen=144
Worker-1 2:pre ==> predict
msgsnd Reply 1 of 5 on 2:pre from Mansfield_Park.txt present=1 lw=predict(len=7) msglen=144
Worker-3 2:pre ==> preserves
msgsnd Reply 3 of 5 on 2:pre from Tale_Of_Two_Cities.txt present=1 lw=preserves(len=9) msglen=144
**prefix(3) wor received
Worker-1 3:wor ==> world
Worker-3 3:wor ==> worst
Worker-0 3:wor ==> not found
Worker-2 3:wor ==> not found
msgsnd Reply 1 of 5 on 3:wor from Mansfield_Park.txt present=1 lw=world(len=5) msglen=144
Worker-4 3:wor ==> not found
msgsnd Reply 3 of 5 on 3:wor from Tale_Of_Two_Cities.txt present=1 lw=worst(len=5) msglen=144
msgsnd Reply 0 of 5 on 3:wor from Sense_And_Sensibility.txt present=0 lw=—-(len=4) msglen=144
msgsnd Reply 2 of 5 on 3:wor from The_Call_Of_The_Wild.txt present=0 lw=—-(len=4) msglen=144
msgsnd Reply 4 of 5 on 3:wor from Peter_Pan.txt present=0 lw=—-(len=4) msglen=144
**prefix(0) received
Terminating …
Search Manager requirements
–
–
–
–
–
Must be written in C
Numeric parameter denoting delay will be present and an integer; if it is zero, then use no delay
At least one prefix will be provided (may not be valid)
Only process prefixes are at least 3 characters should be processed
Only one prefix should be processed at a time. Once all the results on a prefix are returned, the next can be
sent to the passage processor
–
Send a prefix message with a zero id to notify the passage processor to complete