O'Reilly logo

Mastering the Nmap Scripting Engine by Paulino Calderón Pale

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Parallelism mechanisms in Lua

This section covers an interesting parallelism mechanism in Lua called coroutines that will help us achieve collaborative multitasking.

Coroutines

Coroutines in Lua are a very interesting feature that allow developers to execute multiple tasks cooperatively. Each coroutine has its own execution stack, and they are used in the background by NSE to encapsulate the execution of its scripts. The main advantage of using coroutines is the ability to suspend and yield execution of tasks. It is important to understand the difference between coroutines in Lua and traditional threads in preemptive multitasking. Coroutines share context data and, therefore, must be used to reduce overhead when working with tasks that share a lot ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required