Concurrent Processes
Concurrent Processes
Understanding 1
Operating Systems
What is Parallel Processing?
Understanding 2
Operating Systems
Development of Parallel Processing
Understanding 3
Operating Systems
Typical Multiprocessing Configurations
• Master/slave
• Loosely coupled
• Symmetric
Understanding 4
Operating Systems
Master/Slave Multiprocessing
Configuration
• Asymmetric configuration.
• Single-processor system with
Slave
additional “slave” processors.
• Each slave, all files, all devices,
Main Master I/O
and memory managed by
Memory Processor Devices primary “master” processor.
• Master processor maintains
Slave
status of all processes in
system, performs storage
management activities,
schedules work for the other
processors, and executes all
control programs.
Understanding 5
Operating Systems
Pros & Cons of Master/Slaves
Understanding 7
Operating Systems
Loosely Coupled - 2
• To keep system well-balanced & ensure best use of
resources, job scheduling is based on several requirements
and policies.
– E.g., new jobs might be assigned to the processor with lightest
load or best combination of output devices available.
• Processor scheduling is
decentralized.
• A single copy of OS& a
global table listing each Processor 1
process and its status is Main I/O
stored in a common area Memory Processor 2
Devices
Understanding 10
Operating Systems
Process Synchronization Software
Understanding 11
Operating Systems
Synchronization Mechanisms
Understanding 12
Operating Systems
Lock-and-Key Synchronization
Understanding 14
Operating Systems
Problems with Test-And-Set
Understanding 15
Operating Systems
WAIT and SIGNAL Locking
• Modification of test-and-set.
Understanding 16
Operating Systems
WAIT
Understanding 17
Operating Systems
SIGNAL
Understanding 18
Operating Systems
Semaphores
Understanding 19
Operating Systems
P (Test) and V (Increment)
Understanding 21
Operating Systems
Process Cooperation
Understanding 22
Operating Systems
Producers and Consumers : One Process Produces
Some Data That Another Process Consumes Later.
Buffer
Producer Consumer
Buffer
Producer Consumer
Buffer
Producer Consumer
Understanding 23
Operating Systems
Producers and Consumers - 2
Understanding 24
Operating Systems
Definitions of Producer &
Consumer Processes
Producer Consumer
P (empty) P (mutex)
V (mutex) V (empty)
Understanding 25
Operating Systems
Definitions of Variables and Functions
Used in Producers and Consumers
Understanding 26
Operating Systems
Producers and Consumers Algorithm
empty:= n
full:= 0
mutex:= 1
COBEGIN
repeat until no more data PRODUCER
repeat until buffer is empty CONSUMER
COEND
Understanding 27
Operating Systems
Readers and Writers
Understanding 28
Operating Systems
Reader & Writer Solutions
Using P and V Operations
2. Give priority to the writers.
• In this case, as soon as a writer arrives, any readers that are
already active are allowed to finish processing, but all
additional readers are put on hold until the writer is done.
• Obviously this policy results in reader starvation if a
continuous stream of writers is present
Understanding 29
Operating Systems
State of System Summarized By 4 Counters
Understanding 32
Operating Systems
Ada
• multiprocessing
Ada
• busy waiting
mutex
• COBEGIN
P
• COENDprocessing
parallel
• concurrent
process synchronization
processing
• concurrentand
producers programming
consumers
• critical region
readers and writers
• embedded computer systems
semaphore
• explicit parallelism
symmetric configuration
• implicit parallelism
test-and-set
• loosely coupled configuration
V
• master/slave
WAIT and SIGNAL
configuration
34