- InfoQ is a news and community site for software developers with 750,000 unique visitors per month publishing content in 4 languages.
- It posts content from QCon conferences including news, articles, presentations, interviews and books to empower software development through spreading knowledge and innovation.
- QCon conferences are practitioner-driven and designed for influencers of change and innovation, connecting them and catalyzing innovation, and have been attended by over 12,000 delegates since 2007 across 9 cities worldwide.
Introduction by Aaron Turon at Mozilla Research; InfoQ.com stats: 750,000 visitors/month, content published in 4 languages, various content formats including articles and presentations.
QCon aims to empower software development through knowledge sharing. The conference has over 12,000 delegates since 2007 across 9 cities.
Rust is highlighted for its speed and thread safety. Mozilla uses Rust in its Servo browser, targeting control and safety in systems programming.
Explanation of control in programming and Rust's capability to achieve safety without a garbage collector. Rust prevents issues like data races and dangling pointers.
Focus on memory safety through ownership and borrowing. Rust features prevent common issues in C++, promoting safety and avoiding data races.
Rust's approach to concurrency avoids data races using message passing and distinct ownership. Active development areas are highlighted.
Emphasizes safe abstractions in Rust and the community aspect, noting contributions and culture within the Rust programming community.
Summation of Rust's key attributes: memory safety, concurrency, abstraction, and stability without garbage collection. Encouragement to explore and understand Rust.
InfoQ.com: News &Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Watch the video with slide
synchronization on InfoQ.com!
http://www.infoq.com/presentations
/rust-thread-safety
3.
Purpose of QCon
-to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Presented at QCon San Francisco
www.qconsf.com
4.
Rust is asystems programming language
that runs blazingly fast, prevents nearly all
segfaults, and guarantees thread safety.
- https://www.rust-lang.org/
Why Rust?
- You’realready doing systems programming,
want safety or expressiveness.
!
- You wish you could do some systems work
- Maybe as an embedded piece in your
Java, Python, JS, Ruby, …
8.
Why Mozilla?
Browsers needcontrol.
Browsers need safety.
Servo: Next-generation
browser built in Rust.
Rust: New language for
safe systems programming.
9.
What is control?
voidexample() {
vector<string> vector;
…
auto& elem = vector[0];
…
}
string[0]
…elem
vector
data
length
capacity
[0]
[n]
[…]
…
‘H’
…
‘e’
Stack and inline layout.
Interior references
Deterministic destruction
Stack Heap
C++
10.
Zero-cost abstraction
Ability todefine abstractions that
optimize away to nothing.
vector data
length
cap.
[0]
[…]
data cap.
‘H’
‘e’
[…]
Not just memory layout:
- Static dispatch
- Template expansion
- … Java
11.
What is safety?
voidexample() {
vector<string> vector;
…
auto& elem = vector[0];
vector.push_back(some_string);
cout << elem;
}
vector
data
length
capacity
[0]
…
[0]
[1]
elem
Aliasing: more than
one pointer to same
memory.
Dangling pointer: pointer
to freed memory.
C++
Mutating the vector
freed old contents.
12.
What about GC?
Nocontrol.
Requires a runtime.
Insufficient to prevent related problems:
iterator invalidation, data races, many others.
… Plus lotsof goodies
- Pattern matching
- Traits
- “Smart” pointers
- Metaprogramming
- Package management (think Bundler)
TL;DR: Rust is a modern language
fn use(vec: &Vec<int>){
vec.push(3);
vec[1] += 2;
}
Shared references are immutable:
Error: cannot mutate shared reference
* Actually: mutation only in controlled circumstances
*
Aliasing Mutation
24.
fn push_all(from: &Vec<int>,to: &mut Vec<int>) {
for elem in from {
to.push(*elem);
}
}
Mutable references
mutable reference to Vec<int>
push() is legal
What if fromand to are equal?
1
2
3
from
to
elem
1
2
3
…
1
fn push_all(from: &Vec<int>, to: &mut Vec<int>) {
for elem in from {
to.push(*elem);
}
} dangling pointer
27.
fn push_all(from: &Vec<int>,to: &mut Vec<int>) {…}
!
fn caller() {
let mut vec = …;
push_all(&vec, &mut vec);
}
shared reference
Error: cannot have both shared and
mutable reference at same time
A &mut T is the only way to access
the memory it points at
28.
{
let mut vec= Vec::new();
…
for i in 0 .. vec.len() {
let elem: &int = &vec[i];
…
vec.push(…);
}
…
vec.push(…);
}
Borrows restrict access to
the original path for their
duration.
Error: vec[i] is borrowed,
cannot mutate
OK. loan expired.
&
&mut
no writes, no moves
no access at all
Rust’s vision forconcurrency
Originally:
!
Now:
only isolated message passing
libraries for many paradigms,
using ownership to avoid footguns,
guaranteeing no data races
And beyond…
Concurrency isan area of active development.
!
Either already have or have plans for:
- Atomic primitives
- Non-blocking queues
- Concurrent hashtables
- Lightweight thread pools
- Futures
- CILK-style fork-join concurrency
- etc.
Always data-race free
“The Rust communityseems to be
populated entirely by human beings.
I have no idea how this was done.”
— Jamie Brandon
48.
It takes avillage…
Community focus from the start:
Rust 1.0 had > 1,000 contributors
Welcoming, pragmatic culture
!
Developed “in the open”
Much iteration;
humility is key!
!
Clear leadership
Mix of academic and engineering backgrounds
“Keepers of the vision”