CH5 Parallel Processing
CH5 Parallel Processing
•
PARALLEL PROCESSING
Parallel processing refers to the simultaneous execution of
multiple tasks or instructions.
It involves breaking down a problem or task into smaller
subtasks that can be executed in parallel.
These subtasks are processed concurrently by multiple
processors or computing resources.
Advantage of parallel processing
•Increased performance: significantly speed up the execution of
large and complex tasks.
• Resource utilization: efficient utilization of computing resources
by distributing workloads.
• Scalability: enables systems to handle larger workloads and
scale with increasing demands.
• Real-time processing: it is crucial for applications that require
immediate responses, such as simulations and data analysis.
MULTIPLE PROCESSOR ORGANIZATION
• Single instruction, single data (SISD) stream
• Single processor executes a single instruction stream to
operate on data stored in a single memory
• Uniprocessors fall into this category
The processing unit operates on a single data stream (DS) from a
memory unit (MU).
CONT’D
• Single instruction, multiple data (SIMD) stream
• A single machine instruction controls the simultaneous execution of a number of
processing elements on a lockstep basis
• Vector and array processors fall into this category
There is still a single control unit, now feeding a single instruction stream to multiple
pus.
Each pu may have its own dedicated memory or there may be a shared memory
CONT’D
• Multiple Instruction, Single Data (MISD) Stream
• A Sequence Of Data Is Transmitted To A Set Of Processors,
Each Of Which Executes A Different Instruction Sequence
• Not Commercially Implemented
CONT’D
• Multiple instruction, multiple data (MIMD) stream
• A set of processors simultaneously execute different instruction
sequences on different data sets
• Smps, clusters and NUMA systems fit this category
There are multiple control units, each feeding a separate instruction
stream to its own PU.
Shared-memory multiprocessor or a distributed-memory
multicomputer
CONT’D
Multiprocessing Multiprogramming
The availability of more than one processor
A process of running multiple programs in
per system to execute multiple sets of
the system’s main memory simultaneously.
instructions simultaneously.
Job processing is less time taking. Job processing takes more time.
Faster job processing allows the
simultaneous execution of multiple Only one process can run at a time.
processes.
Multiprocessing uses multiple processors to Multiprogramming uses batch OS. During
do the job. execution, the CPU is fully utilized.
Requires more than one CPU. Requires only one CPU.
Multiprocessor Operating System Design
Considerations
Multiprocessor operating system must provide all the functionality of a
multiprogramming system plus additional features to accommodate multiple
processors. Among the key design issues:
• Simultaneous concurrent processes
• OS routines need to be reentrant to allow several processors to execute the
same IS code simultaneously
• OS tables and management structures must be managed properly to avoid
deadlock or invalid operations
• Scheduling
• Any processor may perform scheduling so conflicts must be avoided
• Scheduler must assign ready processes to available processors
CONT’D
Synchronization
With multiple active processes having potential access to shared address spaces
or I/O resources, care must be taken to provide effective synchronization
Synchronization is a facility that enforces mutual exclusion and event ordering
Memory management
OS needs to exploit the available hardware parallelism to achieve the best
performance
Paging mechanisms on different processors must be coordinated to enforce
consistency when several processors share a page or segment and to decide on
page replacement
Reliability and fault tolerance
OS should provide graceful degradation in the face of processor failure
Scheduler and other portions of the operating system must recognize the loss of
a processor and restructure accordingly
CACHE COHERENCE
• Cache coherence:
The uniformity of shared resource data that ends up stored
in multiple local caches
• Cache coherence problem:
It is challenge of keeping multiple local caches
synchronized when one of the processor updates its local
copy of data which is shared among multiple caches.
CACHE COHERENCE SOLUTION
• Software solutions
Attempt to avoid the need for additional hardware circuitry and
logic by relying on the compiler and operating system to deal
with the problem
Attractive because the overhead of detecting potential problems
is transferred from run time to compile time, and the design
complexity is transferred from hardware to software
However, compile-time software approaches generally must
make conservative decisions, leading to inefficient cache
utilization
CACHE COHERENCE SOLUTION(CONT’D)
• Hardware-based solution
Referred to as cache coherence protocols
Because the problem is only dealt with when it actually
arises there is more effective use of caches, leading to
improved performance over a software approach
Approaches are transparent to the programmer and the
compiler, reducing the software development burden
Can be divided into two categories:
Directory protocols
Snoopy protocols
THREADS AND PROCESSES
Thread is concerned with
scheduling and execution,
whereas a process is concerned
with both scheduling/execution
and resource and resource
ownership
Thread switch
• The act of switching Process:
processor control between • An instance of program
threads within the same running on computer
process • Two key characteristics:
• Typically less costly than • Resource ownership
process switch • Scheduling/execution
Thread:
Process switch
• Dispatchable unit of work
within a process • Operation that switches the
• Includes processor context processor from one process to
(which includes the program another by saving all the
counter and stack pointer) and process control data, registers,
data area for stack and other information for the
first and replacing them with
• Executes sequentially and is the process information for the
interruptible so that the second
processor can turn to another
thread
IMPLICIT AND EXPLICIT MULTITHREADING