<s>
Hardware	B-Operating_System
abstractions	I-Operating_System
are	O
sets	O
of	O
routines	O
in	O
software	B-Application
that	O
provide	O
programs	O
with	O
access	O
to	O
hardware	B-Architecture
resources	O
through	O
programming	B-Application
interfaces	I-Application
.	O
</s>
<s>
The	O
programming	B-Application
interface	I-Application
allows	O
all	O
devices	O
in	O
a	O
particular	O
class	O
C	O
of	O
hardware	B-Architecture
devices	O
to	O
be	O
accessed	O
through	O
identical	O
interfaces	O
even	O
though	O
C	O
may	O
contain	O
different	O
subclasses	O
of	O
devices	O
that	O
each	O
provide	O
a	O
different	O
hardware	B-Architecture
interface	O
.	O
</s>
<s>
Hardware	B-Operating_System
abstractions	I-Operating_System
often	O
allow	O
programmers	O
to	O
write	O
device-independent	O
,	O
high	O
performance	O
applications	O
by	O
providing	O
standard	O
operating	B-General_Concept
system	I-General_Concept
(	O
OS	O
)	O
calls	O
to	O
hardware	B-Architecture
.	O
</s>
<s>
The	O
process	O
of	O
abstracting	B-Application
pieces	O
of	O
hardware	B-Architecture
is	O
often	O
done	O
from	O
the	O
perspective	O
of	O
a	O
CPU	B-General_Concept
.	O
</s>
<s>
Each	O
type	O
of	O
CPU	B-General_Concept
has	O
a	O
specific	O
instruction	B-General_Concept
set	I-General_Concept
architecture	I-General_Concept
or	O
ISA	B-Architecture
.	O
</s>
<s>
The	O
ISA	B-Architecture
represents	O
the	O
primitive	O
operations	O
of	O
the	O
machine	O
that	O
are	O
available	O
for	O
use	O
by	O
assembly	B-Language
programmers	O
and	O
compiler	B-Language
writers	O
.	O
</s>
<s>
One	O
of	O
the	O
main	O
functions	O
of	O
a	O
compiler	B-Language
is	O
to	O
allow	O
a	O
programmer	O
to	O
write	O
an	O
algorithm	O
in	O
a	O
high-level	B-Language
language	I-Language
without	O
having	O
to	O
care	O
about	O
CPU-specific	O
instructions	O
.	O
</s>
<s>
Then	O
it	O
is	O
the	O
job	O
of	O
the	O
compiler	B-Language
to	O
generate	O
a	O
CPU-specific	O
executable	O
.	O
</s>
<s>
The	O
same	O
type	O
of	O
abstraction	B-Application
is	O
made	O
in	O
operating	B-General_Concept
systems	I-General_Concept
,	O
but	O
OS	O
APIs	B-Application
now	O
represent	O
the	O
primitive	O
operations	O
of	O
the	O
machine	O
,	O
rather	O
than	O
an	O
ISA	B-Architecture
.	O
</s>
<s>
task	O
creation/deletion	O
)	O
in	O
their	O
programs	O
while	O
retaining	O
portability	B-Architecture
over	O
a	O
variety	O
of	O
different	O
platforms	O
.	O
</s>
<s>
Many	O
early	O
computer	O
systems	O
did	O
not	O
have	O
any	O
form	O
of	O
hardware	B-Operating_System
abstraction	I-Operating_System
.	O
</s>
<s>
This	O
meant	O
that	O
anyone	O
writing	O
a	O
program	O
for	O
such	O
a	O
system	O
would	O
have	O
to	O
know	O
how	O
each	O
hardware	B-Architecture
device	B-Architecture
communicated	O
with	O
the	O
rest	O
of	O
the	O
system	O
.	O
</s>
<s>
This	O
was	O
a	O
significant	O
challenge	O
to	O
software	B-Application
developers	O
since	O
they	O
then	O
had	O
to	O
know	O
how	O
every	O
hardware	B-Architecture
device	B-Architecture
in	O
a	O
system	O
worked	O
to	O
ensure	O
the	B-Application
software	I-Application
's	O
compatibility	B-Device
.	O
</s>
<s>
With	O
hardware	B-Operating_System
abstraction	I-Operating_System
,	O
rather	O
than	O
the	O
program	O
communicating	O
directly	O
with	O
the	O
hardware	B-Architecture
device	B-Architecture
,	O
it	O
communicates	O
to	O
the	O
operating	B-General_Concept
system	I-General_Concept
what	O
the	O
device	B-Architecture
should	O
do	O
,	O
which	O
then	O
generates	O
a	O
hardware-dependent	O
instruction	O
to	O
the	O
device	B-Architecture
.	O
</s>
<s>
This	O
meant	O
programmers	O
did	O
n't	O
need	O
to	O
know	O
how	O
specific	O
devices	O
worked	O
,	O
making	O
their	O
programs	O
compatible	O
with	O
any	O
device	B-Architecture
.	O
</s>
<s>
An	O
example	O
of	O
this	O
might	O
be	O
a	O
"	O
Joystick	B-Device
"	O
abstraction	B-Application
.	O
</s>
<s>
The	O
joystick	B-Device
device	B-Architecture
,	O
of	O
which	O
there	O
are	O
many	O
physical	O
implementations	O
,	O
is	O
readable/writable	O
through	O
an	O
API	B-Application
which	O
many	O
joystick-like	O
devices	O
might	O
share	O
.	O
</s>
<s>
Most	O
joystick-devices	O
might	O
report	O
movement	O
directions	O
.	O
</s>
<s>
Many	O
joystick-devices	O
might	O
have	O
sensitivity-settings	O
that	O
can	O
be	O
configured	O
by	O
an	O
outside	O
application	O
.	O
</s>
<s>
A	O
Joystick	B-Device
abstraction	B-Application
hides	O
details	O
(	O
e.g.	O
,	O
register	O
format	O
,	O
I2C	O
address	O
)	O
of	O
the	O
hardware	B-Architecture
so	O
that	O
a	O
programmer	O
using	O
the	O
abstracted	O
API	B-Application
,	O
does	O
not	O
need	O
to	O
understand	O
the	O
details	O
of	O
the	O
device	B-Architecture
's	O
physical	O
interface	O
.	O
</s>
<s>
This	O
also	O
allows	O
code	O
reuse	O
since	O
the	O
same	O
code	O
can	O
process	O
standardized	O
messages	O
from	O
any	O
kind	O
of	O
implementation	O
which	O
supplies	O
the	O
"	O
joystick	B-Device
"	O
abstraction	B-Application
.	O
</s>
<s>
A	O
"	O
nudge	O
forward	O
"	O
can	O
be	O
from	O
a	O
potentiometer	B-Device
or	O
from	O
a	O
capacitive	O
touch	O
sensor	O
that	O
recognises	O
"	O
swipe	O
"	O
gestures	O
,	O
as	O
long	O
as	O
they	O
both	O
provide	O
a	O
signal	O
related	O
to	O
"	O
movement	O
"	O
.	O
</s>
<s>
resolution	O
of	O
sensor	O
,	O
temporal	O
update	O
frequency	O
)	O
may	O
vary	O
with	O
hardware	B-Architecture
,	O
an	O
API	B-Application
can	O
do	O
little	O
to	O
hide	O
that	O
,	O
other	O
than	O
by	O
assuming	O
a	O
"	O
least	O
common	O
denominator	O
"	O
model	O
.	O
</s>
<s>
Thus	O
,	O
certain	O
deep	O
architectural	O
decisions	O
from	O
the	O
implementation	O
may	O
become	O
relevant	O
to	O
users	O
of	O
a	O
particular	O
instantiation	O
of	O
an	O
abstraction	B-Application
.	O
</s>
<s>
A	O
good	O
metaphor	O
is	O
the	O
abstraction	B-Application
of	O
transportation	O
.	O
</s>
<s>
One	O
can	O
always	O
specify	O
the	O
abstraction	B-Application
"	O
drive	O
to	O
"	O
and	O
let	O
the	O
implementor	O
decide	O
whether	O
bicycling	O
or	O
driving	O
a	O
car	O
is	O
best	O
.	O
</s>
<s>
Examples	O
of	O
"	O
abstractions	B-Application
"	O
on	O
a	O
PC	O
include	O
video	O
input	O
,	O
printers	O
,	O
audio	O
input	O
and	O
output	O
,	O
block	B-General_Concept
devices	I-General_Concept
(	O
e.g.	O
</s>
<s>
In	O
certain	O
computer	O
science	O
domains	O
,	O
such	O
as	O
operating	B-General_Concept
systems	I-General_Concept
or	O
embedded	B-Architecture
systems	I-Architecture
,	O
the	O
abstractions	B-Application
have	O
slightly	O
different	O
appearances	O
(	O
for	O
instance	O
,	O
Operating	B-General_Concept
Systems	I-General_Concept
tend	O
to	O
have	O
more	O
standardized	O
interfaces	O
)	O
,	O
but	O
the	O
concept	O
of	O
abstraction	B-Application
and	O
encapsulation	O
of	O
complexity	O
are	O
common	O
,	O
and	O
deep	O
.	O
</s>
<s>
The	O
hardware	B-Operating_System
abstraction	I-Operating_System
layer	I-Operating_System
reside	O
below	O
the	O
application	B-Application
programming	I-Application
interface	I-Application
(	O
API	B-Application
)	O
in	O
a	O
software	B-Application
stack	O
,	O
whereas	O
the	O
application	O
layer	O
(	O
often	O
written	O
in	O
a	O
high	B-Language
level	I-Language
language	I-Language
)	O
resides	O
above	O
the	O
API	B-Application
and	O
communicates	O
with	O
the	O
hardware	B-Architecture
by	O
calling	O
functions	O
in	O
the	O
API	B-Application
.	O
</s>
<s>
A	O
hardware	B-Operating_System
abstraction	I-Operating_System
layer	I-Operating_System
(	O
HAL	B-Application
)	O
is	O
an	O
abstraction	B-Architecture
layer	I-Architecture
,	O
implemented	O
in	O
software	B-Application
,	O
between	O
the	O
physical	O
hardware	B-Architecture
of	O
a	O
computer	O
and	O
the	B-Application
software	I-Application
that	O
runs	O
on	O
that	O
computer	O
.	O
</s>
<s>
Its	O
function	O
is	O
to	O
hide	O
differences	O
in	O
hardware	B-Architecture
from	O
most	O
of	O
the	O
operating	B-Operating_System
system	I-Operating_System
kernel	I-Operating_System
,	O
so	O
that	O
most	O
of	O
the	O
kernel-mode	B-Operating_System
code	O
does	O
not	O
need	O
to	O
be	O
changed	O
to	O
run	O
on	O
systems	O
with	O
different	O
hardware	B-Architecture
.	O
</s>
<s>
On	O
Microsoft	O
Windows	O
,	O
HAL	B-Application
can	O
basically	O
be	O
considered	O
to	O
be	O
the	O
driver	O
for	O
the	O
motherboard	O
and	O
allows	O
instructions	O
from	O
higher	O
level	O
computer	O
languages	O
to	O
communicate	O
with	O
lower	O
level	O
components	O
,	O
but	O
prevents	O
direct	O
access	O
to	O
the	O
hardware	B-Architecture
.	O
</s>
<s>
CP/M	B-Application
(	O
CP/M	B-Application
BIOS	B-Operating_System
)	O
,	O
DOS	B-Device
(	O
DOS	B-Device
BIOS	B-Operating_System
)	O
,	O
Solaris	B-Application
,	O
Linux	B-Application
,	O
BSD	B-Operating_System
,	O
macOS	B-Application
,	O
and	O
some	O
other	O
portable	O
operating	B-General_Concept
systems	I-General_Concept
also	O
have	O
a	O
HAL	B-Application
,	O
even	O
if	O
it	O
is	O
not	O
explicitly	O
designated	O
as	O
such	O
.	O
</s>
<s>
Some	O
operating	B-General_Concept
systems	I-General_Concept
,	O
such	O
as	O
Linux	B-Application
,	O
have	O
the	O
ability	O
to	O
insert	O
one	O
while	O
running	O
,	O
like	O
Adeos	B-Operating_System
.	O
</s>
<s>
The	O
NetBSD	B-Device
operating	B-General_Concept
system	I-General_Concept
is	O
widely	O
known	O
as	O
having	O
a	O
clean	O
hardware	B-Operating_System
abstraction	I-Operating_System
layer	I-Operating_System
which	O
allows	O
it	O
to	O
be	O
highly	O
portable	O
.	O
</s>
<s>
Popular	O
buses	O
which	O
are	O
used	O
on	O
more	O
than	O
one	O
architecture	O
are	O
also	O
abstracted	O
,	O
such	O
as	O
ISA	B-Architecture
,	O
EISA	B-Device
,	O
PCI	B-Protocol
,	O
PCIe	O
,	O
etc.	O
,	O
allowing	O
drivers	O
to	O
also	O
be	O
highly	O
portable	O
with	O
a	O
minimum	O
of	O
code	O
modification	O
.	O
</s>
<s>
Operating	B-General_Concept
systems	I-General_Concept
having	O
a	O
defined	O
HAL	B-Application
are	O
more	O
easily	O
portable	O
across	O
different	O
hardware	B-Architecture
.	O
</s>
<s>
This	O
is	O
especially	O
important	O
for	O
embedded	B-Architecture
systems	I-Architecture
that	O
run	O
on	O
dozens	O
of	O
different	O
platforms	O
.	O
</s>
<s>
The	O
Windows	B-Device
NT	I-Device
kernel	B-Operating_System
has	O
a	O
HAL	B-Application
in	O
the	O
kernel	B-Operating_System
space	O
between	O
hardware	B-Architecture
and	O
the	O
executive	O
services	O
that	O
are	O
contained	O
in	O
the	O
file	O
NTOSKRNL.EXE	O
under	O
%WINDOWS%	O
\system32\hal.dll	O
.	O
</s>
<s>
This	O
allows	O
portability	B-Architecture
of	O
the	O
Windows	B-Device
NT	I-Device
kernel-mode	B-Operating_System
code	O
to	O
a	O
variety	O
of	O
processors	O
,	O
with	O
different	O
memory	B-General_Concept
management	I-General_Concept
unit	I-General_Concept
architectures	O
,	O
and	O
a	O
variety	O
of	O
systems	O
with	O
different	O
I/O	O
bus	O
architectures	O
;	O
most	O
of	O
that	O
code	O
runs	O
without	O
change	O
on	O
those	O
systems	O
,	O
when	O
compiled	B-Language
for	O
the	O
instruction	B-General_Concept
set	I-General_Concept
applicable	O
to	O
those	O
systems	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
SGI	O
Intel	O
x86-based	O
workstations	O
were	O
not	O
IBM	O
PC	O
compatible	O
workstations	O
,	O
but	O
due	O
to	O
the	O
HAL	B-Application
,	O
Windows	B-Application
2000	I-Application
was	O
able	O
to	O
run	O
on	O
them	O
.	O
</s>
<s>
Since	O
Windows	B-Application
Vista	I-Application
and	O
Windows	B-Device
Server	I-Device
2008	I-Device
,	O
the	O
HAL	B-Application
used	O
is	O
automatically	O
determined	O
during	O
startup	B-Operating_System
.	O
</s>
<s>
An	O
"	O
extreme	O
"	O
example	O
of	O
a	O
HAL	B-Application
can	O
be	O
found	O
in	O
the	O
System/38	B-Device
and	O
AS/400	B-Device
architectures	O
,	O
currently	O
implemented	O
in	O
the	O
IBM	B-Application
i	I-Application
operating	B-General_Concept
system	I-General_Concept
.	O
</s>
<s>
Most	O
compilers	B-Language
for	O
those	O
systems	O
generate	O
an	O
abstract	O
machine	O
code	O
;	O
the	O
Licensed	O
Internal	O
Code	O
,	O
or	O
LIC	O
,	O
translates	O
this	O
virtual	O
machine	O
code	O
into	O
native	O
code	O
for	O
the	O
processor	O
on	O
which	O
it	O
is	O
running	O
and	O
executes	O
the	O
resulting	O
native	O
code	O
.	O
</s>
<s>
(	O
The	O
exceptions	O
are	O
compilers	B-Language
that	O
generate	O
the	O
LIC	O
itself	O
;	O
those	O
compilers	B-Language
are	O
not	O
available	O
outside	O
IBM	O
.	O
)	O
</s>
<s>
This	O
was	O
so	O
successful	O
that	O
application	O
software	B-Application
and	O
operating	B-General_Concept
system	I-General_Concept
software	B-Application
above	O
the	O
LIC	O
layer	O
that	O
were	O
compiled	B-Language
on	O
the	O
original	O
S/38	B-Device
run	O
without	O
modification	O
and	O
without	O
recompilation	O
on	O
the	O
latest	O
AS/400	B-Device
systems	O
,	O
despite	O
the	O
fact	O
that	O
the	O
underlying	O
hardware	B-Architecture
has	O
been	O
changed	O
dramatically	O
;	O
at	O
least	O
three	O
different	O
types	O
of	O
processors	O
have	O
been	O
in	O
use	O
.	O
</s>
<s>
Android	B-Application
introduced	O
a	O
HAL	B-Application
known	O
as	O
the	O
"	O
vendor	O
interface	O
"	O
(	O
codenamed	O
"	O
Project	O
Treble	O
"	O
)	O
on	O
version	B-Application
8.0	I-Application
"	I-Application
Oreo	I-Application
"	I-Application
.	O
</s>
<s>
It	O
abstracts	O
low-level	O
code	O
from	O
the	O
Android	B-Application
OS	I-Application
framework	O
,	O
and	O
they	O
must	O
be	O
made	O
forward	B-General_Concept
compatible	I-General_Concept
to	O
support	O
future	O
versions	O
of	O
Android	B-Application
to	O
ease	O
the	O
development	O
of	O
firmware	B-Application
updates	O
.	O
</s>
<s>
Before	O
Project	O
Treble	O
Android	B-Application
relied	O
on	O
various	O
non-standardized	O
legacy	O
HALs	B-Application
.	O
</s>
<s>
Halium	B-Application
is	O
an	O
Android-based	O
HAL	B-Application
used	O
by	O
several	O
mobile	O
operating	B-General_Concept
systems	I-General_Concept
such	O
as	O
Ubuntu	B-Protocol
Touch	I-Protocol
and	O
LuneOS	B-Application
to	O
run	O
on	O
smartphones	O
with	O
Android	B-Application
pre-installed	O
.	O
</s>
