Parallel and distributed
computing
MULTITHREADING, MULTITASKING, MULTIPROCESSING
PROCESS AND THREAD
Process: a program in execution is called process.
Thread: is the segment of process means a process can
have multiple threads and these threads are contained
within a process.
User level vs kernel level thread
User level thread: executes in user space code and can
call kernel space. If user thread need some thing, it will
call into kernel
Kernel level thread: executes only kernel code and isn’t
associated with a user space process.
PROCESS VS THREAD
• Process is program under
execution
• Heave weight
• More time required for
context switching
• Need more resources
• More time for creation
• More time for termination
• Thread is a segment of
process
• Light weight
• Less time required for context
switching
• Need less resources
• Less time for creation
• Less time for termination
PROCESS VS THREAD
• Process doesn’t share data
with each other
• System call is involved
• Process is isolated
• Process has its own PCB, Stack
and address space
• Threads share data with each
other.
• No system call is involved
• Threads share memory.
• Threads has its own TCB, Stack
and Address space.
Process and Thread, EXAMPLE
In a word processor, a thread may check spelling and
grammar while another process user input while yet another
third thread loads images from the hard drive and fourth
does periodic automatic backups of the file being edited.
Multitasking vs multithreading
Multitasking allow to run more process concurrently
While, multithreading allows single process to perform
multiple tasks in a single process
Both were introduced to improve performance and
responsiveness of computing system.
MULTITHREADED PROGRAMMING
Concurrent execution of threads, these threads could run on
single processor.
Is the ability of single CPU to provide multiple threads of
execution concurrently, supported by operating system
Its aims to increase utilization of single core by using thread
level parallelism.
It allows multiple request to be satisfied simultaneously with
having to service requests sequentially.
MULTITHREADED PROGRAMMING - ADVANTAGES
Responsiveness: if one thread complete its execution, then
its output can be immediately returned.
Faster context switching: context switch time is lower,
process context switching requires more overhead from the
CPU.
Effective utilization of multiprocessor: Use of multiple
threads in a single process make process execution faster.
Similarly multiple threads can scheduled on multi processors
MULTITHREADED PROGRAMMING - advantages
Resource Sharing: resources like code, date, files can be
shared among all threads within process. Stack and registers
can’t be shared among threads
Communication: communication between multiple thread is
faster.
Increase throughput of the system: each thread’s function is
considered as one job. Then number of jobs completed per
unit time is increased.
Scaler processors
• a processors that process only one data item at a
time i.e. SISD Processor
• While, Vector processor is a single instruction
operates simultaneously on multiple items i.e. SIMD
Super scaler processors
Executes more than one instruction during a clock
cycle by simultaneously, dispatching multiple
instructions on different functional units on the
processors.
Remember, Processors is single but one CPU has
different functional units. Such as ALU, Bit shifter
or a multiplier
Super scaler processors
It therefore allows more throughput, i.e. the
number of instructions can be executed per unit
time
Intel hyper threading
Uses processor resources more efficiently,
enabling multiple threads to run on each core.
which increases processor throughput, improving
overall performance
Latest (HTT) HT Technology are
•Intel® Core™ Processor Family
•Intel® Core™ vPro ™ Processor Family
•Intel® Core™ M Processor Family
•Intel® Xeon R Processor Family
Intel hyper threading
Main function of hyper-threading is to
increase the number of independent
instructions in the pipeline,
It takes advantages of superscalar architecture
in which multiple instructions operate on
separate data in parallel
HTT: ADVANTAGES /DISADVANTAGES
Advantages:
•make the best use of each CPU Core.
•Allow running more background data without
interruption
•Multithreading enables design and development of
smaller chips by eliminating the need for more cores
HTT: ADVANTAGES /DISADVANTAGES
Disadvantages:
Technically, doesn’t double the performance but
maximize its performance.
Some software doesn’t support multithreading, so
software implementation is required.
Generate more heat, to avoid performance
degradation and overheating, cooling system must be
implemented

