Q. Processes vs. Threads
A process is an execution of a program, while a Thread is a single execution sequence within a process.
A process can contain multiple threads.
Q. What are different ways of creating a thread ? Which one would you prefer and why ?
- A class may extend the Thread class.
- A class may implement the Runnable interface.
- An application can use the Executor framework, in order to create a thread pool.
In case your application design requires multiple inheritance, only interfaces can help you.
Also, the thread pool is very efficient and can be implemented and used very easily.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.