0% found this document useful (0 votes)
21 views

Thread Demo

The document shows the output of multiple threads running when the main thread suspends. Three threads are running concurrently, each printing their name and a number that decreases each second. The main thread sleeps for 10 seconds, allowing the other threads to run before resuming.

Uploaded by

saati143431
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Thread Demo

The document shows the output of multiple threads running when the main thread suspends. Three threads are running concurrently, each printing their name and a number that decreases each second. The main thread sleeps for 10 seconds, allowing the other threads to run before resuming.

Uploaded by

saati143431
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Multiple Threads can run when main thread suspends its execution.

Third Second First run()

0th sec One: 5 Two: 5 Three: 5

1st sec One: 4 Two: 4 Three: 4

2nd sec One: 3 Three: 3 Two: 3

3rd sec One: 2 Three: 2 Two: 2

4th sec One: 1 Three: 1 Two: 1

5th sec i value goes out of range

Main thread

default run() 0th sec Sleep 10th sec resume

You might also like