Grokking Concurrency in Python
Vote

0% completed

​

What Crosses a Process Boundary

pool.submit(lambda text: len(text), page).result()

That line works with a thread pool. With a process pool, it raised an error instead of returning a number.

Output:

1. Sending a lambda to a worker PicklingError: Can't pickle <function <lambda> at 0x...>: it's not found as __main__.<lambda>

A worker process shares no memory with its parent, so the function, its arguments and its result must all be turned into bytes, sent, and rebuilt on the other side.

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content