Parallel and Distributed Computing chapter 3

  • 1.
  • 2.
    PROCESS AND THREAD Process:a program in execution is called process. Thread: is the segment of process means a process can have multiple threads and these threads are contained within a process.
  • 3.
    User level vskernel level thread User level thread: executes in user space code and can call kernel space. If user thread need some thing, it will call into kernel Kernel level thread: executes only kernel code and isn’t associated with a user space process.
  • 4.
    PROCESS VS THREAD •Process is program under execution • Heave weight • More time required for context switching • Need more resources • More time for creation • More time for termination • Thread is a segment of process • Light weight • Less time required for context switching • Need less resources • Less time for creation • Less time for termination
  • 5.
    PROCESS VS THREAD •Process doesn’t share data with each other • System call is involved • Process is isolated • Process has its own PCB, Stack and address space • Threads share data with each other. • No system call is involved • Threads share memory. • Threads has its own TCB, Stack and Address space.
  • 7.
    Process and Thread,EXAMPLE In a word processor, a thread may check spelling and grammar while another process user input while yet another third thread loads images from the hard drive and fourth does periodic automatic backups of the file being edited.
  • 9.
    Multitasking vs multithreading Multitaskingallow to run more process concurrently While, multithreading allows single process to perform multiple tasks in a single process Both were introduced to improve performance and responsiveness of computing system.
  • 10.
    MULTITHREADED PROGRAMMING Concurrent executionof threads, these threads could run on single processor. Is the ability of single CPU to provide multiple threads of execution concurrently, supported by operating system Its aims to increase utilization of single core by using thread level parallelism. It allows multiple request to be satisfied simultaneously with having to service requests sequentially.
  • 11.
    MULTITHREADED PROGRAMMING -ADVANTAGES Responsiveness: if one thread complete its execution, then its output can be immediately returned. Faster context switching: context switch time is lower, process context switching requires more overhead from the CPU. Effective utilization of multiprocessor: Use of multiple threads in a single process make process execution faster. Similarly multiple threads can scheduled on multi processors
  • 12.
    MULTITHREADED PROGRAMMING -advantages Resource Sharing: resources like code, date, files can be shared among all threads within process. Stack and registers can’t be shared among threads Communication: communication between multiple thread is faster. Increase throughput of the system: each thread’s function is considered as one job. Then number of jobs completed per unit time is increased.
  • 14.
    Scaler processors • aprocessors that process only one data item at a time i.e. SISD Processor • While, Vector processor is a single instruction operates simultaneously on multiple items i.e. SIMD
  • 15.
    Super scaler processors Executesmore than one instruction during a clock cycle by simultaneously, dispatching multiple instructions on different functional units on the processors. Remember, Processors is single but one CPU has different functional units. Such as ALU, Bit shifter or a multiplier
  • 16.
    Super scaler processors Ittherefore allows more throughput, i.e. the number of instructions can be executed per unit time
  • 18.
    Intel hyper threading Usesprocessor resources more efficiently, enabling multiple threads to run on each core. which increases processor throughput, improving overall performance Latest (HTT) HT Technology are •Intel® Core™ Processor Family •Intel® Core™ vPro ™ Processor Family •Intel® Core™ M Processor Family •Intel® Xeon R Processor Family
  • 19.
    Intel hyper threading Mainfunction of hyper-threading is to increase the number of independent instructions in the pipeline, It takes advantages of superscalar architecture in which multiple instructions operate on separate data in parallel
  • 21.
    HTT: ADVANTAGES /DISADVANTAGES Advantages: •makethe best use of each CPU Core. •Allow running more background data without interruption •Multithreading enables design and development of smaller chips by eliminating the need for more cores
  • 22.
    HTT: ADVANTAGES /DISADVANTAGES Disadvantages: Technically,doesn’t double the performance but maximize its performance. Some software doesn’t support multithreading, so software implementation is required. Generate more heat, to avoid performance degradation and overheating, cooling system must be implemented