Assembly line / Pipeline
Problem DefinitionCache Data Refresh
Requirement
Solution1
Limits:
Solution2Instead of 'R-G-W' one point by one point. We first snap all the points in the cache file intensively,and put all the point in 4096 point files. So each point file contains a certain number of points. Then use several threads to repeat 'R-G' process using point files,and one threads to repeat 'W' process. Once a point file is finished,delete it and process next file.
Benefit:
Postmortem1. How to handle batch process 1) break down (Split) and reassemble to get pipelining http://en.wikipedia.org/wiki/Assembly_line Consider the assembly of a car: assume that certain steps in the assembly line are to install the engine,install the hood,and install the wheels (in that order,with arbitrary interstitial steps); only one of these steps can be done at a time. In traditional production,only one car would be assembled at a time. If engine installation takes 20 minutes,hood installation takes 5 minutes,and wheel installation takes 10 minutes,then a car can be produced every 35 minutes.
In an assembly line,car assembly is split between several stations,all working simultaneously. When one station is finished with a car,it passes it on to the next. By having three stations,a total of three different cars can be operated on at the same time,each one at a different stage of its assembly.
After finishing its work on the first car,the engine installation crew can begin working on the second car. While the engine installation crew works on the second car,the first car can be moved to the hood station and fitted with a hood,then to the wheels station and be fitted with wheels. After the engine has been installed on the second car,the second car moves to the hood assembly. At the same time,the third car moves to the engine assembly. When the third car’s engine has been mounted,it then can be moved to the hood station; meanwhile,subsequent cars (if any) can be moved to the engine installation station. Assuming no loss of time when moving a car from one station to another,the longest stage on the assembly line determines the throughput (20 minutes for the engine installation) so a car can be produced every 20 minutes,once the first car taking 35 minutes has been produced. http://en.wikipedia.org/wiki/Pipeline_(computing) http://en.wikipedia.org/wiki/Instruction_pipeline 2) find the bottleneck in a proper granularity 3)intermediate result/state may be helpful. In above case,point file. 2. Cache Design Considering about cache expire. Generally Date info or life time is created together with cache entry. 3. Quadtrees Why not database to store the entry ? please see Quadtrees 1) C++ Implementation 2) Use Case (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |