caching - C++: execute two tasks and kill the one which takes longer -


let's suppose have generic task doesn't produce side-effect. let's suppose have result caching (or memoization) mechanism, avoid perform our task seen input.

let's suppose caching mechanism potentially time expensive, , want avoid waste time cache misses.

my solution far is: system receives input data, execute 2 different processes. first 1 original task, happen without caching mechanism. second 1 looks inside cache structure. first process terminates, kills other. more expensive in terms of resources, guarantee our system caching mechanism at expensive original one.

so, question is: possible implement "kill slower process" in c++, in moment , given task (without side-effects)?

ps: guarantee best possible performance, these 2 processes may distributed in 2 different machines.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -