SlideShare a Scribd company logo
GildaVM:
a Non-Blocking I/O Architecture for the Cog VM
Pablo Tesone
Pharo Consortium
1
Guille Polito
CNRS UMR9189

CRIStAL, Inria

RMoD
Eliot Miranda
Stellect Systems Inc
David Simmons
The Light Phone, USA
Blocking I/O
!2
• I/O execution blocks the interpreter

• While in a I/O call the interpreter is blocked

• E.g., System-calls, FFI
FFI? Foreign Function Interface
Image
VM
External Libraries
FFI
We can communicate with anything that
has a C API
Operating System API
!3
Unified FFI in a nutshell
UFFI handles:
- Look-up of functions
- Marshalling of arguments
- Execution
- Marshalling of the return values
!4
Concurrency in Pharo
!5
P1 P2 P3
Interpreter
Thread
p1
p3
p1
p2
p2
Concurrency in Pharo
!6
P1 P2 P3
Interpreter
Thread
p1
p3
p1
p2
p2
Interpreter
handles
process
scheduling
Concurrency in Pharo
!7
P1 P2 P3
Interpreter
Thread
p1
p3
p1
p2
p2
p1
int function(char* foo, int bar)
Concurrency in Pharo
!8
P1 P2 P3
Interpreter
Thread
p1
p3
p1
p2
p2
p1
Out
of
Interpreter
Interpreter
loses
control
int function(char* foo, int bar)
What we want!
int function(char* foo, int bar)
!9
P1 P2
Interpreter
#1
Interpreter
#2
What we want!
int function(char* foo, int bar)
!10
P1 P2
Interpreter
#1
Interpreter
#2
• Requires extensive modification of VM,
Plugins and Image core libraries
• Applications should be written with threading
in mind
• Real multithreading not only for FFI
Proposal: Global Interpreter Lock VM
int function(char* foo, int bar)
P1 P2
Interpreter
#1
Interpreter
#2
!11
Research Questions
• RQ1: How does scheduling work in presence of
processes and native threads?

• RQ2: What is the overhead of thread switching?
!12
Process scheduling with
many VM threads
!13
P1 P2 P3 VM Thread #1
p1
p1
p2
VM Thread #2
p3
p2
One VM Thread owns the VM at each time
Process Affinity
!14
p3 bindToThreadId: 2
• Explicit binding

• When a process is activated, it is
run in the affined thread

• Or in the same thread if not affined
VM Thread #1
p1
p1
p2
VM Thread #2
p3
p2
Disown VM
Own VM
Non-blocking FFI
!15
• Before FFI calls the current
thread disowns the VM

• Another thread owns the VM

• Non-blocked processes are
scheduled
VM Thread #1
p1
p1
p2
VM Thread #2
p2
Disown VM
Own VM
Short

callouts?
!16
• If naive, each disown creates a
lot of overhead!
VM Thread #1
p1
p1
p2
VM Thread #2
p2
Disown VM
Own VM
Own VM
Disown VM
p1
p2
Disown VM
Own VM
Own VM
Disown VM
sleep
verify
VM Thread #1
p1
p1
p2
VM Thread #2
Disown VM
verify
Watchdog
sleep
Own VM
verify
sleep
vm thread can continue!
p1
Watchdog Native Thread
!17
• A watchdog periodically
verifies if the VM is busy

• If idle, selects a thread with
work to do and activate it
sleep
verify
VM Thread #1
p1
p1
p2
VM Thread #2
Disown VM
verify
Watchdog
sleep
Own VM
verify
sleep
vm thread can continue!
p1
Short calls
!18
• The watchdog sleeping
window defines the
“length” of the short call
sleep
verify
VM Thread #1
p1
p1
p2
VM Thread #2
Disown VM
verify
Watchdog
sleep
verify
sleep
Own VM
p2
Long call preemption
!19
• The watchdog sleeping window
also defines the max “length” of
idle-ness
Process switch

without affinity
50 iterations, mean showed
!20
Long I/Os
sequencial
concurrent processes
2 one-sec callouts
50 iterations, mean showed
!21
Short calls
sequencial
concurrent processes
100,000 short callouts
50 iterations, mean showed
!22
• Callbacks

• Reentrant callbacks

•
• More on preemption

• Implementation details

•
Also in the paper…
!23
sleep
verify
VM Thread #1
p1
p1
p2
VM Thread #2
Disown VM
verify
Watchdog
sleep
Own VM
verify
sleep
vm thread can continue!
p1
Future Work #1:
watchdog impact
• If the watchdog window
is not aligned with the
FFI calls, short callouts
are recognised as long
ones (false positives)

• Long watchdog window
will recognise long calls
as short calls and be
blocking (false negatives)
!24
Future Work #2:

thread management
• Should VM threads be created implicitly or explicitly?

• Should the thread pool be size-bound? Analyse strategies
for particular applications.
!25
Conclusion
• A Global interpreter lock architecture for green-threaded
smalltalk implementations

• Good for parallelising long blocking I/O

• Some strategies to reduce the overhead of thread switch
Pablo Tesone
Pharo Consortium
Guille Polito
CNRS UMR9189

CRIStAL, Inria

RMoD
Eliot Miranda
Stellect Systems Inc
David Simmons
The Light Phone, USA

More Related Content

PDF
#PDR15 - Voice API
PDF
FFR GreenKiller - Automatic kernel-mode malware analysis system
PDF
Looking under the covers: Using SNMP to peek inside Erlang
PDF
Enhance Virtualization Stack with Intel CET and MPX
PDF
Non-Blocking Strategies for FFI
PDF
Here comes the Loom - Ya!vaConf.pdf
PDF
shashank_micro92_00697015
PPT
Threads Advance in System Administration with Linux
#PDR15 - Voice API
FFR GreenKiller - Automatic kernel-mode malware analysis system
Looking under the covers: Using SNMP to peek inside Erlang
Enhance Virtualization Stack with Intel CET and MPX
Non-Blocking Strategies for FFI
Here comes the Loom - Ya!vaConf.pdf
shashank_micro92_00697015
Threads Advance in System Administration with Linux

Similar to GildaVM: a Non-Blocking I/O Architecture for the Cog VM (20)

PPTX
CS345 09 - Ch04 Threads operating system1.pptx
PDF
Ch3 processes
PPTX
Threading.pptx
PPTX
distributed-systemsfghjjjijoijioj-chap3.pptx
PPTX
Processes
PPTX
Operating Systems R20 Unit 2.pptx
PDF
threads (1).pdfmjlkjfwjgliwiufuaiusyroayr
PDF
Operating Systems 1 (8/12) - Concurrency
TXT
Socket related concepts
PDF
CS6401 OPERATING SYSTEMS Unit 2
PDF
Multithreaded Programming Part- III.pdf
PDF
A first look into the Project Loom in Java
PDF
Distributed computing
PDF
CH03.pdf
PPTX
Operating system 18 process creation and termination
PDF
Project02 wit
PPTX
UNIT II DIS.pptx
PDF
PROCESS WARP
PPT
Os4 2
CS345 09 - Ch04 Threads operating system1.pptx
Ch3 processes
Threading.pptx
distributed-systemsfghjjjijoijioj-chap3.pptx
Processes
Operating Systems R20 Unit 2.pptx
threads (1).pdfmjlkjfwjgliwiufuaiusyroayr
Operating Systems 1 (8/12) - Concurrency
Socket related concepts
CS6401 OPERATING SYSTEMS Unit 2
Multithreaded Programming Part- III.pdf
A first look into the Project Loom in Java
Distributed computing
CH03.pdf
Operating system 18 process creation and termination
Project02 wit
UNIT II DIS.pptx
PROCESS WARP
Os4 2
Ad

More from ESUG (20)

PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
PDF
Micromaid: A simple Mermaid-like chart generator for Pharo
PDF
Directing Generative AI for Pharo Documentation
PDF
Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuris...
PDF
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
PDF
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
PDF
Analysing Python Machine Learning Notebooks with Moose
PDF
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
PDF
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
PDF
Package-Aware Approach for Repository-Level Code Completion in Pharo
PDF
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
PDF
An Analysis of Inline Method Refactoring
PDF
Identification of unnecessary object allocations using static escape analysis
PDF
Control flow-sensitive optimizations In the Druid Meta-Compiler
PDF
Clean Blocks (IWST 2025, Gdansk, Poland)
PDF
Encoding for Objects Matters (IWST 2025)
PDF
Challenges of Transpiling Smalltalk to JavaScript
PDF
Immersive experiences: what Pharo users do!
PDF
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
PDF
Cavrois - an Organic Window Management (ESUG 2025)
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
Micromaid: A simple Mermaid-like chart generator for Pharo
Directing Generative AI for Pharo Documentation
Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuris...
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
Analysing Python Machine Learning Notebooks with Moose
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
Package-Aware Approach for Repository-Level Code Completion in Pharo
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
An Analysis of Inline Method Refactoring
Identification of unnecessary object allocations using static escape analysis
Control flow-sensitive optimizations In the Druid Meta-Compiler
Clean Blocks (IWST 2025, Gdansk, Poland)
Encoding for Objects Matters (IWST 2025)
Challenges of Transpiling Smalltalk to JavaScript
Immersive experiences: what Pharo users do!
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
Cavrois - an Organic Window Management (ESUG 2025)
Ad

Recently uploaded (20)

PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
medical staffing services at VALiNTRY
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
L1 - Introduction to python Backend.pptx
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Transform Your Business with a Software ERP System
PDF
System and Network Administraation Chapter 3
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Essential Infomation Tech presentation.pptx
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Internet Downloader Manager (IDM) Crack 6.42 Build 41
medical staffing services at VALiNTRY
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
How to Migrate SBCGlobal Email to Yahoo Easily
Upgrade and Innovation Strategies for SAP ERP Customers
L1 - Introduction to python Backend.pptx
How Creative Agencies Leverage Project Management Software.pdf
Transform Your Business with a Software ERP System
System and Network Administraation Chapter 3
Navsoft: AI-Powered Business Solutions & Custom Software Development
PTS Company Brochure 2025 (1).pdf.......
2025 Textile ERP Trends: SAP, Odoo & Oracle
Essential Infomation Tech presentation.pptx
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Design an Analysis of Algorithms II-SECS-1021-03
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
wealthsignaloriginal-com-DS-text-... (1).pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Adobe Illustrator 28.6 Crack My Vision of Vector Design

