Thread
Thread
Multitasking
Multitasking is a process of executing multiple tasks simultaneously. We use
multitasking to utilize the CPU. Multitasking can be achieved in two ways:
Threads are independent. If there occurs exception in one thread, it doesn't affect
other threads. It uses a shared memory area.
As shown in the above figure, a thread is executed inside the process. There is
context-switching between the threads. There can be multiple processes inside
the OS, and one process can have multiple threads.
3) static void sleep() It sleeps a thread for the specified amount of time.
object.