<s>
In	O
the	O
X	B-Operating_System
Window	I-Operating_System
System	I-Operating_System
,	O
an	O
X	B-Device
session	I-Device
manager	I-Device
is	O
a	O
session	B-Protocol
management	I-Protocol
program	O
,	O
a	O
program	O
that	O
can	O
save	O
and	O
restore	O
the	O
current	O
state	B-Application
of	O
a	O
set	O
of	O
running	O
applications	O
,	O
including	O
window	B-Application
manager	I-Application
.	O
</s>
<s>
From	O
the	O
point	O
of	O
view	O
of	O
an	O
X	B-Device
session	I-Device
manager	I-Device
,	O
a	O
session	O
is	O
a	O
“	O
state	B-Application
of	O
the	O
desktop	O
”	O
at	O
a	O
given	O
time	O
:	O
a	O
set	O
of	O
windows	O
with	O
their	O
current	O
content	O
.	O
</s>
<s>
The	O
most	O
recognizable	O
effect	O
of	O
using	O
a	O
session	O
manager	O
is	O
the	O
possibility	O
of	O
logging	O
out	O
from	O
an	O
interactive	O
session	O
and	O
then	O
finding	O
exactly	O
the	O
same	O
windows	O
in	O
the	O
same	O
state	B-Application
when	O
logging	O
in	O
again	O
.	O
</s>
<s>
Moreover	O
,	O
for	O
the	O
state	B-Application
of	O
the	O
applications	O
to	O
be	O
restored	O
as	O
well	O
(	O
which	O
is	O
needed	O
to	O
restore	O
the	O
content	O
of	O
windows	O
)	O
,	O
the	O
applications	O
must	O
be	O
able	O
to	O
save	O
their	O
state	B-Application
of	O
execution	O
upon	O
request	O
from	O
the	O
session	O
manager	O
and	O
load	O
it	O
back	O
when	O
started	O
again	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
the	O
user	O
has	O
the	O
possibility	O
of	O
saving	O
a	O
set	O
of	O
different	O
sessions	O
,	O
either	O
by	O
storing	O
the	O
state	B-Application
of	O
execution	O
of	O
the	O
currently	O
running	O
applications	O
or	O
by	O
explicitly	O
listing	O
the	O
applications	O
that	O
compose	O
a	O
session	O
.	O
</s>
<s>
In	O
order	O
for	O
a	O
session	O
to	O
include	O
the	O
state	B-Application
of	O
an	O
application	O
,	O
the	O
application	O
must	O
be	O
able	O
to	O
store	O
and	O
load	O
its	O
current	O
state	B-Application
when	O
session	O
manager	O
request	O
to	O
do	O
so	O
(	O
usually	O
on	O
user	O
login	O
or	O
logout	O
)	O
.	O
</s>
<s>
A	O
protocol	O
named	O
X	B-Operating_System
Session	B-Protocol
Management	I-Protocol
Protocol	O
(	O
XSMP	B-Device
)	O
specifies	O
how	O
applications	O
and	O
session	O
managers	O
interact	O
.	O
</s>
<s>
The	O
XSMP	B-Device
message	O
format	O
is	O
the	O
same	O
as	O
Interactive	O
Connectivity	O
Establishment	O
(	O
ICE	O
)	O
message	O
format	O
.	O
</s>
<s>
Of	O
particular	O
importance	O
is	O
that	O
the	O
window	B-Application
manager	I-Application
is	O
able	O
to	O
communicate	O
with	O
the	O
session	O
manager	O
,	O
as	O
the	O
window	B-Application
manager	I-Application
is	O
responsible	O
for	O
the	O
placement	O
of	O
windows	O
and	O
the	O
existence	O
of	O
icons	O
.	O
</s>
<s>
Applications	O
that	O
cannot	O
store	O
their	O
state	B-Application
can	O
be	O
included	O
in	O
a	O
session	O
,	O
but	O
they	O
do	O
not	O
preserve	O
their	O
state	B-Application
across	O
sessions	O
.	O
</s>
<s>
The	O
XSMP	B-Device
is	O
a	O
subprotocol	O
of	O
the	O
Inter-Client	B-Device
Exchange	I-Device
Protocol	I-Device
.	O
</s>
<s>
in	O
order	O
for	O
a	O
session	O
to	O
be	O
restarted	O
properly	O
,	O
not	O
only	O
the	O
applications	O
running	O
in	O
it	O
must	O
be	O
restarted	O
,	O
but	O
they	O
must	O
also	O
be	O
restarted	O
in	O
such	O
a	O
way	O
they	O
restore	O
their	O
previous	O
state	B-Application
;	O
</s>
<s>
For	O
example	O
,	O
the	O
user	O
may	O
have	O
launched	O
a	O
text	B-Application
editor	I-Application
on	O
file	O
/etc/passwd	O
,	O
then	O
on	O
file	O
letter.txt	O
in	O
the	O
same	O
session	O
,	O
and	O
then	O
on	O
file	O
todo.txt	O
in	O
another	O
session	O
.	O
</s>
<s>
This	O
way	O
,	O
the	O
session	O
manager	O
is	O
able	O
to	O
distinguish	O
between	O
the	O
text	B-Application
editor	I-Application
that	O
is	O
running	O
on	O
/etc/passwd	O
and	O
the	O
text	B-Application
editor	I-Application
running	O
on	O
todo.txt	O
,	O
even	O
if	O
they	O
are	O
two	O
instances	O
of	O
the	O
same	O
program	O
.	O
</s>
<s>
In	O
particular	O
,	O
they	O
must	O
be	O
unique	O
across	O
all	O
sessions	O
managed	O
by	O
the	O
session	O
manager	O
:	O
the	O
identifier	O
of	O
the	O
text	B-Application
editor	I-Application
running	O
on	O
/etc/passwd	O
is	O
different	O
not	O
only	O
from	O
the	O
same	O
text	B-Application
editor	I-Application
running	O
on	O
letter.txt	O
but	O
also	O
different	O
from	O
the	O
text	B-Application
editor	I-Application
running	O
on	O
todo.txt	O
in	O
another	O
session	O
.	O
</s>
<s>
The	O
main	O
parts	O
of	O
the	O
protocol	O
of	O
session	B-Protocol
management	I-Protocol
are	O
:	O
</s>
<s>
The	O
last	O
point	O
is	O
possible	O
because	O
the	O
session	O
manager	O
maintains	O
a	O
set	O
of	O
properties	O
for	O
every	O
client	O
(	O
in	O
the	O
X	B-Operating_System
Window	I-Operating_System
System	I-Operating_System
terminology	O
,	O
a	O
property	O
is	O
simply	O
a	O
container	O
for	O
data	O
)	O
.	O
</s>
<s>
When	O
the	O
session	O
manager	O
requests	O
a	O
client	O
to	O
save	O
its	O
state	B-Application
,	O
the	O
application	O
proceeds	O
as	O
follows	O
:	O
</s>
<s>
When	O
asking	O
a	O
client	O
to	O
save	O
its	O
state	B-Application
,	O
the	O
window	B-Application
manager	I-Application
can	O
specify	O
whether	O
the	O
local	O
or	O
global	O
state	B-Application
(	O
or	O
both	O
)	O
has	O
to	O
be	O
saved	O
.	O
</s>
<s>
In	O
the	O
case	O
of	O
the	O
text	B-Application
editor	I-Application
,	O
saving	O
the	O
global	O
state	B-Application
means	O
saving	O
the	O
file	O
normally	O
,	O
so	O
that	O
other	O
applications	O
can	O
use	O
the	O
new	O
version	O
of	O
the	O
file	O
.	O
</s>
<s>
Saving	O
the	O
local	O
state	B-Application
means	O
that	O
a	O
local	O
copy	O
of	O
the	O
file	O
has	O
to	O
be	O
saved	O
,	O
so	O
that	O
other	O
applications	O
can	O
see	O
the	O
file	O
in	O
its	O
original	O
version	O
.	O
</s>
<s>
The	O
following	O
are	O
the	O
main	O
steps	O
in	O
the	O
interaction	O
of	O
a	O
session	O
manager	O
with	O
the	O
hypothetical	O
text	B-Application
editor	I-Application
xyz	O
when	O
this	O
application	O
is	O
started	O
for	O
the	O
first	O
time	O
in	O
a	O
session	O
,	O
then	O
the	O
user	O
logs	O
out	O
and	O
then	O
in	O
again	O
:	O
</s>
<s>
When	O
the	O
client	O
is	O
told	O
to	O
save	O
its	O
state	B-Application
,	O
it	O
may	O
have	O
the	O
possibility	O
of	O
having	O
a	O
limited	O
interaction	O
with	O
the	O
user	O
or	O
not	O
(	O
for	O
example	O
,	O
to	O
ask	O
the	O
user	O
if	O
the	O
edited	O
file	O
is	O
to	O
be	O
saved	O
)	O
.	O
</s>
<s>
Anyway	O
,	O
the	O
state	B-Application
is	O
saved	O
,	O
it	O
tells	O
the	O
session	O
manager	O
by	O
sending	O
an	O
appropriate	O
message	O
)	O
.	O
</s>
<s>
According	O
to	O
the	O
XSMP	B-Device
protocol	O
,	O
a	O
session	O
manager	O
is	O
an	O
arbitrary	O
program	O
(	O
server	O
)	O
that	O
runs	O
and	O
controls	O
the	O
state	B-Application
of	O
other	O
applications	O
.	O
</s>
<s>
For	O
example	O
,	O
a	O
mail	B-Protocol
client	I-Protocol
can	O
start	O
a	O
text	B-Application
editor	I-Application
for	O
the	O
sake	O
of	O
writing	O
an	O
email	O
,	O
and	O
behave	O
as	O
a	O
session	O
manager	O
with	O
respect	O
to	O
the	O
editor	O
.	O
</s>
<s>
This	O
way	O
,	O
if	O
the	O
mail	B-Protocol
client	I-Protocol
is	O
closed	O
and	O
then	O
restarted	O
again	O
,	O
it	O
can	O
restore	O
the	O
state	B-Application
of	O
the	O
text	B-Application
editor	I-Application
.	O
</s>
<s>
The	O
X	B-Operating_System
Window	I-Operating_System
System	I-Operating_System
includes	O
a	O
default	O
session	O
manager	O
called	O
xsm	O
.	O
</s>
<s>
is	O
a	O
default	O
session	O
manager	O
of	O
KDE	B-Language
Plasma	I-Language
5	I-Language
Desktop	I-Language
environment	I-Language
.	O
</s>
<s>
program	O
is	O
a	O
default	O
X	B-Device
Session	I-Device
Manager	I-Device
for	O
Xfce	B-Language
based	O
DEs	O
.	O
</s>
<s>
Xfce	B-Language
allows	O
to	O
create	O
different	O
sessions	O
and	O
choose	O
them	O
at	O
startup	O
.	O
</s>
<s>
Gnome	O
has	O
supported	O
XSMP	B-Device
since	O
v1.x	O
.	O
</s>
<s>
2013	O
GNOME	O
had	O
intention	O
to	O
replace	O
GNOME	O
session	O
manager	O
XSMP	B-Device
with	O
a	O
D-Bus	B-Language
interface	O
in	O
version	O
2.24	O
.	O
</s>
<s>
As	O
of	O
2021	O
the	O
codebase	O
still	O
includes	O
X	B-Device
session	I-Device
manager	I-Device
clients	O
.	O
</s>
