<s>
Nano-RK	B-Application
is	O
a	O
wireless	B-Architecture
sensor	I-Architecture
networking	I-Architecture
real-time	B-Operating_System
operating	I-Operating_System
system	I-Operating_System
(	O
RTOS	B-Operating_System
)	O
from	O
Carnegie	O
Mellon	O
University	O
,	O
designed	O
to	O
run	O
on	O
microcontrollers	B-Architecture
for	O
use	O
in	O
sensor	B-Architecture
networks	I-Architecture
.	O
</s>
<s>
Nano-RK	B-Application
supports	O
a	O
fixed-priority	O
fully	O
preemptive	B-Operating_System
scheduler	I-Operating_System
with	O
fine-grained	O
timing	O
primitives	O
to	O
support	O
real-time	B-General_Concept
task	B-General_Concept
sets	O
.	O
</s>
<s>
"	O
Nano	O
"	O
implies	O
that	O
the	O
RTOS	B-Operating_System
is	O
small	O
,	O
using	O
2KB	O
of	O
random-access	B-Architecture
memory	I-Architecture
(	O
RAM	B-Architecture
)	O
and	O
using	O
18KB	O
of	O
flash	B-Device
memory	I-Device
,	O
while	O
RK	O
is	O
short	O
for	O
resource	O
kernel	B-Operating_System
.	O
</s>
<s>
A	O
resource	O
kernel	B-Operating_System
provides	O
reservations	O
on	O
how	O
often	O
system	O
resources	O
can	O
be	O
used	O
.	O
</s>
<s>
For	O
example	O
,	O
a	O
task	B-General_Concept
might	O
only	O
be	O
allowed	O
to	O
execute	O
10ms	O
every	O
150ms	O
(	O
CPU	O
reservation	O
)	O
,	O
or	O
a	O
node	B-Protocol
might	O
only	O
be	O
allowed	O
to	O
transmit	O
10	O
network	B-Protocol
packets	I-Protocol
per	O
minute	O
(	O
network	O
reservation	O
)	O
.	O
</s>
<s>
These	O
reservations	O
form	O
a	O
virtual	O
energy	O
budget	O
to	O
ensure	O
a	O
node	B-Protocol
meets	O
its	O
designed	O
battery	O
lifetime	O
and	O
to	O
prevent	O
a	O
failed	O
node	B-Protocol
from	O
generating	O
excessive	O
network	O
traffic	O
.	O
</s>
<s>
Nano-RK	B-Application
is	O
open-source	B-Application
software	I-Application
,	O
is	O
written	O
in	O
C	B-Language
and	O
runs	O
on	O
the	O
Atmel-based	O
FireFly	O
sensor	O
networking	O
platform	O
,	O
the	O
MicaZ	O
motes	O
,	O
and	O
the	O
MSP430	B-Architecture
processor	O
.	O
</s>
<s>
Tradeoffs	O
occur	O
when	O
using	O
an	O
RTOS	B-Operating_System
in	O
sensor	B-Architecture
networks	I-Architecture
.	O
</s>
<s>
NanoRK	O
takes	O
advantage	O
of	O
priority-based	O
preemptive	B-Operating_System
scheduling	I-Operating_System
to	O
help	O
honor	O
the	O
real-time	B-General_Concept
factor	O
of	O
being	O
deterministic	B-General_Concept
,	O
thus	O
ensuring	O
task	B-General_Concept
timeliness	O
and	O
synchronization	O
.	O
</s>
<s>
Due	O
to	O
the	O
characteristic	O
of	O
limited	O
battery	O
power	O
on	O
the	O
wireless	O
node	B-Protocol
,	O
Nano-RK	B-Application
provides	O
central	B-General_Concept
processing	I-General_Concept
unit	I-General_Concept
(	O
CPU	O
)	O
,	O
network	O
,	O
and	O
sensor	O
efficiency	O
through	O
the	O
use	O
of	O
virtual	O
energy	O
reservations	O
,	O
labeling	O
this	O
system	O
as	O
a	O
resource	O
kernel	B-Operating_System
.	O
</s>
<s>
These	O
energy	O
reservations	O
can	O
enforce	O
energy	O
and	O
communication	O
budgets	O
to	O
minimize	O
the	O
negative	O
impact	O
on	O
the	O
node	B-Protocol
's	O
operational	O
lifetime	O
from	O
unintentional	O
errors	O
or	O
malicious	O
behavior	O
by	O
other	O
nodes	O
within	O
the	O
network	O
.	O
</s>
<s>
It	O
supports	O
packet	B-Protocol
forwarding	O
,	O
routing	O
and	O
other	O
network	O
scheduling	O
protocols	O
with	O
the	O
help	O
of	O
a	O
light-weight	O
wireless	O
networking	O
stack	O
.	O
</s>
<s>
Compared	O
with	O
other	O
current	O
sensor	O
operating	O
systems	O
,	O
Nano-RK	B-Application
provides	O
rich	O
functionality	O
and	O
timeliness	O
scheduling	O
with	O
a	O
small	O
size	O
for	O
its	O
embedded	O
resource	O
kernel	B-Operating_System
(	O
RK	O
)	O
.	O
</s>
<s>
Static	O
Configuration	O
–	O
Nano-RK	B-Application
uses	O
a	O
static	O
design-time	O
approach	O
for	O
energy	O
use	O
control	O
,	O
and	O
disallows	O
dynamic	O
task	B-General_Concept
creation	O
,	O
requiring	O
application	O
developers	O
to	O
set	O
both	O
task	B-General_Concept
and	O
reservation	O
quotas/priorities	O
in	O
a	O
static	O
testbed	O
design	O
.	O
</s>
<s>
This	O
design	O
allows	O
creating	O
an	O
energy	O
budget	O
for	O
each	O
task	B-General_Concept
to	O
maintain	O
application	O
requirements	O
and	O
energy	O
efficiency	O
throughout	O
the	O
system	O
's	O
lifetime	O
.	O
</s>
<s>
In	O
Nano-RK	B-Application
,	O
the	O
watchdog	O
timer	O
is	O
tied	O
directly	O
to	O
the	O
processor	O
's	O
reset	O
signal	O
REBOOT	O
ON	O
ERROR	O
.	O
</s>
<s>
If	O
a	O
sensor	O
node	B-Protocol
does	O
not	O
wish	O
to	O
perform	O
deep	O
sleep	O
,	O
it	O
also	O
is	O
presented	O
with	O
the	O
choice	O
to	O
go	O
into	O
a	O
low	O
energy	O
use	O
state	O
while	O
still	O
managing	O
its	O
peripherals	O
.	O
</s>
<s>
Nano-RK	B-Application
has	O
implemented	O
a	O
double-linked	O
list	O
of	O
ready	O
queue	O
nodes	O
within	O
a	O
fixed-size	O
array	O
,	O
termed	O
the	O
ready	O
queue	O
,	O
that	O
orders	O
All	O
ready	O
tasks	O
in	O
decreasing	O
order	O
by	O
whichever	O
of	O
the	O
task	B-General_Concept
's	O
priorities	O
is	O
higher	O
.	O
</s>
<s>
As	O
the	O
number	O
of	O
tasks	O
running	O
within	O
the	O
Nano-RK	B-Application
implementation	O
is	O
statically	O
configured	O
in	O
a	O
testbed	O
before	O
deployment	O
,	O
the	O
ready	O
queue	O
size	O
is	O
also	O
fixed	O
to	O
this	O
number	O
of	O
tasks	O
that	O
can	O
be	O
ready	O
to	O
run	O
.	O
</s>
<s>
The	O
free	O
node	B-Protocol
pointer	O
(	O
free	O
node	B-Protocol
)	O
and	O
the	O
head	O
node	B-Protocol
pointer	O
(	O
head	O
node	B-Protocol
)	O
point	O
to	O
the	O
next	O
cell	O
in	O
the	O
array	O
to	O
be	O
allocated	O
and	O
the	O
current	O
highest	O
priority	O
task	B-General_Concept
ready	O
to	O
run	O
,	O
respectively	O
.	O
</s>
<s>
The	O
core	O
of	O
Nano-RK	B-Application
is	O
a	O
static	O
preemptive	O
real-time	B-General_Concept
scheduler	O
which	O
is	O
priority-based	O
and	O
energy	O
efficient	O
.	O
</s>
<s>
For	O
priority-based	O
preemptive	B-Operating_System
scheduling	I-Operating_System
,	O
the	O
scheduler	O
always	O
selects	O
the	O
highest	O
priority	O
task	B-General_Concept
from	O
the	O
ready	O
queue	O
.	O
</s>
<s>
When	O
there	O
is	O
no	O
task	B-General_Concept
in	O
the	O
ready	O
queue	O
,	O
the	O
system	O
can	O
be	O
powered	O
down	O
to	O
save	O
energy	O
.	O
</s>
<s>
When	O
the	O
system	O
is	O
working	O
,	O
one	O
and	O
only	O
one	O
task	B-General_Concept
(	O
current	O
task	B-General_Concept
)	O
,	O
signified	O
by	O
the	O
nrk	O
cur	O
task	B-General_Concept
tcb	O
,	O
is	O
running	O
for	O
a	O
predefined	O
period	O
.	O
</s>
<s>
So	O
the	O
most	O
important	O
job	O
of	O
the	O
scheduler	O
is	O
to	O
decide	O
which	O
task	B-General_Concept
should	O
be	O
run	O
next	O
and	O
for	O
how	O
long	O
the	O
next	O
task	B-General_Concept
should	O
run	O
until	O
the	O
scheduler	O
is	O
triggered	O
to	O
run	O
again	O
.	O
</s>
