You are on page 1of 1

1. A thread is a separate path of execution in a program.

A Process
is a program in execution. explain why?
- A thread is actually a lightweight process. Unlike many other computer
languages, Java provides built-in support for multithreaded programming.
A
Process is called the heavy Thread is called a light weight
8.
weight process. process.

Thread switching does not


Process switching uses require to call an operating
9.
interfaces in operating system. system and cause an interrupt
to the kernel.

If one server process is blocked


Second thread in the same task
no other server process can
10. could run, while one server
execute until the first process
thread is blocked.
unblocked.

multithreaded program contains two or more parts that can run


concurrently. Each part of such a program is called thread and each
thread defines a separate path of execution.

2. What is daemon thread and which method is used to create the


daemon thread?
- setDaemon(true) is used to create a daemon thread in java. This
method should be invoked before the thread is started otherwise
it will throw IllegalThreadStateException . We can check if a
thread is a Daemon thread or not by calling isDaemon() method
on it.

3. What do you understand by Synchronization?


Synchronization in java is the capability to control the access of

You might also like