108
edits
Changes
→Enhancement
'''Enhancement Result'''
* The frames frame flow much smoothly is very smooth due to the transformation of the node chains is which are updated concurrently and efficiently during rendering instead of being done sequentially.
* The program runs significantly faster significantly. To show improved performance of the Emperor Engine, we used Performance and Diagnostic tool in Visual Studio on the a lab computer. It shows that by using thread is multiple threads, performance has improved 10 times faster than before.
[[File:Node Absolute Calculator Result.jpg]]
* Class ThreadPool
** A class An object of ''ThreadPool'' class is created which creates threads at its initializationto accept threads in a vector called ''threads''.** The number of threads depends on the number of the computer core systemsystems, 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 are 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 flags to run threadsdecline a new job while the thread pool is shutting down.** In ''Run'' function, the ''threadPool'' dispatches the a 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 added to the queue threadPool which means an added job is waiting to calculate node’s absolute transformation.** While adding jobs, one slept thread from the thread pool wakes up, and perform performs the ''Run '' function subsequently.** Before the function ''updateValues '' ends, threads are terminated through the ShutDown function of ''ThreadPool''.
* Member 1(Erquan (Ashley) Bi)
** Work Worked on how many threads need are needed and how they are being divided and dispatched form the thread pool to a vector of threads for each core to calculate node absolute transformation on hardware.
* Member 2 (Eunju Han)
** Manager thread Managed threads’ running and termination with determined threadsand Merged code with Ashley’s work and tested with the client program (Lab8).
'''Source Code Repository
'''[https://bitbucket.org/Apex_Page/scs_emperor https://bitbucket.org/Apex_Page/scs_emperor]
<Multi-Thread Resources>
[http://www.cplusplus.com/reference/thread/thread/ std::thread]