What sort of distributed system architecture would you use


Assignment

1. One of the most challenging aspects of both Real Time Embedded and Distributed Systems is process coordination - coordinating computational processes which are running in parallel. Threads are a concept used to execute different code on different CPUs simultaneously on the same machine. We will use this concept, and implementations of it in the Python programming language, to explore issues associated with parallel processing .

Consider Assignment5.py. It starts with a vector (100 elements - 1 to 100) and uses 200 threads to increment each element of the vector by 1 (+1 each).

Part 1. Review and run Assignment5.py several times, and explain the results. Are they what you expect? Why or why not? Note: I have checked this on several machines, but I can't guarantee that you will always see the anomalies I'm trying to demonstrate. The numerically correct answer is range(201,301). If you do see that correct answer, imagine that the following was generated, instead, for the purposes of answering this question.

2091_Final-List.jpg

Part 2.One line of python code may translate to several instructions that occur on the CPU. Consider the self.l[self.iteration] = self.l[self.iteration] +1statement. In it, at least 3 things are happening seriallywithin a thread: read the current value of the vector element, calculate the new value of the element, and write the new value of the element. Why is this relevant?

Part 3. Remove the comments around the lock.acquire(), lock.release(), and lock = threading.Lock() calls in Assignment5.py and run it several times. Explain the results. Are they what you expect? Why or why not?

Part 4. This is a simple (and small) example of process coordination. "Real" applications and/or distributed systems can have 100s of threads and/or processes all doing different activities. How does this complexity impact the Software Systems Engineering of such systems?

2. Imagine that you'd like to take Assignment5.py, and instead of distributing the work to individual threads, you'd like to use individual machines (i.e., a distributed system).

Part 1 What sort of distributed system architecture would you use for this problem, and why?

Part 2 Which aspects of building the solution would be similar to the thread solution? Which aspects would be different?

3. In Assignment5.py, consider the use of the range() function.

Part 1 Why is it better to reuse this function than write out a 100 element vector?

Part 2 Now imagine that the range function was another piece of code that you could reuse, but you had to pay for the right to use it. What factors would go into your decision on whether you use it (i.e., pay for it) vice not (i.e., writing out the vector using another tactic)?

Part 3 If, instead of range(), the reuse question was for random.randint() or all of the thread functions, would that change the answer to your question? Why or why not?

4. Explain the difference between Service Oriented Architect and Web Services.

Attachment:- Assignment.rar

Request for Solution File

Ask an Expert for Answer!!
Python Programming: What sort of distributed system architecture would you use
Reference No:- TGS02746955

Expected delivery within 24 Hours