Chapter 23 Flashcards

1
Q

What is semaphore

A

Semaphore is an integer variable that can be accessed by 2 atomic operations.

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

What block() operation do

A

block() suspends the process that invokes it

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

What wakeup() operation do

A

wakeup(P) resumes the execution of a blocked process P.

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

When critical sections are small which one is better

  • busy-waiting
  • queue-waiting
A

busy-waiting

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

When critical sections are long which one is better

  • busy-waiting
  • queue-waiting
A

queue-waiting

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

Could we have semaphorse based solution for process synchronization

A

Yes

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

If programmer mistakenly use semaphore wait operation, what will happen

A

Then there will be 3 general problems

  1. Mutual exclusion violation
  2. Infinite blocking of some process (starvation)
  3. Deadlocks (2 processes waiting for each other to execute and no one execute)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are 2 types of deadlock

A
  1. Traffic deadlock

2. one-way bridge-crossing

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

Why programming error occurs in semaphore

A

Due to tandem use of wait() and signal() operations

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

What is the solution of programming errors in semaphore

A

Make wait() and signal() operations as programming construct. Then programmer do not need to implement it.

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

What are 2 examples of programming constructs for semaphor

A
  1. Critical regions

2. Monitors

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

What are types of semaphores

A
  1. Counting semaphore

2. Binary semaphore

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

What are binary semaphore

A

Its integer value can not be >1. They are simpler to implement. Values can be negative.

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

What are counting semaphore

A

Integer value can range over an unrestricted integer domain.

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