May 2018
Intermediate to advanced
380 pages
9h 37m
English
The reason the default mode for garbage collection isn't changed to handle threads is because, while it would work for programs that are already multithreaded, single-threaded programs see finalization calls within the main thread. Changing this behavior may result in bugs in the program, related to finalizers existing outside of the main thread.
It also causes problems if the program is written to use forking for concurrency. Forking from a single-threaded program is fine, as that is its intended use, but when forking from a multithreaded program, errors can creep into the system.
Due to compatibility issues, garbage collection currently waits for the collection process to end before the main thread is recalled. Thus, while ...