Changes

Jump to: navigation, search

Apex Page

2,200 bytes added, 18:06, 3 December 2015
Enhancement
'''Title: Multi-threaded Node Absolute Calculator'''  '''Enhancement Result''' * The frames flow much smoothly due to the transformation of the node chains is updated concurrently and efficiently during rendering instead of being done sequentially. * The program runs faster significantly. To show improved performance of Emperor Engine, we used Performance and Diagnostic tool in Visual Studio on the lab computer. It shows that using thread is 10 times faster than before. [[File:Node Absolute Calculator Result.jpg]] '''Enhancement Process''' * Class ThreadPool** A class ''ThreadPool'' is created which creates threads at its initialization.** The number of threads depends on the number of the computer core system, it can be obtained at the run time through std::thread::hardware_concurrency() in ''ThreadPool'' constructor, and it is stored in a std::vector called ''threads''.** The ''threadPool'' is a queue holding jobs which is defined as std::function, and a job is added into ''threadPool ''in ''AddJob'' function.** std::mutex and std::condition_variable is used to lock and unlock threads status and to wake threads respectively. In addition to, two bool type variables (quit and stopped) are flag determining to run threads.** In ''Run'' function, the ''threadPool'' dispatches the job to each thread to be finished one by one until all jobs are done or the program is terminated.** The ''ShutDown'' function wakes all threads up and makes them join to be terminated. * To Use the Threads** When the NodeManager performs the function updateValues for each active object from the vector activeObjects, jobs(active objects(Node)’ _updateAbs function) are add to the queue threadPool which means an added job is waiting to calculate node’s absolute transformation.** While adding jobs, one thread from thread pool wakes up, and perform the Run function subsequently.** Before the function updateValues ends, threads are terminated through the ShutDown function of ThreadPool.  '''Work Load Division''' * Member 1(Erquan (Ashley) Bi)** Work on how many threads need to calculate node absolute transformation on hardware. * Member 2 (Eunju Han)** Manager thread running and termination with determined threads. 
[http://www.cplusplus.com/reference/thread/thread/ std::thread]
 
 
108
edits

Navigation menu