Thursday, December 12, 2019

Parallel Programming for Complete Binary Tree - myassignmenthelp

Question: Discuss about theParallel Programming for Complete Binary Tree. Answer: Functional Specification Each node of a binary tree requires expensive processing, so the structure of a tree wont be known until runtime. The traverse method processes the current node then creates child task one for each branch underneath. Parallel tasks uses blocking members include Task.WaitAll to create child/parent relationship I.E tasks.Parallel and Task.Factory.StartNew[1]. Parallel.Invoke creates new tasks and waits for them. It uses methods of the Task class to do this. AggregateException is use to communicate errors being thrown from the parallel task execution. Technical Specification This is the main class where it execute defined classes that is DoTree(tree, myAction) which take a root node and parallel task action. Root node has been declared as a tree[1]. MyClass is a class which has properties of set and get. Get accesses any member with a class while set receives an implicit value to which property is assigned to. Data structure class Tree is declared to hold data variables and nodes position variables. By using task explicitly the program can run statements concurrently. Parallel incur when Parallel.Invoke class is executed. Parallel executed when DoTree2 method is call. Parallel.Invoke is the simplest expression of the parallel task pattern. It creates new parallel tasks for each delegate method that is in its params array argument list. The Invoke method returns when all the tasks are finished[2]. The delegate methods of Parallel.Invoke can either complete normally or finish by throwing an exception. Any exceptions that occur during the execution of Parallel.Invoke are deferred and rethrown when all tasks finish. All exceptions are rethrown as inner exceptions of an AggregateException instance[3]. Reference [1]"Task Class (System.Threading.Tasks)", Msdn.microsoft.com, 2017. [Online]. Available: https://msdn.microsoft.com/en-us/library/system.threading.tasks.task(v=vs.110).aspx. [Accessed: 27- Nov- 2017]. [2]"Construct Complete Binary Tree from its Linked List Representation - GeeksforGeeks", GeeksforGeeks, 2017. [Online]. Available: https://www.geeksforgeeks.org/given-linked-list-representation-of-complete-tree-convert-it-to-linked-representation/. [Accessed: 27- Nov- 2017]. [3]"How to: Use Parallel.Invoke to Execute Parallel Operations", Docs.microsoft.com, 2017. [Online]. Available: https://docs.microsoft.com/en-us/dotnet/standard/parallel-programming/how-to-use-parallel-invoke-to-execute-parallel-operations. [Accessed: 27- Nov- 2017].

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.