1/22
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Bounded-Buffer Problem
Readers and Writers Problem
Dining-Philosophers Problem
What are the classical problems of Synchronization
Bounded-Buffer Problem
n buffers, each can hold one item
Semaphore mutex initialized to the value 1
Semaphore full initialized to the value 0
Semaphore empty initialized to the value n
Readers
In Readers-Writers Problem they are the ones who only read the data set; they do not perform any updates
Writers
In Readers-Writers Problem they are the ones who can both read and write
Readers-Writers Problem
Problem – allow multiple readers to read at the same time
Only one single writer can access the shared data at the same time
“First reader-writer”
A situation where a writer process never writes.
Once a writer is ready to write, no “newly arrived reader” is allowed to read.
Starvation
Both the First reader-writer and Second reader-writer may result in
Readers-Writers Problem
Dining-Philosophers Problem
N philosophers’ sit at a round table with a bowl of rice in the middle.
They spend their lives alternating thinking and eating.
They do not interact with their neighbors.
Occasionally try to pick up 2 chopsticks (one at a time) to eat from bowl
Need both to eat, then release both when done
Kernel Synchronization - Windows uses _____ protect access to global resources on uniprocessor systems
spinlocks
Kernel Synchronization - Windows uses _____ on multiprocessor systems
dispatcher objects
Kernel Synchronization - Windows provides user land which may act mutexes, semaphores, events, and timers
Linux Synchronization
On single-CPU system, spinlocks replaced by enabling and disabling kernel preemption
True
True or False
Linux provides:
Semaphores
Atomic integers
Spinlocks
Reader-writer versions of both
POSIX Synchronization
Widely used on UNIX, Linux, and macOS
True
True or False:
POSIX API provides
mutex locks
semaphores
condition variable
True
True or False:
Java provides rich set of synchronization features:
Java monitors
Reentrant locks
Semaphores
Condition variables
Single lock
Every Java object has associated with it a?
Synchronized
If a method is declared as ___ a calling thread must own the lock for the object.
True
True or False
If the lock is owned by another thread, the calling thread must wait for the lock until it is released.
Functional programming languages
offer a different paradigm than procedural languages in that they do not maintain state.
Variables
treated as immutable and cannot change state once they have been assigned a value.