)savesystem, third time

7 views
Skip to first unread message

Qian Yun

unread,
Sep 23, 2024, 8:34:38 AM9/23/24
to fricas-devel
The previous discussion was titled ")savesystem , again",
in 2016/Jun/18:
https://groups.google.com/g/fricas-devel/c/o-P2kKKdGsM/m/T9Dr7bMRAQAJ

After my recent experiences with the low-level stuff
in FriCAS, I have the following thoughts:

We already can use ")fin" to Lisp level and "(BOOT::|spad|)"
to go back to SPAD level. What if we insert the "savesystem"
between them?

We can save the whole state of FriCAS and restore it later.

1. Run fricas with -nosman. (Avoids socket operation for now.)

fricas -nosman

2. Assign some variables, run some computations.

3. Run the following to save a new executable "saved".

)lisp (sb-ext:save-lisp-and-die "saved" :executable t :toplevel
#'BOOT::|spad|)

4. Now you can continue by "./saved".

Notes:

1. It will fail when you issue commands that needs new domains.
Because the file descriptor to *.daase is closed. This should
be easy to fix.

2. Our old code calls "|fricas_restart|" as ":toplevel" entry
function, this caused the wipe of variables and context.
Now if we call "|spad|", then problem is solved.

- Qian

Waldek Hebisch

unread,
Nov 30, 2024, 6:38:21 PM11/30/24
to fricas...@googlegroups.com
Hmm, I am not sure what you really propose. The trouble with
previous attempt at ')savesystem' was restoring frames. Now
you apparently propose running only in inital frame (that
is with '-nosman').

People messing with low level aspects of FriCAS can use functions
for saving images and manually clean up/correct discrepancies.
For normal users we need things that "work out of the box" and
nobody was willing to spend time resolving problems.

More precisely, to make ')savesytem' work somebody would have to
go trough FriCAS initialization sequence and work out which parts
of initialization should be re-done. Do too little and some things
will fail. Do too much and different things will fail (frame
problem was doing too much).

--
Waldek Hebisch

Qian Yun

unread,
Dec 5, 2024, 7:54:53 AM12/5/24
to fricas...@googlegroups.com
On 12/1/24 7:38 AM, Waldek Hebisch wrote:
>
> Hmm, I am not sure what you really propose. The trouble with
> previous attempt at ')savesystem' was restoring frames. Now
> you apparently propose running only in inital frame (that
> is with '-nosman').

I run with '-nosman' to avoid socket related functions.

Try the following and you can see that frames are working
as expected:

(1) -> )set mes prompt frame
initial (1) -> )frame names
The names of the existing frames are:
initial
The current frame is the first one listed.
initial (1) -> )frame new a
a (1) -> )frame next
initial (1) -> x := 1

(1) 1
Type:
PositiveInteger
initial (2) -> )frame next
a (1) -> x

(1) x
Type:
Variable(x)
a (2) -> x := 2

(2) 2
Type:
PositiveInteger
a (3) -> )lisp (sb-ext:save-lisp-and-die "saved" :executable t :toplevel
#'BOOT::|spad|)

oldk1331@localhost:~/tmp> ./saved
a (3) -> x

(3) 2
Type:
PositiveInteger
a (4) ->
a (4) -> )frame next
initial (2) -> x

(2) 1
Type:
PositiveInteger
initial (3) -> )q


> People messing with low level aspects of FriCAS can use functions
> for saving images and manually clean up/correct discrepancies.
> For normal users we need things that "work out of the box" and
> nobody was willing to spend time resolving problems.

Yes, I'm planning to do that, making ')savesystem' work out of box.

> More precisely, to make ')savesytem' work somebody would have to
> go trough FriCAS initialization sequence and work out which parts
> of initialization should be re-done. Do too little and some things
> will fail. Do too much and different things will fail (frame
> problem was doing too much).
>

It's good to know there're no other objections in principle.
I'll try to work out the details then.

- Qian

Waldek Hebisch

unread,
Dec 7, 2024, 7:27:43 PM12/7/24
to fricas...@googlegroups.com
On Thu, Dec 05, 2024 at 08:54:47PM +0800, Qian Yun wrote:
> On 12/1/24 7:38 AM, Waldek Hebisch wrote:
> >
> > Hmm, I am not sure what you really propose. The trouble with
> > previous attempt at ')savesystem' was restoring frames. Now
> > you apparently propose running only in inital frame (that
> > is with '-nosman').
>
> I run with '-nosman' to avoid socket related functions.

Well:

1) '-nosman' is severe restriction on usablity
2) '-nosman' masks problem with frames, that is when sman is
active FriCAS creates extra frame at statup nad the problem
was due to this frame.
My view on ')savesystem' is that this is low-need feature which
requires some (not big) work to implement properly. Concerning
"properly", preferably all FriCAS features should work
together. In case of ')savesystem' I do not think we can
implement it for ECL and that is acceptable if we clearly
state that it does not work with ECL. However, only
working with '-nosman' is severe restriction. Simply,
such restriction lead to internal fragmentation of the
project and are harmful in long term.

To be clear, "perfect" version would restore graphic windows
and open HyperDoc windows. I do not think this is necessary.
But, when user wants it restored system should be graphic
and/or HyperDoc capable.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages