Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Python Expert

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

Python, Programming

  • Category:- Python
  • Reference No.:- M92790139

Have any Question?


Related Questions in Python

Architecture and system integrationcase study queensland

Architecture and System Integration Case Study: Queensland Health - eHealth Investment Strategy After evaluating various platforms, Queensland Health finally decided to adopt a Service Oriented Architecture (SOA) for its ...

Simple python traffic lightswrite a program that simulates

Simple Python (Traffic lights) Write a program that simulates a traffic light. The program lets the user select one of three lights: red, yellow, or green. When a radio button is selected, the light is turned on, and onl ...

Quesiton write a python script that counts occurrences of

Quesiton: Write a python script that counts occurrences of words in a file. • The script expects two command-line arguments: the name of an input file and a threshold (an integer). Here is an example of how to run the sc ...

Show times in tmus and seconds1 an associate grasps an oven

Show times in TMUs and seconds. 1. An associate grasps an oven door within reach and pulls it open 18 inches with the left hand (he does not relinquish control of the door). With a pan in the right hand, he carefully pos ...

Part i the assignment filesone of the most important

Part I: The Assignment Files One of the most important outcomes of this assignment is that you understand the importance of testing. This assignment will follow an iterative development cycle. That means you will write a ...

Learning outcomes lo3 - research develop and document a

Learning Outcomes LO3 - Research, develop, and document a basic security policy, and analyse, record, and resolve all security incidents LO4 - Identify and assess the threats to, and vulnerabilities of networks Assessmen ...

Question write a python program with a graphical user

Question: Write a python program with a graphical user interface that will allow a user to create a custom pizza which they wish to order. At minimum, the user should be able to choose the size of the pizza, the type of ...

Python programming assignment -you first need an abstract

Python Programming Assignment - You first need an abstract base class, called, Account which has the following attributes and methods: accountID: This attribute holds the ID assigned the account , if not provided set to ...

A software company sells a package that retails for 99

A software company sells a package that retails for $99. Quantity discounts are given according to the following table: Quantity Discount 10 - 19 20% 20 - 49 30% 50 - 99 40% 100 or more 50% Write a program using python t ...

Questionwhat is a python development frameworkgive 3

Question What is a python development framework? Give 3 examples python development framework used today. and explain which development framework is used in which industry.

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As