Chapter 5 Flashcards

1
Q

what is a cooperating process

A

it can affect or be affected by other processes executing in the system

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

define race condition

A

several processes access and manipulate the same data concurrency and the outcome of the execution depends on the particular order in which the action takes place

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

what is a way to prevent race condition

A

process to be synchronized

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

a solution to the critical-section must satisfy what 3 requirements

A
  1. mutual exclusion
  2. progress
  3. bounded waiting
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

define Peterson’s solution

A

restricted to two processes that alternate execution between their critical sections and remainder sections

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

what should be used to see if a process is ready to enter its critical section

A

flag array

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

define locking

A

protecting critical regions through the use of locks

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

define mutex locks

A

mutual exclusion locks, simplest of synchronization tools, mutex lock has a boolean variable available whose value indicates if the lock is available or not

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

atomic process when lock is available

A

call to acquire() lock before entering a critical section, release() lock when it exits the critical section

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

define spinlock

A

the process spins while waiting for lock to become available, they are useful because context switch is not required

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

define busy waiting

A

wastes CPU cycles that could’ve been put to use by other processes

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

define semaphores

A

integer variable that is accessed through only 2 atomic operations: wait() and signal()

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

define counting semaphores

A

unrestricted domain

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

define binary semaphore

A

range between 0 and 1, behaves similarly to mutex locks

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

expand on the use of semaphores to count instances

A
  • goes up when releasing a resource signal()

- goes down when using resource wait()

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

what keyword to synchronize semaphores

A

synch

17
Q

expand how semaphores work

A

when a process executes a wait() operation and finds a semaphore value is not positive, it must wait. but instead of busy waiting, process can block itself. block operation places a process into a waiting queue and state of process is switched to waiting state. then the control is transferred to CPU scheduler. the waiting state is then restarted by wakeup() operation and it goes to ready state

18
Q

define deadlocks

A

2 or more processes waiting indefinitely for an event that can be caused by only one of the waiting processes

19
Q

define starvation

A

also known as indefinite blocking, it is a situation in which processes wait indefinitely within the semaphore

20
Q

define priority inversion

A

scheduling problem when lower priority process holds a lock needed by higher priority process. solved by priority-inheritance protocol

21
Q

what is the dining philosophers problem

A

need to allocate several resources among several processes in a dead-lock free and starvation-free manner

22
Q

what is the difference between deadlocks and starvation

A

you can have starvation without deadlock.

23
Q

what is the type of error caused by using semaphores incorrectly

A

timing errors. need to do wait() and then signal(). no other combination of the methods work

24
Q

define monitor type

A

ADT, encapsulates data with a set of functions to operate on that data, includes a set of programmer-defined operations that are provided with mutual exclusion within the monitor

25
Q

how to invoke wait() operation of condition x

A

x.wait();

26
Q

what are the 2 processes that can continue execution in monitor usage

A
  1. signal and wait

2. signal and continue