What strategies do you use to ensure thread safety when performing background tasks?
Implement run_background_tasks(tasks, worker_count) to execute a dependency graph concurrently. Each task has an integer value, and its result is its value plus the results of all dependencies. Protect shared scheduler state, avoid holding locks during task computation, and return results in the original task order. Inputs contain a valid acyclic graph, unique task IDs, and no task computation failures.
tasks is a list of {id: string, dependencies: list[string], value: integer} objects. Return a list of integers.
def run_background_tasks(tasks, worker_count):