Script is starting with 150 threads. They work for random time and sleep random time also.
How you can make the script to run only 10-20 threads at the same time? When this 10-20 threads finish work they go to sleep, another 10-20 threads start and so on.
Each asynchronous function started, starts in separate thread.
So in that example you will have 2 threads since 2 asynchronous functions
will be started, each with its own (different) script.