Mod 5: Thread pools Flashcards

1
Q

Why would we want to limit the number of threads?

A

Thread creation is expensive, we want to decrease overhead

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a thread pool?

A

A thread pool is a collection of thread , where the threads is recycled

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are an example of shared resources in thread pool?

A

The queue holding tasks waiting for an available thread

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In java, which classes are used to work with thread pools?

A

(1) Executor
(2) Executors
(3) ExecutorService

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are some advantages of a thread pool?

A

(1) Saves resources
(2) Improved performance
(3) Prevent overload
(4) Managed way of using threads

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is “overload”?

A

Overload occurs when overhead exceeds available time to perform tasks, and the system stops responding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are some dissadvantages of thread pools?

A

(1) Lack of control over specific threads
(2) Limited scalability
(3) Potential for thread starvation
(4) Complex programming
(5) Increased memory usage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly