SlideShare a Scribd company logo
Threads and Threads
session one
starting with a single core
copyright 2013 Robert Burrell Donkin robertburrelldonkin.name
this work is licensed under a Creative Commons Attribution 3.0 Unported License
Threads, Threads and Processes
from the
● hardware perspective
○ a thread is a serial code sequence
● software perspective
○ a thread abstracts a serial code sequence
● operating system perspective
○ a process abstracts an application instance
Multi-tasking a Single Core
● on a single core
○ a multitasking operating system
■ uses scheduling
■ to create the illusion of parallelism
● a software platform may also
○ use scheduling to create the illusion of parallelism
○ but then this is more often called multi-threading
Approaches to Multi-Tasking
● cooperative (or voluntary) multi-tasking
○ time-sharing
○ background processing
○ early Apple PCs
○ now rarely used
● pre-emptive multi-tasking
○ time-slicing
○ Windows 95 PCs
○ now almost universal
Why Multi-Task...?
● liveliness
● responsiveness
○ (to people)
● performance
○ (sometimes)
Context Switch
● a context switch
○ stores the current execute state, and
○ restores an execution state from storage
● from a CPU perspective
○ this is an expensive operation
● but is often cheap in comparison
Caches, Caches, Caches
● Moore's Law
○ the number of transistors doubles every 2 years
● but
○ diminishing returns from longer pipelines
○ popularity of multi-tasking
● so more and bigger caches
● so context switching cost now usually low
● but scales in a non-linear fashion
● excessive context switching expensive
Pre-emptive multi-tasking operating
systems use involuntary context
switching to provide the illusion of
parallel processes even when the
hardware supports only a single thread
of execution.
Take Away
Break Out
● Exercises
○ https://github.com/RobertBurrellDonkin/kata-manycore-
threadsandthreads
● Try
○ On Windows
■ perfmon
■ typeperf
○ On Linux
■ vmstat
■ iostat
■ mpstat

More Related Content

ODP
Linux logging
ODP
Multicore
PDF
Multithreaded processors ppt
PDF
What is simultaneous multithreading
PPTX
Multithreading computer architecture
PDF
Introduction to HSA
PDF
Glusterfs session #4 call frame and programming model
PPT
Hardware multithreading
Linux logging
Multicore
Multithreaded processors ppt
What is simultaneous multithreading
Multithreading computer architecture
Introduction to HSA
Glusterfs session #4 call frame and programming model
Hardware multithreading

What's hot (19)

PDF
Linux NUMA & Databases: Perils and Opportunities
PDF
Threads - Why Can't You Just Play Nicely With Your Memory_
PDF
Mosix Cluster
PPTX
Presentation on flynn’s classification
PPTX
Zk meetup talk
ODP
Event Driven with LibUV and ZeroMQ
PDF
Coal 16 mapping in Assembly Programming
PDF
Flynn taxonomies
PPTX
Flynn's classification
PDF
Aca2 07 new
PPTX
Modeling & design multi-core NUMA simulator
PPT
Lecture4
PPT
SUZETTE TEGA(CHS-EDP)
PDF
Userspace RCU library : what linear multiprocessor scalability means for your...
PDF
Resource Management with Systemd and cgroups
PPTX
Transaction Process System and Recovery
PDF
Aca2 01 new
Linux NUMA & Databases: Perils and Opportunities
Threads - Why Can't You Just Play Nicely With Your Memory_
Mosix Cluster
Presentation on flynn’s classification
Zk meetup talk
Event Driven with LibUV and ZeroMQ
Coal 16 mapping in Assembly Programming
Flynn taxonomies
Flynn's classification
Aca2 07 new
Modeling & design multi-core NUMA simulator
Lecture4
SUZETTE TEGA(CHS-EDP)
Userspace RCU library : what linear multiprocessor scalability means for your...
Resource Management with Systemd and cgroups
Transaction Process System and Recovery
Aca2 01 new
Ad

Viewers also liked (20)

PDF
A Java Fork_Join Framework
PDF
What Your Jvm Has Been Trying To Tell You
PPTX
Concurrency in java
PDF
Closures for Java
PDF
Thousands of Threads and Blocking I/O
PDF
Correct and efficient synchronization of java thread
PDF
Coordinating non blocking io melb-clj
PPTX
#JavaOne What's in an object?
PDF
Through the JMX Window
PDF
Reactive Principles and Microservices
PPT
Lecture on Java Concurrency Day 3 on Feb 11, 2009.
PPTX
IT MATCH: Vastgoedfinanciering voor zelfstandigen / freelancers in België
PDF
JVM Memory Management Details
ODP
Java Memory Consistency Model - concepts and context
PPT
Threads in Java
PPT
Bigtable
PDF
JAVA NIO
PPT
Tutorial4 Threads
PDF
Practiced agile developer with tdd & bdd
PPT
Multi-core architectures
A Java Fork_Join Framework
What Your Jvm Has Been Trying To Tell You
Concurrency in java
Closures for Java
Thousands of Threads and Blocking I/O
Correct and efficient synchronization of java thread
Coordinating non blocking io melb-clj
#JavaOne What's in an object?
Through the JMX Window
Reactive Principles and Microservices
Lecture on Java Concurrency Day 3 on Feb 11, 2009.
IT MATCH: Vastgoedfinanciering voor zelfstandigen / freelancers in België
JVM Memory Management Details
Java Memory Consistency Model - concepts and context
Threads in Java
Bigtable
JAVA NIO
Tutorial4 Threads
Practiced agile developer with tdd & bdd
Multi-core architectures
Ad

Similar to Many Cores Java - Session One: Threads and Threads (20)

