The max number of parallel threads

Report a typo

What is the maximum number of threads that can work in parallel in the program below?

SlackerThread is a class representing a thread that sleeps a random number of seconds after the start.

Tip: Don't forget about the main thread.

fun main() {
    val t1 = SlackerThread()
    val t2 = SlackerThread()

    t1.start()
    t2.start()

    t2.join()

    val t3 = SlackerThread()
    val t4 = SlackerThread()

    t3.start()
    t4.start()

    t3.join()
    t4.join()
}
Enter a number
___

Create a free account to access the full topic