0% found this document useful (0 votes)
16 views

Lecture 03 - Multithreading

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Lecture 03 - Multithreading

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Parallel and distributed computing

MULTITHREADING, MULTITASKING,
MULTIPROCESSING, HYPERTHREADING
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 • Thread is a segment of


execution process
• Heavy weight • Light weight
• More time required for • Less time required for
context switching context switching
• Need more resources • Need less resources
• More time for creation • Less time for creation
• More time for termination • Less time for termination
PROCESS VS THREAD

• Process doesn’t share data • Threads share data with


with each other each other.
• System call is involved • No system call is involved
• Process is isolated • Threads share memory.
• Process has its own PCB, • Threads has its own TCB,
Stack and address space 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

You might also like