<s>
PCLSRing	B-Operating_System
(	O
also	O
known	O
as	O
Program	O
Counter	O
Lusering	O
)	O
is	O
the	O
term	O
used	O
in	O
the	O
ITS	B-Application
operating	I-Application
system	I-Application
for	O
a	O
consistency	O
principle	O
in	O
the	O
way	O
one	O
process	B-Operating_System
accesses	O
the	O
state	B-Application
of	O
another	O
process	B-Operating_System
.	O
</s>
<s>
Process	B-Operating_System
A	O
makes	O
a	O
time-consuming	O
system	O
call	O
.	O
</s>
<s>
By	O
"	O
time-consuming	O
"	O
,	O
it	O
is	O
meant	O
that	O
the	O
system	O
needs	O
to	O
put	O
Process	B-Operating_System
A	O
into	O
a	O
wait	O
queue	O
and	O
can	O
schedule	O
another	O
process	B-Operating_System
for	O
execution	O
if	O
one	O
is	O
ready-to-run	O
.	O
</s>
<s>
A	O
common	O
example	O
is	O
an	O
I/O	B-General_Concept
operation	I-General_Concept
.	O
</s>
<s>
While	O
Process	B-Operating_System
A	O
is	O
in	O
this	O
wait	O
state	B-Application
,	O
Process	B-Operating_System
B	O
tries	O
to	O
interact	O
with	O
or	O
access	O
Process	B-Operating_System
A	O
,	O
for	O
example	O
,	O
send	O
it	O
a	O
signal	B-Operating_System
.	O
</s>
<s>
What	O
should	O
be	O
the	O
visible	O
state	B-Application
of	O
the	O
context	B-Operating_System
of	O
Process	B-Operating_System
A	O
at	O
the	O
time	O
of	O
the	O
access	O
by	O
Process	B-Operating_System
B	O
?	O
</s>
<s>
In	O
fact	O
,	O
Process	B-Operating_System
A	O
is	O
in	O
the	O
middle	O
of	O
a	O
system	O
call	O
,	O
but	O
ITS	O
enforces	O
the	O
appearance	O
that	O
system	O
calls	O
are	O
not	O
visible	O
to	O
other	O
processes	O
(	O
or	O
even	O
to	O
the	O
same	O
process	B-Operating_System
)	O
.	O
</s>
<s>
This	O
means	O
that	O
the	O
context	B-Operating_System
is	O
backed	O
up	O
to	O
the	O
point	O
of	O
entry	O
to	O
the	O
system	O
call	O
,	O
while	O
the	O
call	O
arguments	O
are	O
updated	O
to	O
reflect	O
whatever	O
portion	O
of	O
the	O
operation	O
has	O
already	O
been	O
completed	O
.	O
</s>
<s>
For	O
an	O
I/O	B-General_Concept
operation	I-General_Concept
,	O
this	O
means	O
that	O
the	O
buffer	O
start	O
address	O
must	O
be	O
advanced	O
over	O
the	O
data	O
already	O
transferred	O
,	O
while	O
the	O
length	O
of	O
data	O
to	O
be	O
transferred	O
must	O
be	O
decremented	O
accordingly	O
.	O
</s>
<s>
After	O
the	O
Process	B-Operating_System
B	O
interaction	O
is	O
complete	O
,	O
Process	B-Operating_System
A	O
can	O
resume	O
execution	O
,	O
and	O
the	O
system	O
call	O
resumes	O
from	O
where	O
it	O
left	O
off	O
.	O
</s>
<s>
This	O
technique	O
mirrors	O
in	O
software	O
what	O
the	O
PDP-10	B-Device
does	O
in	O
hardware	O
.	O
</s>
<s>
Some	O
PDP-10	B-Device
instructions	O
like	O
BLT	O
may	O
not	O
run	O
to	O
completion	O
,	O
either	O
due	O
to	O
an	O
interrupt	O
or	O
a	O
page	O
fault	O
.	O
</s>
<s>
In	O
the	O
course	O
of	O
processing	O
the	O
instruction	O
,	O
the	O
PDP-10	B-Device
would	O
modify	O
the	O
registers	O
containing	O
arguments	O
to	O
the	O
instruction	O
,	O
so	O
that	O
later	O
the	O
instruction	O
could	O
be	O
run	O
again	O
with	O
new	O
arguments	O
that	O
would	O
complete	O
any	O
remaining	O
work	O
to	O
be	O
done	O
.	O
</s>
<s>
PCLSRing	B-Operating_System
applies	O
the	O
same	O
technique	O
to	O
system	O
calls	O
.	O
</s>
<s>
For	O
example	O
,	O
memory	O
pages	O
in	O
User	O
space	O
may	O
not	O
be	O
paged	B-Architecture
out	I-Architecture
during	O
a	O
system	O
call	O
in	O
ITS	O
.	O
</s>
<s>
If	O
this	O
were	O
allowed	O
,	O
then	O
when	O
the	O
system	O
call	O
is	O
PCLSRed	O
and	O
tries	O
to	O
update	O
the	O
arguments	O
so	O
the	O
call	O
can	O
be	O
aborted	O
,	O
the	O
page	O
containing	O
the	O
arguments	O
might	O
not	O
be	O
present	O
,	O
and	O
the	O
system	O
call	O
would	O
have	O
to	O
block	O
,	O
preventing	O
the	O
PCLSR	B-Operating_System
from	O
succeeding	O
.	O
</s>
<s>
To	O
prevent	O
this	O
,	O
ITS	O
does	O
n't	O
allow	O
memory	O
pages	O
in	O
User	O
space	O
to	O
be	O
paged	B-Architecture
out	I-Architecture
after	O
they	O
're	O
first	O
accessed	O
during	O
a	O
system	O
call	O
,	O
and	O
system	O
calls	O
typically	O
start	O
by	O
touching	O
pages	O
in	O
User	O
space	O
they	O
know	O
they	O
will	O
need	O
to	O
access	O
.	O
</s>
<s>
Contrast	O
this	O
with	O
the	O
approach	O
taken	O
in	O
the	O
UNIX	B-Application
operating	I-Application
system	I-Application
,	O
where	O
there	O
is	O
restartability	O
,	O
but	O
it	O
is	O
not	O
transparent	O
.	O
</s>
<s>
Instead	O
,	O
an	O
I/O	B-General_Concept
operation	I-General_Concept
returns	O
the	O
number	O
of	O
bytes	O
actually	O
transferred	O
(	O
or	O
the	O
EINTR	B-Error_Name
error	O
if	O
the	O
operation	O
was	O
interrupted	O
before	O
any	O
bytes	O
were	O
actually	O
transferred	O
)	O
,	O
and	O
it	O
is	O
up	O
to	O
the	O
application	O
to	O
check	O
this	O
and	O
manage	O
its	O
own	O
resumption	O
of	O
the	O
operation	O
until	O
all	O
the	O
bytes	O
have	O
been	O
transferred	O
.	O
</s>
<s>
In	O
the	O
philosophy	B-Operating_System
of	I-Operating_System
UNIX	I-Operating_System
,	O
this	O
was	O
given	O
by	O
Richard	O
P	O
.	O
Gabriel	O
as	O
an	O
example	O
of	O
the	O
"	O
worse	O
is	O
better	O
"	O
principle	O
.	O
</s>
<s>
It	O
is	O
apparent	O
in	O
the	O
above	O
that	O
the	O
system	O
call	O
has	O
to	O
be	O
synchronous	O
—	O
that	O
is	O
,	O
the	O
calling	O
process	B-Operating_System
has	O
to	O
wait	O
for	O
the	O
operation	O
to	O
complete	O
.	O
</s>
<s>
This	O
is	O
not	O
inevitable	O
:	O
in	O
the	O
OpenVMS	B-Operating_System
operating	O
system	O
,	O
all	O
I/O	B-General_Concept
and	O
other	O
time-consuming	O
operations	O
are	O
inherently	O
asynchronous	O
,	O
which	O
means	O
the	O
semantics	O
of	O
the	O
system	O
call	O
is	O
"	O
start	O
the	O
operation	O
,	O
and	O
perform	O
one	O
or	O
more	O
of	O
these	O
notifications	O
when	O
it	O
completes	O
"	O
after	O
which	O
it	O
returns	O
immediately	O
to	O
the	O
caller	O
.	O
</s>
<s>
There	O
is	O
a	O
standard	O
set	O
of	O
available	O
notifications	O
(	O
such	O
as	O
set	O
an	O
event	B-Operating_System
flag	I-Operating_System
,	O
or	O
deliver	O
an	O
asynchronous	B-Operating_System
system	I-Operating_System
trap	I-Operating_System
)	O
,	O
as	O
well	O
as	O
a	O
set	O
of	O
system	O
calls	O
for	O
explicitly	O
suspending	O
the	O
process	B-Operating_System
while	O
waiting	O
for	O
these	O
,	O
which	O
are	O
a	O
)	O
fully	O
restartable	O
in	O
the	O
ITS	O
sense	O
,	O
and	O
b	O
)	O
much	O
smaller	O
in	O
number	O
than	O
the	O
set	O
of	O
actual	O
time-consuming	O
system	O
calls	O
.	O
</s>
<s>
OpenVMS	B-Operating_System
provides	O
alternative	O
"	O
start	O
operation	O
and	O
wait	O
for	O
completion	O
"	O
synchronous	O
versions	O
of	O
all	O
time-consuming	O
system	O
calls	O
.	O
</s>
<s>
These	O
are	O
implemented	O
as	O
"	O
perform	O
the	O
actual	O
asynchronous	O
operation	O
"	O
followed	O
by	O
"	O
wait	O
until	O
the	O
operation	O
sets	O
the	O
event	B-Operating_System
flag	I-Operating_System
"	O
.	O
</s>
<s>
Any	O
access	O
to	O
the	O
process	B-Operating_System
context	B-Operating_System
during	O
this	O
time	O
will	O
see	O
it	O
about	O
to	O
(	O
re	O
)	O
enter	O
the	O
wait-for-event-flag	O
call	O
.	O
</s>
