Operating Systems Ch. 6

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Spinlock

A type of semaphore that relies on busy waiting. It's called a spinlock because the process "spins" while waiting for the lock, or the flag, to open. If the critical section is short and you have multiple processors it may be useful.

Condition variable

A variable that helps to tailor-make synchronization.

Progress

If no process is executing in its critical section and some processes wish to enter their critical sections, then only those processes that are not executing in their remainder sections can participate in deciding which will enter its critical section next, and this selection cannot be postponed indefinitely.

Mutual exclusion

If process P is executing in its critical section, then no other processes can be executing in their critical sections.

Readers-writers problem

Imagine a database shared among several processes. If multiple readers read the database there is no problem, but if two writers or a writer and a reader try and access it at the same time, big problems can occur. To combat this problem, the writers have exclusive access to the shared database while writing to the database.

Race condition

When several processes (threads) access and manipulate the same data concurrently and the outcome of the execution depends on the particular order in which the access takes place, is called a race condition

Process synchronization

When several threads are running in parallel, we do not want any changes that result in such activities to interfere with each other. (Think about the counter++ and counter-- example that Dr. Sturgill showed us in class and how the result was wrong. )

Deadlock

When two processes are in the waiting queue waiting for an event that only can be caused by the other waiting process. So neither can ever leave.

Peterson's solution

a classic software-based solution to the critical-section problem. There are no guarantees that Peterson's solution will work correctly on modern architecture. Peterson's solution is restricted to two processes that alternate execution between their critical sections and remainder sections. They share: int turn; boolean flag[2];

Cooperating processes

(I added because it's relevant to the entire chapter ) A cooperating process is one that can affect or be affected by other processes executing in the system. Cooperating processes can either directly share a logical address space (that is, both code and data) or be allowed to share data only through files or messages.

Priority inversion

A scheduling challenge arises when a higher-priority process needs to read or modify kernel data that are currently being accessed by a lower-priority process-or a chain of lower-priority processes. Since kernel data are typically protected with a lock, the higher-priority process will have to wait for a lower-priority one to finish with the resource and these lower priority tasks can get preempted by medium priority tasks, causing starvation for the high priority task.

Semaphore

A synchronization tool used to overcome the critical section problem.

Busy waiting

Continually checking a flag variable over and over while not progressing and using the CPU.

Critical section

Each process has a segment of code, the critical section, in which the process may be changing common variables, updating a common table, writing a file and so on. A solution to the critical section problem must satisfy Mutual exclusion, progress, and bounded waiting.

Starvation

Indefinite blocking, where the process doesn't get CPU time.

Atomic

Many modern computer systems therefore provide special hardware instructions that allow us either to test and modify the content of a word or to swap the contents of two words atomically, or as one uninterruptible unit.

Monitor

Monitors are abstract data types that provide fundamental high-level synchronization construct. They are needed because of errors that can be generated using semaphores. The monitor construct ensures that only one process at a time is active within the monitor.

Critical section problem

The critical-section problem is to design a protocol that the processes can use to cooperate. Each process must request permission to enter its critical section.

Dining philosophers problem

Page 243. It has a very long description. The dining-philosophers problem is considered a classic synchronization problem neither because of its practical importance nor because computer scientists dislike philosophers but because it is an example of a large class of concurrency-control problems.

Semaphore signal/release operation

Signal() is the same as release() and increments the semaphore, signaling that another process can enter a critical section.

Swap operation

The Swap() instruction, in contrast to the TestAndSet () instruction, operates on the contents of two words; it is defined as shown in Figure 6.6. Like the TestAndSet () instruction, it is executed atomically. If the machine supports the Swap() instruction, then mutual exclusion can be provided as follows. A global Boolean variable lock is declared and is initialized to false. In addition, each process has a local Boolean variable key. Does not satisfy bounded waiting.

TestAndSet operation

The TestAndSet () instruction can be defined as shown in Figure 6.4. The important characteristic of this instruction is that it is executed atomically. Thus, if two TestAndSet () instructions are executed simultaneously (each on a different CPU), they will be executed sequentially in some arbitrary order. Does not satisfy bounded waiting.

Binary semaphore

The value of a binary semaphore can only range between 0 and 1.

Counting semaphore

The value of a counting semaphore can range over an unrestricted domain. Strictly positive numbers indicate the critical section can be entered.

Bounded waiting

There exists a bound, or limit, on the number of times that other processes are allowed to enter their critical sections after a process has made a request to enter its critical section and before that request is granted.

Semaphore wait/acquire operation

They are both atomic operations. wait() is the same as the acquire() operation and decrements the semaphore.

Priority inheritance

This fixes the priority inversion problem. According to this protocol, all processes that are accessing resources needed by a higher-priority process inherit the higher priority until they are finished with the resources in question. When they are finished, their priorities revert to their original values.

Condition variable signal operation

Used in conjunction with the wait command, the signal operation resumes exactly one suspended process.

Condition variable wait operation

Used with condition variable. Declared like this condition x; x.wait() This means the process invoking this operation is suspended until after another process invokes: x.signal()


संबंधित स्टडी सेट्स

C++ Chapter 5 Repetition Structures

View Set

Gross and Net income Quick Check

View Set

A& P II continuous exam questions

View Set

Basic incident command system for initial response.

View Set