Chapter 7 - Process Synchronization
A monitor is a module that encapsulates
- shared data structures - procedures that operate on shared data structure - synchronization between concurrent procedure invocation
A binary semaphore is a semaphore with integer values :
0, 1
The dining - philosophers problem will occur in case of :
5 philosophers and 5 chopsticks
Transaction
A collection of instructions (or operations) that perform a single logical function.
Which of the following statements describes properties achieved ?
Both mutual exclusion and progress
Spinlocks are intended to provide __________ only.
Bounded Waiting
What will happen if a non-recursive mutex is locked more than once ?
Deadlock Explanation: If a thread which had already locked a mutex, tries to lock the mutex again, it will enter into the waiting list of that mutex, which results in deadlock. It is because no other thread can unlock the mutex.
Nonvolatile storage
Information residing in nonvolatile storage usually survives system crashes. Examples: disk and magnetic tapes Disks are more reliable than main memory, but less reliable than magnetic tapes. nonvolatile is slower then volatile storage because require physical motion (electromagnetically) to access data.
stable storage
Information residing in stable storage is never lost theoretically. To implement an approx need to replicate information in several nonvolatile storage caches (disks) with independent failure modes to update info in a controlled manner. (RAID)
Volatile storage
Information residing in volatile storage does not usually survive system crashes. Examples: are main and cache memory. Access to volatile storage is fast because of the speed of the memory and able to access directly.
The following three conditions must be satisfied to solve the critical section problem:
Mutual Exclusion Progress Bounded Waiting
The bounded buffer problem is also known as :
Producer - Consumer problem
transaction has been - rolled back:
The state of the data accessed by an aborted transaction must be restored to what it was just before the transaction started executing.
To enable a process to wait within the monitor,
a condition variable must be declared as condition
Suppose a process executes in the following manner (replacing signal with wait) :
a deadlock will occur
Spinlocks are :
a) CPU cycles wasting locks over critical sections of programs b) locks that avoid time wastage in context switches c) locks that work better on multiprocessor systems All of these
A transaction is a program unit that
accesses and possibly updates various data items that may reside on the disk within some files.
Bounded waiting implies that there exists a bound on the number of times a process is allowed to enter its critical section :
after a process has made a request to enter its critical section and before the request is granted
Databases
are concerned with the storage and retrieval of data and with the consistency of the data
An un-interruptible unit is known as :
atomic
The TestAndSet instruction is executed :
atomically
The two kinds of semaphores are :
binary counting
The wait operation of the semaphore basically works on the basic _______ system call.
block ( )
A semaphore :
can be accessed from multiple processes
A terminated transaction that has completed its execution successfully is
committed; otherwise it is aborted. The effect of a committed transaction cannot be undone by abortion of the transaction.
Which process can be affected by other processes executing in the system?
cooperating process
In the bounded buffer problem, there are the empty and full semaphores that :
count the number of empty and full buffers
The segment of code in which the process may change common variables, update tables, write into files is known as:
critical section
The code that changes the value of the semaphore is :
critical section code
Concurrent access to shared data may result in :
data inconsistency
A deadlock free solution to the dining philosophers problem :
does not necessarily eliminate the possibility of starvation
Process synchronization can be done on
hardware level & software level
Mutual exclusion implies that :
if a process is executing in its critical section, then no other process must be executing in their critical sections
Semaphore is a/an _______ to solve the critical section problem.
integer variable
What is a transaction?
is a sequence of read and write operations, terminated by either a commit operation or an abort operation.
If the semaphore value is negative :
its magnitude is the number of processes waiting on that semaphore
A mutex :
must be accessed from only one process
Mutual exclusion can be provided by the:
mutex locks binary semaphores Explanation: Binary Semaphores are known as mutex locks.
If a process is executing in its critical section, then no other processes can be executing in their critical section. This condition is called
mutual exclusion
A situation where several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular order in which access takes place is called :
race condition
When several processes access the same data concurrently and the outcome of the execution depends on the particular order in which the access takes place, is called
race condition
Which one of the following is a synchronization tool?
semaphore
A problem encountered in multitasking when a process is perpetually denied necessary resources is called
starvation
A semaphore is a shared integer variable
that can not drop below zero
A semaphore is shared integer variable:
that can not drop below zero
In the bounded buffer problem :
there are n buffers ( n being greater than one but finite)
To avoid deadlock
there must be a fixed number of resources to allocate
The main disadvantage of spinlocks is that :
they require busy waiting
A minimum of _____ variable(s) is/are required to be shared between processes to solve the critical section problem.
two
The two atomic operations permissible on semaphores are :
wait ( ) signal ( )
The signal operation of the semaphore basically works on the basic _______ system call.
wakeup ( )
To ensure difficulties do not arise in the readers - writers problem, _______ are given exclusive access to the shared object.
writers