Week 3 Flashcards

1
Q

cmpxchg

A

Test and set for Intel. Source must be a register and destination is usually a address. Can’t be the A register. Put destination address into eax register. Compare it with dst register. If you get the correct address back, set zero flag to one and destination value to the source value. If not, set zero flag to zero and reset eax with dst register value.

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

ARM

A

RISC style instruction set. exchange process. If two processes get the value 0, the store lets the process know its not the first one to get a zero. It will loop back and try again.

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

Semaphores for synchronization

A

Set semaphore number higher.

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

Bounded buffer with semaphores

A

Have a full = 0, empty = 0, and mutex = 1 semaphore. Full represents slots with data, empty represents buffer without data.

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

Producer semaphore

A

Wait(empty), wait(mutex), Add to buffer, signal(mutex), signal(full)

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

Consumer

A

wait(full), wait(mutex), CS, signal(mutex), signal(empty)

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

Synchronizing consumer producer

A

Consumer wait will depend on producer signal. If empty is zero, will force producer to sleep until buffer empties.

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

Reader Writer problem

A

Only one process is allowed to write to a resource at a time but more than one is allowed to read from a process. If reading -> no process can write and vice versa.

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

Semaphore solution to read write - writer

A

wait(wrt), signal(wrt)

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

Semaphore solution to read write - reader

A

wait(mutex), readcount++, if readcount ==1 wait(wrt), signal mutex, read, wait(mutex), readcount–, if readcount ==0 signal(wrte), signal(mutex)

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

Critical Regions

A

High level solution to CS problem that removes programmer overhead.

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

Shared keyword

A

Critical region that allows for only one process to access the shared resource at a time

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

region v when B do S

A

region name when (boolean) do CS. If there is a simultaneous access the compiler will throw an error. When process leave S, all other programs reevaluate B.

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

region v when B do S for Consumer-Producer

A

B is space in the array (producer) and data to read (consumer)

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

Monitor

A

High level synchronization construct that allows for the safe sharing of data. Singleton class. Shared variables are set inside the monitor. Contains code to initialize variable, and procedure that represent to CS of various processes.

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

Condition variables

A

Cues declared in shared variable section. Operations of wait and signal are applied to the queues. x.wait means put on queue, sleep, and yield lock. It will not affect variable y

17
Q

Signal in condition variables

A

When process executes x.signal and another process is waiting on x. First process goes to sleep until second process exits or waits. First process continues and executes. If another process wakes you up, you put that code to sleep, execute code, and then wake up another process.

18
Q

Explain producer-consumer model for monitor

A

See picture

19
Q

Prioritized waiting for monitor

A

X.wait(x) where x is an integer that will give priority on the queue for X

20
Q

Java Synchronized methods

A

Synchronized keyword applied to method. Makes the method become a monitor. Must specify the object that acts as the lock in the parameters. Java’s synchronization does not explicitly require you to declare the shared variable within the block. Instead, the block synchronizes on the object instance specified in the synchronized keyword. Every object has an intrinsic lock

21
Q

Java Producer Consumer

A

Notify -> signal but it wakes up everyone who was sleeping. One will wake up and the others will go back to sleep. Does not ensure priority over the latest to wait (no bounded wait). Only one condition variable is necessary because the buffer cannot be full and empty.

22
Q

Processing Bursts

A

Most are short I/O, few are long CPU

23
Q

Hyper exponential distribution

A

Length of bursts vs occurrences. Really short and long bursts are rare. See picture

24
Q

Preemptive Scheduler

A

Takes itself off the CPU other than for I/O or finishing. Does not get switched at every interrupt

25
Q

Dispatcher

A

Part of scheduler responsible for performing context switch and resuming process

26
Q

Dispatch latency

A

Time for dispatcher to run

27
Q

CPU utilization - sched criteria

A

Keep CPU as busy as possible

28
Q

throughput - sched criteria

A

of jobs per unit of time

29
Q

turnaround - sched criteria

A

Time of submission to completion

30
Q

Wait time - sched criteria

A

Average amount of time in ready queue

31
Q

Response - sched criteria

A

Submit time to output request (keystroke to terminal)

32
Q

Simulation vs Implementation

A

Simulation involves trying out the different scheduling, which is hard to do. Implementation is try and find out which is expensive

33
Q

Multiple processor queues

A

Usually a common queue for all processors. However, not every board has access to every I/O device.