20,741
edits
| Line 31: | Line 31: | ||
== incremental GC == | == incremental GC == | ||
== concurrent GC == | == concurrent GC == | ||
running the garbage collector in a separate thread can be an effective way to improve its performance, especially in a program like FlightGear that does not use multiple cores effectively. By running the garbage collector in a separate thread, you can offload its work to a different CPU core and reduce the impact of garbage collection on the program's overall performance. | |||
One way to do this is to identify times during processing a new frame when no Nasal code is being run but something else is time-consuming, such as rendering graphics. This could be the perfect opportunity to run the garbage collector in a separate thread, as the main thread would be busy with other work and would not be impacted by the garbage collector's latency. | |||
To ensure that the garbage collector is not running at the same time as Nasal execution, you could use a single condition variable to coordinate between the two threads. This condition variable could be used to signal when it is safe to run the garbage collector, and to prevent the garbage collector from running while Nasal code is being executed. By using a condition variable in this way, you can effectively coordinate between the two threads and ensure that the garbage collector is not impacting the program's overall performance. | |||
== References == | == References == | ||
{{Appendix}} | {{Appendix}} | ||