QMCS 360
Class Notes # 11
Dr. Rick Smith
Quantitative Methods
and
Computer Science
Dr. Smith Home
|
Research
|
Classes
|
Blackboard
|
Cryptosmith
|
QMCS Home
|
UST A-Z
|
UST Home
last update:
Tuesday, October 18, 2005
Describe Quiz
Concurrency in our Favorite OSes (Sections 6.7-8-9-10)
Unix
Actually, System V, Release 4 (circa 1992)
IPC mechanisms
Pipes - we talked about these - a stream of data between processes
Named and unnamed pipes
Messages - more packet-like
Queued for the receiving process
Receiver can process them FIFO or by a sender-selected "type"
Shared Memory
All the obvious benefits and liabilities
Signals
Each signal is assigned a bit in the PCB - gets set when occurs
Process may establish a "signal handler" for each signal - it gets run when that signal occurs
Semaphores
An overdesigned service that provides every semaphore feature known to science, and a few never tried before
Linux
Includes SVR4 functions
Also...
Atomic operations
Establish a special "atomic" integer data type
Noninterruptable updates, also test-and-set
Requires that "atomic" operations are always used
Prevents accidental accesses by non-atomic operations
Can implement "real" shared variables
Can implement spinlocks
Bitmap updates
Implement noninterruptable bitmap update
Implement informal spinlocks on bitmap entries
True spinlocks
Various flavors depending on the "execution context"
Interrupts enabled, disabled, context saved, part of interrupt routine, etc.
Clearly for Kernel use only
Reader-Writer spinlocks - give many readers access to spinlock, but only one writer - it's more efficient that way
Semaphores
User-level = same as SVR4
Kernel-level are built-in to kernel and more efficient than user-level ones
Reader/writer semaphores, like the spinlocks
Barriers
Compiler-aware functions that prevent optimizations that reorder instructions.
Inserted in necessary places in device drivers, for example.
Solaris Thread Synchronization
Mutex Locks - some nonblocking
mutex-enter
mutex-exit
mutex-tryenter
Counting Semaphores - some nonblocking
sema-p = wait
sema-v = signal
sema-tryp = try it
Readers/Writer Lock = all potentially blocking
rw-enter
rw-exit
rw-downgrade
rw-tryupgrade
Condition Variable (like with monitors)
cv-wait
cv-signal
cv-broadcast
MS Windows
Object Oriented
Wait for object - includes a timeout
Synchronization objects - 4 explicit types to implement synchronization
Event - announces an event occurred
Mutex - acquire/release mutex in a thread
Semaphore - usual thing
Waitable timer - signals when done
Critical section objects
Similar to mutex objects, but only are visible to local threads
Faster, since no external context is required
Pluribus
Nonpreemptive
Spin locks
Deadlock and starvation detection