<s>
Tokio	B-Application
is	O
a	O
software	B-Library
library	I-Library
for	O
the	O
Rust	B-Application
programming	I-Application
language	I-Application
.	O
</s>
<s>
It	O
provides	O
a	O
runtime	B-Library
and	O
functions	O
that	O
enable	O
the	O
use	O
of	O
asynchronous	B-Architecture
I/O	I-Architecture
,	O
allowing	O
for	O
concurrency	O
in	O
regards	O
to	O
task	O
completion	O
.	O
</s>
<s>
Tokio	B-Application
was	O
released	O
in	O
August	O
2016	O
for	O
Rust	B-Application
,	O
a	O
general-purpose	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
Developed	O
by	O
Carl	O
Lerche	O
,	O
Tokio	B-Application
began	O
as	O
a	O
network	O
application	O
framework	O
and	O
supports	O
features	O
such	O
as	O
socket	O
listening	O
and	O
broadcasting	B-Operating_System
,	O
allowing	O
messages	O
to	O
be	O
transferred	O
between	O
computers	O
.	O
</s>
<s>
Tokio	B-Application
began	O
in	O
August	O
2016	O
by	O
Carl	O
Lerche	O
as	O
a	O
network	O
application	O
framework	O
for	O
Rust	B-Application
built	O
on	O
futures	B-Operating_System
,	O
allowing	O
for	O
network-based	O
middleware	B-General_Concept
and	O
a	O
non-blocking	B-Architecture
,	O
or	O
asynchronous	O
,	O
implementation	O
of	O
readiness	O
interest	O
to	O
the	O
reactor	B-Operating_System
.	O
</s>
<s>
Tokio	B-Application
was	O
inspired	O
by	O
Finagle	O
,	O
a	O
Scala-based	O
asynchronous	O
remote	B-Operating_System
procedure	I-Operating_System
call	I-Operating_System
(	O
RPC	O
)	O
system	O
developed	O
at	O
Twitter	O
for	O
Java	B-Language
virtual	I-Language
machines	I-Language
(	O
JVM	B-Language
)	O
,	O
allowing	O
distributed	O
systems	O
to	O
communicate	O
within	O
a	O
JVM	B-Language
.	O
</s>
<s>
Tokio	B-Application
utilizes	O
the	O
lower-level	O
Rust	B-Application
crate	O
mio	O
,	O
itself	O
using	O
system	O
calls	O
such	O
as	O
epoll	B-Application
(	O
Linux	B-Application
)	O
,	O
kqueue	B-Application
(	O
FreeBSD	B-Operating_System
)	O
,	O
and	O
the	O
input/output	B-Library
completion	I-Library
port	I-Library
(	O
IOCP	B-Library
)	O
API	O
(	O
Windows	B-Device
)	O
.	O
</s>
<s>
The	O
name	O
"	O
Tokio	B-Application
"	O
is	O
derived	O
from	O
Tokyo	O
and	O
mio	O
.	O
</s>
<s>
The	O
preliminary	O
version	O
of	O
Tokio	B-Application
was	O
released	O
in	O
January	O
2017	O
,	O
followed	O
by	O
a	O
full	O
release	O
in	O
December	O
2020	O
.	O
</s>
<s>
In	O
2017	O
,	O
Tokio	B-Application
received	O
a	O
grant	O
from	O
the	O
Mozilla	B-Operating_System
Open	I-Operating_System
Source	I-Operating_System
Support	I-Operating_System
fund	O
.	O
</s>
<s>
In	O
April	O
2021	O
,	O
Tokio	B-Application
funded	O
its	O
first	O
paid	O
contributor	O
,	O
Alice	O
Ryhl	O
,	O
for	O
her	O
work	O
both	O
developing	O
the	O
project	O
and	O
assisting	O
its	O
users	O
.	O
</s>
<s>
While	O
Rust	B-Application
has	O
supported	O
asynchronous	O
functions	O
since	O
version	O
1.39	O
,	O
released	O
in	O
November	O
2019	O
,	O
it	O
provides	O
no	O
facilities	O
to	O
execute	O
them	O
,	O
requiring	O
an	O
external	O
runtime	B-Library
for	O
that	O
purpose	O
.	O
</s>
<s>
Tokio	B-Application
provides	O
a	O
runtime	B-Library
that	O
uses	O
a	O
multi-threaded	O
work	B-Operating_System
stealing	I-Operating_System
scheduler	O
.	O
</s>
<s>
Rust	B-Application
's	O
futures	B-Operating_System
are	O
lazily	O
evaluated	O
,	O
requiring	O
functions	O
to	O
call	O
.await	O
before	O
they	O
do	O
any	O
work	O
.	O
</s>
<s>
When	O
.await	O
is	O
invoked	O
,	O
Tokio	B-Application
's	O
runtime	B-Library
may	O
pause	O
the	O
original	O
future	O
until	O
its	O
I/O	O
completes	O
,	O
and	O
unpauses	O
a	O
different	O
task	O
that	O
is	O
ready	O
for	O
further	O
processing	O
.	O
</s>
<s>
Users	O
of	O
Tokio	B-Application
include	O
the	O
development	O
teams	O
behind	O
Discord	B-Application
and	O
AWS	B-Application
Lambda	I-Application
.	O
</s>
<s>
The	O
JavaScript	B-Language
and	O
TypeScript	B-Language
runtime	B-Library
Deno	B-Application
uses	O
Tokio	B-Application
under	O
the	O
hood	O
,	O
in	O
comparison	O
to	O
the	O
JavaScript	B-Language
runtime	B-Library
Node.js	B-Language
,	O
which	O
uses	O
the	O
libuv	B-Language
library	O
.	O
</s>
<s>
Tokio	B-Application
allows	O
for	O
the	O
usage	O
of	O
asynchronous	O
functions	O
in	O
Rust	B-Application
through	O
the	O
creation	O
of	O
an	O
asynchronous	O
runtime	B-Library
.	O
</s>
<s>
This	O
can	O
be	O
accomplished	O
through	O
the	O
#[tokio::main]	O
macro	O
.	O
</s>
<s>
In	O
this	O
example	O
,	O
the	O
reqwest	O
crate	O
is	O
used	O
to	O
request	O
the	O
HyperText	B-Language
Markup	I-Language
Language	I-Language
(	O
HTML	B-Language
)	O
for	O
English	O
Wikipedia	O
.	O
</s>
<s>
To	O
ensure	O
that	O
the	O
request	O
is	O
not	O
immediately	O
handled	O
,	O
Tokio	B-Application
wraps	O
the	O
function	O
call	O
into	O
an	O
asynchronous	O
runtime	B-Library
,	O
waiting	O
for	O
the	O
request	O
to	O
complete	O
before	O
calling	O
println( )	O
.	O
</s>
<s>
Tokio	B-Application
also	O
includes	O
a	O
version	O
of	O
the	O
Rust	B-Application
standard	O
library	O
that	O
is	O
designed	O
for	O
being	O
used	O
asynchronously	O
.	O
</s>
<s>
For	O
example	O
,	O
tokio::fs::read_to_end( )	O
,	O
which	O
reads	O
the	O
contents	O
of	O
a	O
file	O
,	O
is	O
the	O
asynchronous	O
version	O
of	O
std::fs::read_to_end( )	O
.	O
</s>
<s>
In	O
addition	O
,	O
Tokio	B-Application
supports	O
io_uring	O
,	O
a	O
Linux	B-Application
asynchronous	B-Architecture
I/O	I-Architecture
syscall	O
interface	O
,	O
in	O
a	O
separate	O
crate	O
named	O
tokio-uring	O
.	O
</s>
<s>
Tokio	B-Application
further	O
allows	O
users	O
to	O
create	O
tasks	O
,	O
which	O
are	O
green	B-Operating_System
threads	I-Operating_System
,	O
using	O
a	O
tokio::spawn( )	O
function	O
.	O
</s>
<s>
Green	B-Operating_System
threads	I-Operating_System
run	O
at	O
the	O
user	O
level	O
,	O
providing	O
parallelism	O
when	O
native	O
threads	O
are	O
not	O
always	O
available	O
.	O
</s>
<s>
Previous	O
versions	O
of	O
Rust	B-Application
implemented	O
green	O
threading	O
;	O
this	O
functionality	O
was	O
removed	O
in	O
Rust	B-Application
1.0	O
.	O
</s>
<s>
Unlike	O
futures	B-Operating_System
,	O
tasks	O
do	O
not	O
need	O
to	O
use	O
.await	O
,	O
as	O
the	O
task	O
will	O
be	O
automatically	O
executed	O
when	O
a	O
thread	O
is	O
available	O
.	O
</s>
<s>
Tokio	B-Application
is	O
capable	O
of	O
listening	O
on	O
a	O
socket	O
through	O
a	O
non-blocking	B-Architecture
approach	O
.	O
</s>
<s>
In	O
particular	O
,	O
the	O
TcpListener	O
structure	O
binds	O
a	O
Transmission	B-Protocol
Control	I-Protocol
Protocol	I-Protocol
(	O
TCP	O
)	O
socket	O
listener	O
to	O
an	O
address	O
and	O
asynchronously	O
executes	O
function	O
.	O
</s>
<s>
Tokio	B-Application
provides	O
a	O
broadcast	B-Operating_System
channel	O
type	O
,	O
allowing	O
for	O
messages	O
to	O
be	O
broadcast	B-Operating_System
to	O
multiple	O
receivers	O
.	O
</s>
