• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/31

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

31 Cards in this Set

  • Front
  • Back

Why is memory sharing between processes dangerous?

Because. Operating system has no control over it and race conditions between two processes can cause problems if OS switches processes while memory is not fully changed by one process

How does a parent kill a child in UNIX?

By calling abort()

In a UNIX system, if a parent process dies, what happens to its child processes?

They get adopted by process 1 (the root process)

What is the producer-consumer problem (aka Bounded Buffer problem) ?

A producer inserts data/messages into a buffer while a consumer reads is. The challenge is to ensure the consumer stays behind or at the same slot as the producer, that the producer does not overwrite itself, and the consumer does not read garbage.

What solution is proposed for the producer-consumer problem?

Using a variable "counter" which is incremented by the producer and decremented by the consumer

What is the "Critical Section problem"?

When a part of a program must only be executed by at most one process at a time.

What is a simple protocol to solve the Critical Section problem?

Require each process to:
1) ask permission to enter critical section


2) execute the critical section


3) exit critical section and possibly do some finish operations

True or false: On uniprocessors, not allowing interrupts is an efficient way to execute critical section code

True. On multiprocessor machines this is usually inefficient and ineffective since OS systems using this would not be scalable - you don't want to disable ALL interrupts regularly. There would be little advantage of multiproccessor systems if this was done

How is this concept/function used to create a hardware lock on critical section code? 

How is this concept/function used to create a hardware lock on critical section code?

What is a Mutex Lock?

Mutex = "MUTual EXclusion"




A process who wants to use a critical region, must acquire() a lock and then release() it

What is a spinlock?

A spinlock keeps a process in an infinite loop until a mutex lock (or other type of lock) on a critical section is released



What is a counting semaphore?

A semaphore is a protected variable or abstract data type which constitutes the classic method for restricting access to shared resources such as shared memory in a parallel programming environment.


What are the two most common types of semaphores?

Counting semaphores can solve synchronization problems that involve the involve the sharing of multiple resources




Binary semaphores can have the value of zero or one only

What are the operations that can access a semaphore?

wait() is called when a process wants access to a resource. This would be equivalent to the arriving customer trying to get an open table. If there is an open table, or the semaphore is greater than zero, then he can take that resource and sit at the table. If there is no open table and the semaphore is zero, that process must wait until it becomes available.




signal()is called when a process is done using a resource, or when the patron is finished with his meal.

What is an "atomic operation"?

An atomic operation is indivisible, that is, it can be considered to execute as a unit.

What is the main disadvantage of "busy waiting" with regard to semaphores?

Busy waiting means the process is continually running a loop to check the value of the semaphore. This is a waste of CPU cycles and is a big problem in multiprogramming systems (i.e. where CPU is shared among many processes)

What is an alternative approach to using "busy waiting" with semaphores?

Semaphores WITHOUT busy waiting. In this scheme, the waiting processes are kept in a list and "woken up" when the semaphore allows one to be executed. This is implemented by declaring the semaphore as a struct with two properties; its value, and a reference to a list of waiting processes.

What is "deadlock"?

Two or more processes are waiting indefinitely foran event that can be caused by only one of the waiting processes

What is "starvation"?

When process never gets a chance to run (i.e. it is never removed from the semaphore queue)

What is "Priority Inversion"?

When lower priority tasks obtain locks and causes lower priorities to execute before higher priority tasks.




See http://stackoverflow.com/a/28169447/1675976



How is "Priority Inversion" solved?

Using "Priority-Inheritance Protocol".




This protocol sets the priority of the current locking process (which could be lowest priority) to highest priority. This way, medium priority processes can't sneak in and start executing and invert the expected execuion order




See here http://stackoverflow.com/a/28169447/1675976


What does the term "preempt" mean, in respect to Computer Science?

In computing, preemption is the act of temporarily interrupting a task being carried out by a computer system, without requiring its cooperation, and with the intention of resuming the task at a later time. Such a change is known as a context switch. It is normally carried out by a privileged task or part of the system known as a preemptive scheduler, which has the power to preempt, or interrupt, and later resume, other tasks in the system.

In semaphores, what do wait() and signal() do?

wait() decrements the semaphore value and signal() increments it

What is a "monitor"?

A monitor is a more complex version of a semaphore. It is essentially a set of functions that enforces the rule that only one thread may be executing inside the monitor at one time.

What is a "condition variable" in monitors?



A condition variable indicates an event and has no value. More precisely, one cannot store a value into nor retrieve a value from a condition variable. If a thread must wait for an event to occur, that thread waits on the corresponding condition variable. If another thread causes an event to occur, that thread simply signals the corresponding condition variable. Thus, a condition variable has a queue for those threads that are waiting the corresponding event to occur to wait on, and, as a result, the original monitor is extended to the following.There are only two operations that can be applied to a condition variable: wait and signal.

What four conditions need to hold simultaneously for there to be "Deadlock"?

- Mutual Exclusion


- Hold and Wait


- No preemption


- Circular Wait

What are the three ways we can approach the problem of "deadlocks"?

- Ensure the system will never deadlock


- Allow system to enter deadlocked state and recover


- Ignore the problem (this is what Unix actually does)

What is the main problem with semaphores?

Bad code can be written that fails to match signals and waits properly. Mutexes should be used when they areall that's needed.

What is the difference between mutex and semaphore?

http://www.geeksforgeeks.org/mutex-vs-semaphore/

What are the two functions associated with condition variables in monitors?

For the condition variable x, calling x.wait() halts the process that called this function and it can only resume when x.signal() is called by another process.

How are Zombie processes created?

A parent process doesn't call wait() and the child dies