[Date Index]
[Thread Index]
[Author Index]
Remark on closing the lernel
*To*: mathgroup at smc.vnet.net
*Subject*: [mg122127] Remark on closing the lernel
*From*: Fred Simons <f.h.simons at tue.nl>
*Date*: Sun, 16 Oct 2011 07:04:37 -0400 (EDT)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
The following is a highly irrelevant and completely unimportant report
on a difference between closing the kernel by evaluation of the command
Quit[] or by the frontend using the evaluation menu. The reason for
nevertheless publishing it, is that there might be others like me, who
consider such differences as interesting.
Evaluation of a cell with the next two lines
Dynamic[b]
Dynamic[b=RandomReal[], UpdateInterval->1]
results in two dynamic output cells, both showing the current value of
the kernel variable b. Every second the displayed value changes.
When we quit the kernel by evaluating a cell with the command Quit[],
then both output cells still show the same value. But when we quit the
kernel by pressing alt-v-q, the two output cells display differently:
the first one shows the name of the variable, b, and the second one a
number.
The following is maybe an incorrect, but anyway incomplete explanation.
Any comment is welcome.
Roughly, the updating mechanism is as follows. When the kernel changes
the value of the variable b, it sends a message to the frontend that the
value changed. Having received this message, the frontend will update
the corresponding cells by asking the kernel for the current value of b
and then adapting the display of these cells.
When we close the kernel by the sending the command Quit[] through the
frontend to the kernel, then the kernel will close, but the frontend is
unaware of that. The frontend does not receive any message on the
variable b, so the display is unchanged.
It seems that for identification of the kernel the frontend uses
something like $ProcessID, for when we restart the kernel e.g. by giving
the command b=13, the new kernel has a different $ProcessID and nothing
happens with the two dynamic output cells above.
Now evaluate the above input cell once again, and then close the kernel
with alt-v-q or similarly. This is a different situation. The frontend
now knows that the kernel will close. So it not only closes the kernel,
but also removes the connection between the frontend variable
$CellContext`b and the kernel variable b. Therefore, in the first output
cell the name b turns up. In the second output cell the value for that
$CellContext`b is maintained.
When we restart the kernel by giving the command b=13, then in the first
output cell the frontend restores the connection between the variable b
and the new kernel; the value 13 is displayed. But for some or other
reason this does not happen in the second output cell. It might be that
the Set command in that cell refers to the function RandomReal in the
previous kernel, that cannot be called any more, so that a new
assignment is impossible.
Fred Simons
Eindhoven University of Technology
Prev by Date:
**Re: Constructing a huge graph**
Next by Date:
**Re: Only real data**
Previous by thread:
**A possible typo in the program of "Mathematica Navigator" by Heikki**
Next by thread:
**Levene and BrownForsythe Tests**
| |