nelhage / llama

Apache License 2.0
589 stars 24 forks source link

Use a semaphore in the daemon to control llamacc concurrency #16

Closed nelhage closed 3 years ago

nelhage commented 3 years ago

llamacc processes compete for CPU, especially while running gcc -MM to detect dependencies. Use a semaphore on the connection to the daemon to limit how many may execute concurrently in order to thrash the CPU less and allow jobs to get into AWS more efficiently. We implement this by blocking when we open a connection to the server, and dropping/releasing the semaphore on entry/exit to InvokeWithFiles to allow another worker to make progress.