REBOL 3.0

Comments on: So, do you want RESET?

Carl Sassenrath, CTO
REBOL Technologies
10-Oct-2010 0:35 GMT

Article #0340
Main page || Index || Prior Article [0339] || Next Article [0341] || 18 Comments || Send feedback

Long ago, in what seems like a galaxy far far away, REBOL had a reset function... it was a sort of warm-reboot that restarted REBOL without requiring the exe to be reloaded. This function was added because Jeff Kreis created an Apache web server module for REBOL, and it needed to run "fresh" for each new server request. Quite handy.

Although I'm not considering adding such a function this week (there are higher priorities), I want you to think about it a little... and some of you guru's will recognize that such a function is actually on the road to multi-tasked REBOL environments.

To add a function like reset we need to define the baseline to which the system resets. Then, everything below the baseline must be protected (immutable). Of course, some values, like the system object can be mutable and just get rebuilt as part of the reset.

One method would be to use a checkpoint function that would clone a copy of the lib context and protect the entire base. The checkpoint allows you to import various modules and get things setup for your baseline, then mark that for rolling back to later.

When the reset occurs, the user context would get cleared and the lib context would be reset to the check-pointed values. That way you have a fresh environment setup exactly how you want it.

Of course, all data and functions below the checkpoint would need to be protected (made immutable), but the entire algorithm could probably be implemented in about a dozen lines of gurumezz code. In addition, we'd want the mutable parts of the system object to be rebuilt, but that's not difficult.

So... the hard part is designing the base to be immutable. That is, functions and objects must not store state.

But, wait... now you found me out! That's the same requirement needed for R3's lightweight multitasking model, isn't it? In essence, if we do one, we get the other (mostly) for free.

Ok, why do I mention any of this? Because to move to beta, this is one big old check-box we need to mark off.

The time is near. Keep it simple and clear. (Sorry... the Cabernet fermentation fumes must be getting to my head.)

18 Comments

Comments:

Brian Hawley
11-Oct-2010 1:33:28
Sounds good to me. I used the Apache module you mentioned back in the 20th, and it was quite handy. As multitasking will be handy now. Go for it!
Maarten Koopmans
11-Oct-2010 2:18:12
+1 from me! This will allow you to have "light weight threadpools".

I would NOT do it if the creation of a thread + it's GC is cheaper then 'reset , but I doubt that it will be more expensive. And, 'reset will allow threads/tasks/... on embedded devices much more easily (especially if you can control things like pool size etc.)

-pekr-
11-Oct-2010 3:25:59
Whatever to get us "tasking". I can see Maartin here, the big fan of green tasking (hello Rugby :-). I am not much educated at the topic, so I just hope you guys choose the right model, but so far it sounds suspicious to me, that spawning new thread/task would be cheaper than resetting the REBOL internals.

We should not think only about the embedded world, but we should look into the future. Multi CPU world is kind of dead, I think multi-core multi-threaded CPUs are here to stay for some time ...

Maarten
11-Oct-2010 7:27:28
...not a big fan of green tasking in the age of multicores per se. The question on the table is whether multicore extensions can be moved to the host library, I think...
Maxim Olivier-Adlhoch
11-Oct-2010 10:16:56
I really like the checkpoint reset model.

It would make it easy to build GDC like thread models. where you pre-allocate a few threads and give them small tasks to do within a safe environment.

If the checkpoint reset allows us to share memory safely, then that might be really effective.

paul personne
12-Oct-2010 9:35:32
-1 For me. I think it would be better to start another interpreter process and pass the usefull parameters and eventually kill the first process. Or something like this, because I think rebol is light enough to be regarded in itself as a thread (one powerfull thread).
Brian Hawley
12-Oct-2010 17:11:49
Paul, process creation has a lot of overhead on some platforms, particularly Windows. And setting up the runtime environment inside the process has even more overhead. If some of that overhead can be spared it will be a big win, especially for apps with worker processes like Cheyenne. Individual cores are getting less powerful, even if the number of cores is increasing. On a 16-core system, having 16 reusable worker processes can be really helpful.

On other platforms there is no such thing as "lightweight enough", particularly mobile systems, or massively multiprocess servers. These techniques will also allow us to premake and serialize certain parts of the runtime, or put them into shared memory.