PPTX
process and thread.pptx
PPTX
Topic 4- processes.pptx
PPTX
CS345 09 - Ch04 Threads operating system1.pptx
PPTX
PPT
Operating Systems - "Chapter 4: Multithreaded Programming"
PPTX
Threads in Operating System | Multithreading | Interprocess Communication
PPTX
1 Multithreading basics.pptx
PPT
Os4 2
PPTX
Operating Systems R20 Unit 2.pptx
PPTX
Lecture 3- Threads (1).pptx
PDF
CH04.pdf
PPTX
WEEK07operatingsystemdepartmentofsoftwareengineering.pptx
PDF
Threads lecture slides for operating systems
PPTX
Real Time Kernels and Operating Systems.pptx
PPTX
Chapter 4 - Operating Systems Threads.pptx
PDF
Ch4 threads
PDF
Process Control Block (PCB) print 4.pdf
PPT
Operating System 4
PPT
Operating System 4 1193308760782240 2
PPTX
Networking threads
process and thread.pptx
Topic 4- processes.pptx
CS345 09 - Ch04 Threads operating system1.pptx
Operating Systems - "Chapter 4: Multithreaded Programming"
Threads in Operating System | Multithreading | Interprocess Communication
1 Multithreading basics.pptx
Os4 2
Operating Systems R20 Unit 2.pptx
Lecture 3- Threads (1).pptx
CH04.pdf
WEEK07operatingsystemdepartmentofsoftwareengineering.pptx
Threads lecture slides for operating systems
Real Time Kernels and Operating Systems.pptx
Chapter 4 - Operating Systems Threads.pptx
Ch4 threads
Process Control Block (PCB) print 4.pdf
Operating System 4
Operating System 4 1193308760782240 2
Networking threads

More from Robert Burrell Donkin (12)

PDF
Threads and Threads
PDF
If the Data Cannot Come To The Algorithm...
PDF
An End to Order
PDF
If the data cannot come to the algorithm...
PDF
Threads - Why Can't You Just Play Nicely With Your Memory?
PDF
An End to Order (many cores with java, session two)
PDF
Apache Maven In 10 Slides
PDF
XP In 10 slides
ODP
Public Sector: Agile and Open Source
ODP
An Agile Pick-N-Mix
PDF
The Pomodoro Technique: Introduced Unofficially In 10 Slides
PDF
Retrospectives In 10 Slides (With Notes)
Threads and Threads
If the Data Cannot Come To The Algorithm...
An End to Order
If the data cannot come to the algorithm...
Threads - Why Can't You Just Play Nicely With Your Memory?
An End to Order (many cores with java, session two)
Apache Maven In 10 Slides
XP In 10 slides
Public Sector: Agile and Open Source
An Agile Pick-N-Mix
The Pomodoro Technique: Introduced Unofficially In 10 Slides
Retrospectives In 10 Slides (With Notes)

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
KodekX | Application Modernization Development
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Approach and Philosophy of On baking technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Spectroscopy.pptx food analysis technology
PDF
NewMind AI Weekly Chronicles - August'25 Week I
Encapsulation theory and applications.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Programs and apps: productivity, graphics, security and other tools
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
KodekX | Application Modernization Development
The Rise and Fall of 3GPP – Time for a Sabbatical?
Network Security Unit 5.pdf for BCA BBA.
Per capita expenditure prediction using model stacking based on satellite ima...
Machine learning based COVID-19 study performance prediction
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Review of recent advances in non-invasive hemoglobin estimation
Approach and Philosophy of On baking technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
MYSQL Presentation for SQL database connectivity
Spectroscopy.pptx food analysis technology
NewMind AI Weekly Chronicles - August'25 Week I

Many Cores Java - Session One: Threads and Threads

  • 1. Threads and Threads session one starting with a single core copyright 2013 Robert Burrell Donkin robertburrelldonkin.name this work is licensed under a Creative Commons Attribution 3.0 Unported License
  • 2. Threads, Threads and Processes from the ● hardware perspective ○ a thread is a serial code sequence ● software perspective ○ a thread abstracts a serial code sequence ● operating system perspective ○ a process abstracts an application instance
  • 3. Multi-tasking a Single Core ● on a single core ○ a multitasking operating system ■ uses scheduling ■ to create the illusion of parallelism ● a software platform may also ○ use scheduling to create the illusion of parallelism ○ but then this is more often called multi-threading
  • 4. Approaches to Multi-Tasking ● cooperative (or voluntary) multi-tasking ○ time-sharing ○ background processing ○ early Apple PCs ○ now rarely used ● pre-emptive multi-tasking ○ time-slicing ○ Windows 95 PCs ○ now almost universal
  • 5. Why Multi-Task...? ● liveliness ● responsiveness ○ (to people) ● performance ○ (sometimes)
  • 6. Context Switch ● a context switch ○ stores the current execute state, and ○ restores an execution state from storage ● from a CPU perspective ○ this is an expensive operation ● but is often cheap in comparison
  • 7. Caches, Caches, Caches ● Moore's Law ○ the number of transistors doubles every 2 years ● but ○ diminishing returns from longer pipelines ○ popularity of multi-tasking ● so more and bigger caches ● so context switching cost now usually low ● but scales in a non-linear fashion ● excessive context switching expensive
  • 8. Pre-emptive multi-tasking operating systems use involuntary context switching to provide the illusion of parallel processes even when the hardware supports only a single thread of execution. Take Away
  • 9. Break Out ● Exercises ○ https://github.com/RobertBurrellDonkin/kata-manycore- threadsandthreads ● Try ○ On Windows ■ perfmon ■ typeperf ○ On Linux ■ vmstat ■ iostat ■ mpstat