SlideShare a Scribd company logo
1 of 127
Download to read offline
Lock-free	algorithms	for	
Kotlin	coroutines
It	is	all	about	scalability
Presented	at	SPTCC	2017
/Roman	Elizarov	@	JetBrains
Speaker:	Roman	Elizarov
• 16+	years	experience
• Previously	developed	high-perf	
trading	software	@	Devexperts
• Teach	concurrent	&	distributed	
programming	@	St.	Petersburg	
ITMO	University
• Chief	judge	@	Northeastern	
European	Region	of	ACM	ICPC	
• Now	work	on	Kotlin	@	JetBrains
Agenda
• Kotlin	coroutines	overview	&	motivation	for	lock-
free	algorithms
• Lock-free	doubly	linked	list
• Lock-free	multi-word	compare-and-swap
• Combining	them	to	get	more	complex	atomic	
operations (without	STM)
Kotlin	basic	facts
• Kotlin	is	a	JVM	language	developed	by	JetBrains
• General	purpose	and	statically-typed
• Object-oriented	and	functional	paradigms
• Open	source	under	Apache	2.0
• Reached	version	1.0	in	2016
• Compatibility	commitment
• Now	at	version	1.1
• Officially	supported	by	Google	on	Android
Kotlin	is	…
• Modern
• Concise
• Safe
• Extensible
• Pragmatic
• Fun	to	work	with!
Kotlin	is	pragmatic
… and	easy	to	learn
Coroutines
Asynchronous	programming	made	easy
How	do	we	write	code	that	waits	for	
something	most	of	the	time?
Blocking	threads
Kotlin fun postItem(item: Item) {
val token = requestToken()
val post = submitPost(token, item)
processPost(post)
}
fun postItem(item: Item) {
requestToken { token ->
submitPost(token, item) { post ->
processPost(post)
}
}
}
Callbacks
Kotlin
fun postItem(item: Item) {
requestToken()
.thenCompose { token ->
submitPost(token, item)
}
.thenAccept { post ->
processPost(post)
}
}
Futures/Promises/Rx
Kotlin
Coroutines
Kotlin fun postItem(item: Item) {
launch(CommonPool) {
val token = requestToken()
val post = submitPost(token, item)
processPost(post)
}
}
CSP	&	Actor	models
• A	style of	programming	for	modern	systems
• Lots	of	concurrent	tasks	/	jobs
• Waiting	most	of	the	time
• Communicating	all	the	time
Share	data	by	communicating
Kotlin	coroutines	primitives
• Jobs/Deferreds (futures)
• join/await
• Channels
• send	&	receive
• synchronous	&	buffered	channels
• Select/alternatives
• Atomically	wait	on	multiple	events
• Cancellation
• Parent-child	hierarchies
Implementation	challenges
• Coroutines	are	like	light-weight	threads
• All	the	low-level scheduling	&	communication	
mechanisms	have	to	scale to	lots	of	coroutines
Lock-free	algorithms
Building	blocks
• Single-word	CAS	(that’s	all	we	have	on	JVM)
• Automatic	memory	management	(GC)
• Practical lock-free	algorithms
• Lock-Free	and	Practical	Doubly	Linked	List-Based	
Deques Using	Single-Word	Compare-and-Swap
by	Sundell and	Tsigas
• A	Practical	Multi-Word	Compare-and-Swap	Operation	
by	Timothy	L.	Harris,	Keir	Fraser	and	Ian	A.	Pratt.
Doubly	linked	list
S
N
1
N
P
S
P
H T
sentinel sentinel
Use	same	node	in	practice
next links	form	logical	list	contents
prev links	are	auxiliary
Insert
PushRight (like	in	queue)
Doubly	linked	list (insert	0)
S
N
1
N
P
S
P
H T
2
N
P
create	&	init
1
2
Doubly	linked	list (insert	1)
S
N
1
N
P
S
P
H T
2
N
P
CAS
Retry	insert	on	CAS	
failure
Doubly	linked	list (insert	2)
S
N
1
N
P
S
P
H T
2
N
P
CAS
Ignore	CAS	failure
”finish	insert”
Remove
PopLeft (like	in	queue)
Doubly	linked	list	(remove	1)
S
N
1
N
P
S
P
H T
Mark	removed	node’s	
next link
Use	wrapper object	for	mark	in	practice
Cache	wrappers	in	pointed-to	nodes
CAS
Retry	remove	on	CAS	failure
1
2
Don’t	use	AtomicMarkableReference
CAS
Doubly	linked	list	(remove	2)
S
N
1
N
P
S
P
H T
Mark	removed	node’s	
prev link
Retry	marking	on	CAS	failure
”finish	remove”
Doubly	linked	list	(remove	3)
S
N
1
N
P
S
P
H T
CAS
”help	remove”	– fixup	next links
Doubly	linked	list	(remove	4)
S
N
1
N
P
S
P
H T
CAS
”correct	prev”	– fixup	prev links
State	transitions
Node	states
Init
next:	Ok
prev:	Ok
prev.next:	--
next.prev:	--
Insert	1
next:	Ok
prev:	Ok
prev.next:	me
next.prev:	--
Insert	2
next:	Ok
prev:	Ok
prev.next:	me
next.prev:	me
Remove	1
next:	Rem
prev:	Ok
prev.next:	me
next.prev:	me
Remove	2
next:	Rem
prev:	Rem
prev.next:	me
next.prev:	me
Remove	3
next:	Rem
prev:	Rem
prev.next:	++
next.prev:	me
Remove	4
next:	Rem
prev:	Rem
prev.next:	++
next.prev:	++
help	remove
correct	prev
correct	prev
1 2 3
4 5 6 7
Helping
Concurrent	insert
Concurrent	insert	(0)
S
N
1
N
P
S
P
H T
2
N
P
3
N
P
I2
I3
Concurrent	insert	(1)
S
N
1
N
P
S
P
H T
2
N
P
3
N
P
CAS	fail
CAS	ok
I2
I3
Concurrent	insert	(2)
S
N
1
N
P
S
P
H T
2
N
P
3
N
P
detect	wrong	prev
(t.prev.next !=	t)
I2
I3
Concurrent	insert	(3)
S
N
1
N
P
S
P
H T
2
N
P
3
N
P
correct	prev
I2
I3
Concurrent	insert	(4)
S
N
1
N
P
S
P
H T
2
N
P
3
N
P reinit &	repeat
I2
I3
Concurrent	remove
Concurrent	remove	(0)
S
N
1
N
P
S
P
H T2
N
P
R1
R2
Concurrent	remove	(1)
S
N
1
N
P
S
P
H T2
N
P
R1
R1
R2
Concurrent	remove	(2)
S
N
1
N
P
S
P
H T2
N
P
R1
R2
Finds	already	removed
R1
R2
Concurrent	remove	(3)
S
N
1
N
P
S
P
H T2
N
P
R1
R2
help	remove
mark	prev
R1
R2
Concurrent	remove	(4)
S
N
1
N
P
S
P
H T2
N
P
R1
R2
Retry	with	corrected	next
R1
R2
Concurrent	remove	(5)
S
N
1
N
P
S
P
H T2
N
P
R1
R2
help	remove
R1
R2
Concurrent	remove	(6)
S
N
1
N
P
S
P
H T2
N
P
R1
R2
correct	prev
R1
R2
Concurrent	remove	&	
insert
When	remove	wins
Concurrent	remove	&	insert	(0)
S
N
1
N
P
S
P
H T
2
N
P
create	&	init
R1
R1
I2
Concurrent	remove	&	insert	(1)
S
N
1
N
P
S
P
H T
2
N
P
remove	first
R1
R1
I2
Concurrent	remove	&	insert	(2)
S
N
1
N
P
S
P
H T
2
N
P
CAS	fail
R1
R1
I2
Concurrent	remove	&	insert	(3)
S
N
1
N
P
S
P
H T
2
N
P
detect	wrong	prev
(t.prev.next -- removed)
do	“correct	prev”R1
R1
I2
Concurrent	remove	&	insert	(4)
S
N
1
N
P
S
P
H T
2
N
P
mark	prev
fixup	next
R1
R1
I2
Concurrent	remove	&	insert	(5)
S
N
1
N
P
S
P
H T
2
N
P
R1
R1
I2
update	prev
Concurrent	remove	&	insert	(6)
S
N
1
N
P
S
P
H T
2
N
P
R1
reinit &	repeat
R1
I2
Concurrent	remove	&	
insert
When	insert	wins
Concurrent	remove	&	insert	(0)
S
N
1
N
P
S
P
H T
2
N
P
create	&	init
R1
R1
I2
Concurrent	remove	&	insert	(1)
S
N
1
N
P
S
P
H T
2
N
P
R1
CAS
R1
I2
Concurrent	remove	&	insert	(2)
S
N
1
N
P
S
P
H T
2
N
P
R1
R1
I2
will	succeed	marking	on	remove	retry
Concurrent	remove	&	insert	(3)
S
N
1
N
P
S
P
H T
2
N
P
R1
help	remove
mark	prev
R1
I2
Concurrent	remove	&	insert	(4)
S
N
1
N
P
S
P
H T
2
N
P
R1
correct	prev
R1
I2
Remove	is	over!
Concurrent	remove	&	insert	(5)
S
N
1
N
P
S
P
H T
2
N
P
R1
correct	prev
R1
I2
Takeaways
• A	kind	of	algo you	need	a	paper	for
• Hard	to	improve	w/o	writing	another	paper
• Good	news:	stress	tests	uncover	most	impl bugs
• Bad	news:	when	stress	test	fails,	you	up	to	long	
hours
• More	bad	news:	hard	to	find	bugs	that	violate	lock-
freedomness of	algorithm
Summary:	what	we	can	do
• Insert	items	(at	the	end	of	the	queue)
• Remove	items	(at	the	front	of	the	queue)
• Traverse	the	list
• Remove	items	at	arbitrary	locations
• In	O(1)
Linearizability
• Insert	last
• Linearizes	at	CAS	of	next
• Remove	first	/	arbitrary
• Success	– at	CAS	of	next
• Fail	– at	read	of	head.next
More	about	algorithm
• Sundell &	Tsigas algo supports	deque operations
• Can	PushLeft &	PopRight
• PopLeft is	simple	– read	head.next &	remove
• But	cannot	linearize	them	all	at	cas points
• PushLeft,	PushRight,	PopRight - Ok
• PopLeft linearizes	at	head.next read	(!!!)
Summary	of	impl notes
• Use	GC	(drop	all	memory	management	details)
• Merge	head	&	tail	into	a	single	sentinel	node
• Empty	list	is	just	one	object	(prev &	next	onto	itself)
• One	item	+=	one	object
• Reuse	“remove	mark”	objects
• One-element	lists	reuse	of	ptrs to	sentinel	all	the	time
• Encapsulate!
S
N
P
1
N
P
Q
Mods
More	complex	atomic operations
Basic	mods	(1)
• Insert	item	conditionally	on	prev tail	value
S
N
1
N
P
S
P
H T
2
N
P
check	&	bailout	before	CAS
Basic	mods	(2)
• Remove	head	conditionally	on	prev head	value
S
N
1
N
P
S
P
H T
R1
check	&	bailout	before	CAS
Practical	use-case:	synchronous	
channels
val channel = Channel<Int>()
// coroutine #1
for (x in 1..5) {
channel.send(x * x)
}
// coroutine #2
repeat(5) {
println(channel.receive())
}
1
2
3
Senders	wait
Sender	#1H Sender	#2 Sender	#3 T
More	
senders
Incoming	
receivers
Receiver	removes	
first	if	it	is	a	sender	
node
Sender	inserts	last	if	it	
is	not	a	receiver	node
Receivers	wait
Receiver	#1H Receiver	#2 Receiver	#3 T
More	
receivers
Incoming	
senders
Sender	removes	
first	if	it	is	a	receiver	
node
Receiver	inserts	last	if	
it	is	not	a	sender	node
Send	function	sketch
fun send(element: T) {
while (true) {
// try to add sender, unless prev is receiver
if (enqueueSend(element)) break
// try to remove first receiver
val receiver = removeFirstReceiver()
if (receiver != null) {
receiver.resume(element) // resume receiver
break
}
}
}
1
2
3
4
Channel	use-case	recap
• Uses	insert/remove	ops	conditional	on	tail/head	
node
• Can	abort	(cancel)	wait	to	receive/send	at	any	time	
by	using	remove
• Full	removal	-- no	garbage	is	left
• Pretty	efficient	in	practice
• One	item	lists	– one	“garbage”	object
Multi-word	compare	and	
swap	(CASN)
Build	even	bigger	atomic	operations
Use-case:	select	expression
val channel1 = Channel<Int>()
val channel2 = Channel<Int>()
select {
channel1.onReceive { e -> ... }
channel2.onReceive { e -> ... }
}
Impl summary:	register	(1)
Select	
status:	NS
Channel1
Queue
Channel2
Queue
1. Not	selected
2. Selected
Impl summary:	register	(2)
Select	
status:	NS
Channel1
Queue
Channel2
Queue
Add	node	to	channel1	queue	if
not	selected	(NS)	yet	
N1
Impl summary:	register	(3)
Select	
status:	NS
Channel1
Queue
Channel2
Queue
Add	node	to	channel2	queue	if
not	selected	(NS)	yet	
N1 N2
Impl summary:	wait
Select	
status:	NS
Channel1
Queue
Channel2
Queue
N1 N2
Impl summary:	select	(resume)
Select	
status:	S
Channel1
Queue
Channel2
Queue
N1
Make	selected	and remove	node	
from	queue
Impl summary:	clean	up	rest
Select	
status:	S
Channel1
Queue
Channel2
Queue
Remove	non-selected	waiters	
from	queue
Double-Compare	
Single-Swap	(DCSS)
Building	block	for	CASN
DCSS	spec	in	pseudo-code
A B
fun <A,B> dcss(
a: Ref<A>, expectA: A, updateA: A,
b: Ref<B>, expectB: B) =
atomic {
if (a.value == expectA && b.value == expectB) {
a.value = updateA
}
}
1
2
3
4
DCSS:	init descriptor
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB)
A BexpectA expectB
updateA
DCSS:	prepare
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB)
A B
CAS	ptr to	descriptor	if	a.value == expectA
expectA expectB
updateA
DCSS:	read	b.value
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB)
A B
CAS	ptr to	descriptor	if	a.value == expectA
expectA expectB
updateA
DCSS:	complete	(when	success)
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB)
A BexpectA expectB
updateA
CAS	to	updated	value	if	a	still	points	to	descriptor
DCSS:	complete	(alternative)
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB)
A BexpectA !expectB
updateA
DCSS:	complete	(when	fail)
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB)
A BexpectA !expectB
updateA
CAS	to	original	value	if	a	still	points	to	descriptor
DCSS:	States
Init
A:	???
(desc created)
A:	desc
A	was	expectA
prep	ok
A:	???
A	was	!expectA
prep	fail
one	tread
1 2
A:	updateA
B	was	expectB
success
A:	expectA
B	was	!expectB
4 5
fail
Any	other	thread	encountering	
descriptor	helps	complete
Originator	cannot	
learn	what	was	the	
outcome
Lock-free	algorithm	without	loops!
3
Caveats
• A	&	B	locations	must	be	totally	ordered
• or	risk	stack-overflow	while	helping
• One	way	to	look	at	it:	Restricted	DCSS	(RDCSS)
DCSS	Mod:	learn	outcome
A B
fun <A,B> dcssMod(
a: Ref<A>, expectA: A, updateA: A,
b: Ref<B>, expectB: B): Boolean =
atomic {
if (a.value == expectA && b.value == expectB) {
a.value = updateA
true
} else
false
}
DCSS	Mod:	init descriptor
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB)
A BexpectA expectB
updateA
Outcome:	UNDECIDED
Consensus
DCSS	Mod:	prepare
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB)
A BexpectA expectB
updateA
Outcome:	UNDECIDED
DCSS	Mod:	read	b.value
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB)
A BexpectA expectB
updateA
Outcome:	UNDECIDED
DCSS	Mod:	reach	consensus
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB)
A BexpectA expectB
updateA
Outcome:	SUCCESS
CAS(UNDECIDED,	
DECISION)
DCSS	Mod:	complete
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB)
A BexpectA expectB
updateA
Outcome:	SUCCESS
DCSS	Mod:	States
Init
A:	???
Outcome:	UND
(desc created)
A:	desc
Outcome:	UND
A	was	expectA
prep	ok
A:	???
Outcome:	FAIL
A	was	!expectA
prep	fail
one	tread
1 2
A:	desc
Outcome:	SUCC
B	was	expectB
success
A:	desc
Outcome:	FAIL
6
fail
A:	expectA
A:	updateA
5
7
Still	no	loops!
3
4
Compare-And-Swap	
N-words	(CASN)
The	ultimate	atomic	update
CASN	spec	in	pseudo-code
A B
fun <A,B> cas2(
a: Ref<A>, expectA: A, updateA: A,
b: Ref<B>, expectB: B, updateB: B): Boolean =
atomic {
if (a.value == expectA && b.value == expectB) {
a.value = updateA
b.value = updateB
true
} else
false
}
1
2
3
4
5
For	two	words,	for	simplicity
CASN:	init descriptor
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB,	updateB)
A BexpectA expectB
updateA
Outcome:	UNDECIDED
updateB
CASN:	prepare	(1)
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB,	updateB)
A BexpectA expectB
updateA
Outcome:	UNDECIDED
updateBCAS
CASN:	prepare	(2)
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB,	updateB)
A BexpectA expectB
updateA
Outcome:	UNDECIDED
updateB
Use	DCSS	to	update	B	if
Outcome	==	UNDECIDED
DCSS
CASN:	decide
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB,	updateB)
A BexpectA expectB
updateA
Outcome:	SUCCESS
updateB
CAS	outcome
CASN:	complete	(1)
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB,	updateB)
A BexpectA expectB
updateA
Outcome:	SUCCESS
updateB
CAS
CASN:	complete	(2)
DCSS	Descriptor
(a,	expectA,	updateA,
b,	expectB,	updateB)
A BexpectA expectB
updateA
Outcome:	SUCCESS
updateB
CAS
CASN:	States
A:	???
B:	???
O:	UND
A:	desc
B:	???
O:	UND
A:	desc
B:	desc
O:	UND
A:	updateA
B:	desc
O:	SUCC
Init
A:	updateA
B:	updateB
O:	SUCC
1 2 3
5
A:	desc
B:	desc
O:	SUCC
4
6
A:	???
B:	???
O:	FAIL
A	!=	expectA
A:	desc
B:	???
O:	FAIL
B !=	expectB
one	tread
A:	expectA
B:	???
O:	FAIL
7 8
9
DCSS
Prevents	from
going	back	in	this	SM
descriptor	is	known	to	other	(helping)	threads
Using	it	in	practice
All	the	little	things	that	matter
It	is	easy	to	combine	multiple	operations	
with	DCSS/CASN	that	linearize	on	a	CAS
with	a	descriptor	parameters	that	are	
known	in	advance
Trivial	example:	Treiber stack
1TOP 2
3 New	node
CAS
expect
update
Let’s	go	deeper
Into	unpublished	territory
Doubly	linked	list:	
insert	last
Operation	Descriptor
A	ref:	???
expectA:	Sentinel
updateA:	Node	#2
…
Outcome:	UNDECIDED
Doubly	linked	list:	insert	(0)
S
N
1
N
P
S
P
H T
2
N
P
CAS	here
We	know	expected	value	for	CAS	in	advance
We	know	updated	value	for	CAS	in	advance
???	can	fill	in	A	before	CAS	&	update	on	retry
DCSS	here	is	needed	(always!)
Doubly	linked	list:	insert	(1)
S
N
1
N
P
S
P
H T
2
N
P
Operation	Descriptor
A	ref:	???
expectA:	Sentinel
updateA:	Node	#2
…
Outcome:	UNDECIDED
DCSS	Descriptor
affected	node:	#1
operation	ref
Doubly	linked	list:	insert	(2)
S
N
1
N
P
S
P
H T
2
N
P
Operation	Descriptor DCSS	Descriptor
Helpers	are	a	bound	to	stumble	
upon	the	same	descriptor
CAS	can	only	succeed	on	last	node
Competing	inserts	will	
complete	(help)	us	first
affected	node:	#1
operation	ref
A	ref:	???
expectA:	Sentinel
updateA:	Node	#2
…
Outcome:	UNDECIDED
Doubly	linked	list:	insert	(3)
S
N
1
N
P
S
P
H T
2
N
P
Operation	Descriptor
desc is	updated	after successful	DCSS
A	ref:	Node	#1
expectA:	Sentinel
updateA:	Node	#2
…
Outcome:	UNDECIDED
DCSS	Descriptor
affected	node:	#1
operation	ref
Doubly	linked	list:	insert	(4)
S
N
1
N
P
S
P
H T
2
N
P
Operation	Descriptor
Stays	pointed	until	operation	
outcome	is	decided
A	ref:	Node	#1
expectA:	Sentinel
updateA:	Node	#2
…
Outcome:	UNDECIDED
Doubly	linked	list:
remove	first
Doubly	linked	list:	remove	(0)
S
N
1
N
P
S
P
H T
R1
CAS	here
2
N
P
Operation	Descriptor
A	ref:	???
expectA:	???
updateA:	Rem[???]
…
Outcome:	UNDECIDED
Both	not	known	in	advance
Deterministic	f(expectA)
Doubly	linked	list:	remove	(1)
S
N
1
N
P
S
P
H T
R1
2
N
P
Operation	Descriptor
A	ref:	???
expectA:	???
updateA:	Rem[???]
…
Outcome:	UNDECIDED
DCSS	Descriptor
affected	node:	#1
operation	ref
old	value:	#2
Doubly	linked	list:	remove	(2)
S
N
1
N
P
S
P
H T
R1
2
N
P
Operation	Descriptor
A	ref:	???
expectA:	???
updateA:	Rem[???]
…
Outcome:	UNDECIDED
It	locks	what	node	we	are	to	removeCannot	change	w/o	removal	of	#1
We	don’t	support	PushLeft!!!
DCSS	Descriptor
affected	node:	#1
operation	ref
old	value:	#2
Doubly	linked	list:	remove	(3)
S
N
1
N
P
S
P
H T
R1
2
N
P
Operation	Descriptor
A	ref:	Node	#1
expectA:	Node	#2
updateA:	Rem[#2]
…
Outcome:	UNDECIDED
desc is	updated	after successful	DCSS
DCSS	Descriptor
affected	node:	#1
operation	ref
old	value:	#2
Doubly	linked	list:	remove	(4)
S
N
1
N
P
S
P
H T
R1
2
N
P
Operation	Descriptor
A	ref:	Node	#1
expectA:	Node	#2
updateA:	Rem[#2]
…
Outcome:	UNDECIDED
Stays	pointed	until	operation	
outcome	is	decided
Closing	notes
• All	we	care	about	is	CAS that	linearizes	operation
• Subsequent	updates	are	helper moves
• Invoke	regular	help/correct	functions
• Perfect	algorithm	to	combine	with	optional	
Hardware	Transactional	Memory	(HTM)
Let’s	enjoy	what	we’ve	accomplished
References
• Kotlin	language
• http://kotlinlang.org
• Kotlin	coroutines	support	library
• http://github.com/kotlin/kotlinx.coroutines
Thank	you
Any	questions?
email	me	to	elizarov at	gmail
relizarov

More Related Content

What's hot

The Kotlin Programming Language
The Kotlin Programming LanguageThe Kotlin Programming Language
The Kotlin Programming Language
intelliyole
 

What's hot (20)

Kotlin
KotlinKotlin
Kotlin
 
Karate, the black belt of HTTP API testing?
Karate, the black belt of HTTP API testing?Karate, the black belt of HTTP API testing?
Karate, the black belt of HTTP API testing?
 
The Kotlin Programming Language
The Kotlin Programming LanguageThe Kotlin Programming Language
The Kotlin Programming Language
 
Spring boot
Spring bootSpring boot
Spring boot
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
 
Kotlin
KotlinKotlin
Kotlin
 
API Test Automation Using Karate (Anil Kumar Moka)
API Test Automation Using Karate (Anil Kumar Moka)API Test Automation Using Karate (Anil Kumar Moka)
API Test Automation Using Karate (Anil Kumar Moka)
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
 
Appium
AppiumAppium
Appium
 
Java vs kotlin
Java vs kotlin Java vs kotlin
Java vs kotlin
 
Kotlin InDepth Tutorial for beginners 2022
Kotlin InDepth Tutorial for beginners 2022Kotlin InDepth Tutorial for beginners 2022
Kotlin InDepth Tutorial for beginners 2022
 
Behavior Driven Development and Laravel
Behavior Driven Development and LaravelBehavior Driven Development and Laravel
Behavior Driven Development and Laravel
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
[11]Android DataBinding : 기초에서 고급까지
[11]Android DataBinding : 기초에서 고급까지[11]Android DataBinding : 기초에서 고급까지
[11]Android DataBinding : 기초에서 고급까지
 
Kotlin - Better Java
Kotlin - Better JavaKotlin - Better Java
Kotlin - Better Java
 
Node js
Node jsNode js
Node js
 
Intro to kotlin
Intro to kotlinIntro to kotlin
Intro to kotlin
 
Selenium
SeleniumSelenium
Selenium
 
Node js
Node jsNode js
Node js
 
Fastlane on Android 介紹
Fastlane on Android 介紹Fastlane on Android 介紹
Fastlane on Android 介紹
 

Similar to Lock-free algorithms for Kotlin Coroutines

Real time system_performance_mon
Real time system_performance_monReal time system_performance_mon
Real time system_performance_mon
Tomas Doran
 

Similar to Lock-free algorithms for Kotlin Coroutines (20)

Repeating History...On Purpose...with Elixir
Repeating History...On Purpose...with ElixirRepeating History...On Purpose...with Elixir
Repeating History...On Purpose...with Elixir
 
Introduction to multicore .ppt
Introduction to multicore .pptIntroduction to multicore .ppt
Introduction to multicore .ppt
 
Haskell @ HAN Arnhem 2013-2014
Haskell @ HAN Arnhem 2013-2014Haskell @ HAN Arnhem 2013-2014
Haskell @ HAN Arnhem 2013-2014
 
TDD and the Legacy Code Black Hole
TDD and the Legacy Code Black HoleTDD and the Legacy Code Black Hole
TDD and the Legacy Code Black Hole
 
Non blocking programming and waiting
Non blocking programming and waitingNon blocking programming and waiting
Non blocking programming and waiting
 
Python indroduction
Python indroductionPython indroduction
Python indroduction
 
Performance and Abstractions
Performance and AbstractionsPerformance and Abstractions
Performance and Abstractions
 
SnW: Introduction to PYNQ Platform and Python Language
SnW: Introduction to PYNQ Platform and Python LanguageSnW: Introduction to PYNQ Platform and Python Language
SnW: Introduction to PYNQ Platform and Python Language
 
Future of Kotlin - How agile can language development be?
Future of Kotlin - How agile can language development be?Future of Kotlin - How agile can language development be?
Future of Kotlin - How agile can language development be?
 
Children of Ruby
Children of RubyChildren of Ruby
Children of Ruby
 
C# Async/Await Explained
C# Async/Await ExplainedC# Async/Await Explained
C# Async/Await Explained
 
Erlang factory SF 2011 "Erlang and the big switch in social games"
Erlang factory SF 2011 "Erlang and the big switch in social games"Erlang factory SF 2011 "Erlang and the big switch in social games"
Erlang factory SF 2011 "Erlang and the big switch in social games"
 
Erlang, the big switch in social games
Erlang, the big switch in social gamesErlang, the big switch in social games
Erlang, the big switch in social games
 
Working With Concurrency In Java 8
Working With Concurrency In Java 8Working With Concurrency In Java 8
Working With Concurrency In Java 8
 
Actors and Threads
Actors and ThreadsActors and Threads
Actors and Threads
 
Functional programming techniques in regular JavaScript
Functional programming techniques in regular JavaScriptFunctional programming techniques in regular JavaScript
Functional programming techniques in regular JavaScript
 
Rethinking the debugger
Rethinking the debuggerRethinking the debugger
Rethinking the debugger
 
Clojure in real life 17.10.2014
Clojure in real life 17.10.2014Clojure in real life 17.10.2014
Clojure in real life 17.10.2014
 
Real time system_performance_mon
Real time system_performance_monReal time system_performance_mon
Real time system_performance_mon
 
Introduction to the intermediate Python - v1.1
Introduction to the intermediate Python - v1.1Introduction to the intermediate Python - v1.1
Introduction to the intermediate Python - v1.1
 

More from Roman Elizarov

Многопоточное Программирование - Теория и Практика
Многопоточное Программирование - Теория и ПрактикаМногопоточное Программирование - Теория и Практика
Многопоточное Программирование - Теория и Практика
Roman Elizarov
 
Многопоточные Алгоритмы (для BitByte 2014)
Многопоточные Алгоритмы (для BitByte 2014)Многопоточные Алгоритмы (для BitByte 2014)
Многопоточные Алгоритмы (для BitByte 2014)
Roman Elizarov
 
Теоретический минимум для понимания Java Memory Model (для JPoint 2014)
Теоретический минимум для понимания Java Memory Model (для JPoint 2014)Теоретический минимум для понимания Java Memory Model (для JPoint 2014)
Теоретический минимум для понимания Java Memory Model (для JPoint 2014)
Roman Elizarov
 
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review
Roman Elizarov
 
Java Serialization Facts and Fallacies
Java Serialization Facts and FallaciesJava Serialization Facts and Fallacies
Java Serialization Facts and Fallacies
Roman Elizarov
 
Millions quotes per second in pure java
Millions quotes per second in pure javaMillions quotes per second in pure java
Millions quotes per second in pure java
Roman Elizarov
 
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
Roman Elizarov
 
The theory of concurrent programming for a seasoned programmer
The theory of concurrent programming for a seasoned programmerThe theory of concurrent programming for a seasoned programmer
The theory of concurrent programming for a seasoned programmer
Roman Elizarov
 

More from Roman Elizarov (20)

Kotlin Coroutines in Practice @ KotlinConf 2018
Kotlin Coroutines in Practice @ KotlinConf 2018Kotlin Coroutines in Practice @ KotlinConf 2018
Kotlin Coroutines in Practice @ KotlinConf 2018
 
Deep dive into Coroutines on JVM @ KotlinConf 2017
Deep dive into Coroutines on JVM @ KotlinConf 2017Deep dive into Coroutines on JVM @ KotlinConf 2017
Deep dive into Coroutines on JVM @ KotlinConf 2017
 
Introduction to Coroutines @ KotlinConf 2017
Introduction to Coroutines @ KotlinConf 2017Introduction to Coroutines @ KotlinConf 2017
Introduction to Coroutines @ KotlinConf 2017
 
Fresh Async with Kotlin @ QConSF 2017
Fresh Async with Kotlin @ QConSF 2017Fresh Async with Kotlin @ QConSF 2017
Fresh Async with Kotlin @ QConSF 2017
 
Scale Up with Lock-Free Algorithms @ JavaOne
Scale Up with Lock-Free Algorithms @ JavaOneScale Up with Lock-Free Algorithms @ JavaOne
Scale Up with Lock-Free Algorithms @ JavaOne
 
Kotlin Coroutines Reloaded
Kotlin Coroutines ReloadedKotlin Coroutines Reloaded
Kotlin Coroutines Reloaded
 
ACM ICPC 2016 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2016 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2016 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2016 NEERC (Northeastern European Regional Contest) Problems Review
 
Многопоточное Программирование - Теория и Практика
Многопоточное Программирование - Теория и ПрактикаМногопоточное Программирование - Теория и Практика
Многопоточное Программирование - Теория и Практика
 
Wait for your fortune without Blocking!
Wait for your fortune without Blocking!Wait for your fortune without Blocking!
Wait for your fortune without Blocking!
 
ACM ICPC 2015 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2015 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2015 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2015 NEERC (Northeastern European Regional Contest) Problems Review
 
ACM ICPC 2014 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2014 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2014 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2014 NEERC (Northeastern European Regional Contest) Problems Review
 
Why GC is eating all my CPU?
Why GC is eating all my CPU?Why GC is eating all my CPU?
Why GC is eating all my CPU?
 
Многопоточные Алгоритмы (для BitByte 2014)
Многопоточные Алгоритмы (для BitByte 2014)Многопоточные Алгоритмы (для BitByte 2014)
Многопоточные Алгоритмы (для BitByte 2014)
 
Теоретический минимум для понимания Java Memory Model (для JPoint 2014)
Теоретический минимум для понимания Java Memory Model (для JPoint 2014)Теоретический минимум для понимания Java Memory Model (для JPoint 2014)
Теоретический минимум для понимания Java Memory Model (для JPoint 2014)
 
DIY Java Profiling
DIY Java ProfilingDIY Java Profiling
DIY Java Profiling
 
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review
 
Java Serialization Facts and Fallacies
Java Serialization Facts and FallaciesJava Serialization Facts and Fallacies
Java Serialization Facts and Fallacies
 
Millions quotes per second in pure java
Millions quotes per second in pure javaMillions quotes per second in pure java
Millions quotes per second in pure java
 
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2012 NEERC (Northeastern European Regional Contest) Problems Review
 
The theory of concurrent programming for a seasoned programmer
The theory of concurrent programming for a seasoned programmerThe theory of concurrent programming for a seasoned programmer
The theory of concurrent programming for a seasoned programmer
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern Enterprise
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

Lock-free algorithms for Kotlin Coroutines