Kaj
13-Oct-2010 9:20:51
Seems to me to be an entirely logical extension for a language virtual machine.

Low-level process creation in operating systems can count on the CPU cores being there - even though they may contain their own microcode programs, and they have to be initialised at machine startup.

Thread creation can count on the parent process already being there, so thread creation is lighter than process creation.

If you're programming in a high-level language virtual machine, concurrency is lightest weight if task creation can count on a pool of virtual machines already being there, mapped to either processes or threads to make use of hardware cores and operating system threads.

paul personne
13-Oct-2010 17:31:24
Brian you are right, I have neglected this aspect in the creation process. Because I thought basic level boot that reminded me of the appearance of self-compiled Forth that I loved so much ... nostalgia, nostalgia.
RAD
14-Oct-2010 7:59:16
"warm-reboot" ? what good is it if theres No RAD (protected re-entry to a Recoverable rAm Drive), No generic Open message passing at the lowest levels, and No API for Massive Multi Cpu TCP:IP/UDP personal clouds of the future, or am i missing something and everyones looking to play the constant game of catchup instead of innovate
rad
14-Oct-2010 8:01:20
"warm-reboot" ? what good is it if theres No RAD (protected re-entry to a Recoverable rAm Drive), No generic Open message passing at the lowest levels, and No API for Massive Multi Cpu TCP:IP/UDP personal clouds of the future, or am i missing something and everyones looking to play the constant game of catchup instead of innovate.
Kaj
14-Oct-2010 9:49:04
The innovation of REBOL is in redoing an operating and language platform in terms of the REBOL language. Of course you'll be playing catchup in operating system terms until that's done.
-pekr-
15-Oct-2010 5:06:08
Kaj, not sure I understand your message. Are you trying to suggest, that REBOL is like the OS, and it will have REBOL level (not hosted-on OS level) concurrency? I, as well as RAD, don't expect it to be so - AmigaOS was message passing OS. QNX is a king here. And I want REBOL being a king too, not just second-league = use-only-to-play-with-because-slow-and-not-scalling-well technology, hence providing advanced way of IPC.
Kaj
15-Oct-2010 15:58:45
Carl is talking about the R3 multitasking model, so that's about REBOL level concurrency. I'm talking about how that compares to OS level concurrency. Whether they are going to be integrated is a separate issue, but I said: "mapped to either processes or threads to make use of hardware cores and operating system threads." How all those tasks are going to communicate is a third issue altogether.
paul personne
20-Oct-2010 4:03:12
Kaj the problem with your proposal and about i was thinking when i say "start another interpreter process": how many deamon you will launch? create the necessary to order this kind of multi-tasking...That drives Rebol to far in research about languages (even if i appreciate pioneer approch) while rebol should stay usable..
Kaj
20-Oct-2010 22:30:15
What proposal did I make? I just reflected on Carl's notes.
Supra shoes for girls
12-Jul-2012 22:55:42
The Supra shoes for girls Asia this training camp lineup,More than 50 players from China, Hong Kong, China, Chinese Taipei, Japan, Korea, Australia and other countries and regions,Players in the Supra shoes for girls list, we are familiar with the noble, Supra shoes for girls and consultant in the lineup, not only have Yi Jianlian, Gay and DeRozan and the other two NBA players, as well as the former coach of the United Arab O'Connor, and Chinese star Du Feng and so on.
Gucci sneakers store
17-Jul-2012 22:38:14
All Gucci sneakers store is made from superior material and crafted carefully and intricately to ensure the best quality. Gucci shoes are some of the finest designer shoes on today's market. As leaders in high fashion, Gucci sneakers store's line always features the latest, most stylish shoes. As they are high in demand and well-made, Gucci sneakers are always available in expensive prices. You can, however, find more affordable Gucci shoes, if you know where to look. So searching on internet is really a good option to find your favorite pair of Gucci Sneakers. You could also find some great discounts if you are lucky and finding the most wanted brand while sitting at home is really a good experience for anybody.

Post a Comment:

You can post a comment here. Keep it on-topic.

Name:

Blog id:

R3-0340


Comment:


 Note: HTML tags allowed for: b i u li ol ul font span div a p br pre tt blockquote
 
 

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

REBOL 3.0
Updated 20-Apr-2024 - Edit - Copyright REBOL Technologies - REBOL.net