Lab7

Q1. You need to convert a large number of very long text files (with many records) to XML.
Which two concurrent architectures can be used to solve the problem? Which concurrent
architecture would be most suitable for solving the above problem? Justify your answer.

Q2. A web crawler downloads hundreds to thousands of web pages pages per minute. Each
of these web pages need to parsed and indexed and the results of indexing are to be stored in a
central database. Assume that crawling and indexing are complex and takes lot of time and resources.
Which concurrent architecture(s) would be the most suitable for implementing the the above system? Justify your answer and draw a diagram for the selected architecture(s).

Q3. What type of concurrent architecture would you use for each of the following:

a) A program which displays the latest news from news websites. It must update its news when there is new news on the website.
b) You need to sort a very large number of very large files (millions or records).

For each of the above briefly explain which concurrent architecture would you use and why? Also draw a diagram for the selected architecture.

Q4. Assume that a problem takes 40 seconds to compute sequentially and 10 seconds to execute on 4 parallel processors. Calculate the speedup and efficiency.

Q5. Assume that a problem takes 50 seconds to compute sequentially and 20 seconds to execute on 5 parallel processors. Calculate the speedup and efficiency.

Code Examples:

1. Multiples of 7 Filter – filters all the numbers except 7 and outputs them
2. File sort filter – file sorts a file and outputs the sorted file to the screen and also a file
3. Multiple File Sort using Supervisor Worker - sort many large files which are very long

In Lab Exercises:

1. Writer a generator and prime filter – the generator will generate all numbers between 1-100 put them into a pipe and prime filter takes the numbers from the pipe and outputs only the numbers which are prime. (Follow code example 1)

2. Write a UpperCaseFilter – the generator reads a file and puts lines into a pipe and the UpperCaseFilter converts all the lines in the pipe to pper Case. It should put the output to the screen and a file. (Follow code example 2)

3. Multiple file search using Supervisor worker – You have to search some very large files which are supplied to you for particular string and display the string and the lines on which it was found (Follow code example 3)