GildaVM: a Non-Blocking I/O Architecture for the Cog VM

  • 1. GildaVM: a Non-Blocking I/O Architecture for the Cog VM Pablo Tesone Pharo Consortium 1 Guille Polito CNRS UMR9189 CRIStAL, Inria RMoD Eliot Miranda Stellect Systems Inc David Simmons The Light Phone, USA
  • 2. Blocking I/O !2 • I/O execution blocks the interpreter • While in a I/O call the interpreter is blocked • E.g., System-calls, FFI
  • 3. FFI? Foreign Function Interface Image VM External Libraries FFI We can communicate with anything that has a C API Operating System API !3
  • 4. Unified FFI in a nutshell UFFI handles: - Look-up of functions - Marshalling of arguments - Execution - Marshalling of the return values !4
  • 5. Concurrency in Pharo !5 P1 P2 P3 Interpreter Thread p1 p3 p1 p2 p2
  • 6. Concurrency in Pharo !6 P1 P2 P3 Interpreter Thread p1 p3 p1 p2 p2 Interpreter handles process scheduling
  • 7. Concurrency in Pharo !7 P1 P2 P3 Interpreter Thread p1 p3 p1 p2 p2 p1 int function(char* foo, int bar)
  • 8. Concurrency in Pharo !8 P1 P2 P3 Interpreter Thread p1 p3 p1 p2 p2 p1 Out of Interpreter Interpreter loses control int function(char* foo, int bar)
  • 9. What we want! int function(char* foo, int bar) !9 P1 P2 Interpreter #1 Interpreter #2
  • 10. What we want! int function(char* foo, int bar) !10 P1 P2 Interpreter #1 Interpreter #2 • Requires extensive modification of VM, Plugins and Image core libraries • Applications should be written with threading in mind • Real multithreading not only for FFI
  • 11. Proposal: Global Interpreter Lock VM int function(char* foo, int bar) P1 P2 Interpreter #1 Interpreter #2 !11
  • 12. Research Questions • RQ1: How does scheduling work in presence of processes and native threads? • RQ2: What is the overhead of thread switching? !12
  • 13. Process scheduling with many VM threads !13 P1 P2 P3 VM Thread #1 p1 p1 p2 VM Thread #2 p3 p2 One VM Thread owns the VM at each time
  • 14. Process Affinity !14 p3 bindToThreadId: 2 • Explicit binding • When a process is activated, it is run in the affined thread • Or in the same thread if not affined VM Thread #1 p1 p1 p2 VM Thread #2 p3 p2 Disown VM Own VM
  • 15. Non-blocking FFI !15 • Before FFI calls the current thread disowns the VM • Another thread owns the VM • Non-blocked processes are scheduled VM Thread #1 p1 p1 p2 VM Thread #2 p2 Disown VM Own VM
  • 16. Short
 callouts? !16 • If naive, each disown creates a lot of overhead! VM Thread #1 p1 p1 p2 VM Thread #2 p2 Disown VM Own VM Own VM Disown VM p1 p2 Disown VM Own VM Own VM Disown VM
  • 17. sleep verify VM Thread #1 p1 p1 p2 VM Thread #2 Disown VM verify Watchdog sleep Own VM verify sleep vm thread can continue! p1 Watchdog Native Thread !17 • A watchdog periodically verifies if the VM is busy • If idle, selects a thread with work to do and activate it
  • 18. sleep verify VM Thread #1 p1 p1 p2 VM Thread #2 Disown VM verify Watchdog sleep Own VM verify sleep vm thread can continue! p1 Short calls !18 • The watchdog sleeping window defines the “length” of the short call
  • 19. sleep verify VM Thread #1 p1 p1 p2 VM Thread #2 Disown VM verify Watchdog sleep verify sleep Own VM p2 Long call preemption !19 • The watchdog sleeping window also defines the max “length” of idle-ness
  • 20. Process switch
 without affinity 50 iterations, mean showed !20
  • 21. Long I/Os sequencial concurrent processes 2 one-sec callouts 50 iterations, mean showed !21
  • 22. Short calls sequencial concurrent processes 100,000 short callouts 50 iterations, mean showed !22
  • 23. • Callbacks • Reentrant callbacks • • More on preemption • Implementation details • Also in the paper… !23
  • 24. sleep verify VM Thread #1 p1 p1 p2 VM Thread #2 Disown VM verify Watchdog sleep Own VM verify sleep vm thread can continue! p1 Future Work #1: watchdog impact • If the watchdog window is not aligned with the FFI calls, short callouts are recognised as long ones (false positives) • Long watchdog window will recognise long calls as short calls and be blocking (false negatives) !24
  • 25. Future Work #2:
 thread management • Should VM threads be created implicitly or explicitly? • Should the thread pool be size-bound? Analyse strategies for particular applications. !25
  • 26. Conclusion • A Global interpreter lock architecture for green-threaded smalltalk implementations • Good for parallelising long blocking I/O • Some strategies to reduce the overhead of thread switch Pablo Tesone Pharo Consortium Guille Polito CNRS UMR9189 CRIStAL, Inria RMoD Eliot Miranda Stellect Systems Inc David Simmons The Light Phone, USA