Chapter 8 Concurrency-P1
Chapter 8 Concurrency-P1
Chapter 8 Concurrency-P1
Operating
Systems: Mutual Exclusion
Internals
and
and
Design Synchronization
Principles
Seventh Edition
By William
Stallings
Operating System design is concerned
with the management of processes
and threads:
Multiprogramming
Multiprocessing
Distributed Processing
• Multiprogramming:
The management of multiple processes
within a uniprocessor system
• Multiprocessing :
The management of multiple processes
within a multiprocessor
• Distributed processing:
The management of multiple processes
executing on multiple, distributed computer
systems.
Concurrency encompasses a host of
design issues, including communication
among processes, sharing of and competing
for resources (such as memory, files, and I/O
access), synchronization of the activities of
multiple processes, and allocation of processor
time to processes.
There is no way to
There is no way to know which process You don’t know
know before a will continue whether another
process decrements immediately on a process is waiting so
a semaphore uniprocessor system the number of
whether it will when two unblocked processes
block or not processes are may be zero or one
running
concurrently
Semaphore Primiti ves
Binary SemaphorePrimitives
A queue is used to hold processes waiting on the
semaphore
Strong Semaphores
• the process that has been blocked the longest
is released from the queue first (FIFO)
Weak Semaphores
• the order in which processes are removed from
the queue is not specified
Here processes A, B, and C depend on
a result from process D.
Initially (1), A is running; B, C, and D are
ready; and the semaphore count is 1,
indicating that one of D’s results is
available.
When A issues a semWait instruction on
semaphore s , the semaphore decrements to
0, and A can continue to execute;
subsequently it rejoins the ready queue.