Summary
NSE automatically performs several operations in parallel to obtain better performance during scans. Most of the time, we won't even realize when our scripts are yielded because of this. However, there are special situations where we may need finer control over the execution of our scripts.
In this chapter, you learned all the parallelism mechanisms supported by NSE and how you can use them to control the execution flow of scripts and worker threads. We introduced Lua coroutines, showed the differences from traditional preemptive multithreading, and demonstrated how to use them to achieve collaborative multithreading. Additionally, you learned about condition variables and mutexes to control the execution flow of threads in NSE.
The next ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access