Process Synchronization Flashcards

1
Q

Cooperating Process

A

A process that can affect or be affected by other executing process. Done by accessing the data section and shared memory.

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

Race condition

A

Several process try to access and manilpuate the same data concurrently.

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

Critical Section solution 3 requirements

A
  1. Mutual exclusion: only one process executes the critical section at a given time.
  2. Progress: there should be progress, if a process needs to enter the cirital section and it can, then it should.
  3. Bounded waiting: There should be a limit on how much a process needs to wait before being granted permission to enter.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Nonepreemptive kernel

A

A process running in kernel mode is not allowed to be preempted, insuring no race conditions happen on kernel data structures.

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

Preemptive kernel

A

Processes running in kernel mode are allowed to be preemted. The kernel needs to be carefully designed to prevent race conditions. Better since it is more responsive and doesn;t let the kernel hog the system.

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

Peterson’s Solution

A

Shared data:
int turn;
boolean flag[N]; Indicates if a process is ready to enter.

Flow for proecess i:

flag[i] = TRUE;
turn=j;
while ( flag[j] & turn == j);
CRITICAL SECTION
flag[i] = FALSE;
REMAINDER SECTION

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

Atomic operation

A

Sequence of instructions that must run inorder and with no interference.

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

TestAndSet

A

boolean TestAndset (boolean *target)
{
boolean rv = *target;
*target = TRUE;
return rv:
}

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

void Swap (boolean *a, boolean *b)
{
boolean temp = *a;
a=b;
*b= temp;
}

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

Semaphore

A

Basically an integer that is used to solve the mutual problem.
accessed through two atomic operations:
wait(s){
while s <= 0;
; //no op
s–;
}

signal(s){
s++;
}

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

Binary semphore

A

Basically a mitex lock, a semaphore that is only 0 or 1.

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

Semaphore busy waiting fix

A

Define semaphore as a struct with a value and a process list. If a process needs to wait, it adds itself to the list and blocks itself from continuing execution.
The signal operation removes theprocess from the list and wakes it up (moving it from waiting to ready).

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