Chapter 23 Flashcards

1
Q

Can a process have multiple threads

A

Yes

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

What is light weight and what is heavy weight, Thread or process

A

Processes are heavy weight

Thread is light weight

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

how thread and process deal with address base

A

Thread shared address base and process have own address base

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

Does java have built-in support for threading

A

Yes

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

Who deals with threads of java on OS level

A

Virtual Machine (VM)

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

What is starvation

A

One thread executes and keep executing and another thread can not run. It is called starvation.

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

What are 2 approaches in JAVA to create threads

A

1- Interface based

2- Inheritance based

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

Can we set priority in JAVA threads

A

Yes

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

How can we change priority of threads

A
Using 3 predefined constants
- Thread.MAX_PRIORITY (typically 10)
- Thread.NORM_PRIORITY (typically 5)
- Thread.MIN_PRIORITY (typically 1)
Or 
set to 1-10
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the method to set priority

A

setPriority(int priority)

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

What is the exception for threads

A

IllegalArgumentException

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

Does cooperative multi threading old

A

Yes

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

What are 2 ways to avoid starvation

A
  • Sleep

- Yield

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