Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #29039 > unrolled thread

how do you take all data in memory and write to disk for restoring state later?

Started bygavino_himself <visploveslisp@gmail.com>
First post2014-03-14 02:06 -0700
Last post2014-04-09 14:40 +0200
Articles 18 — 10 participants

Back to article view | Back to comp.lang.forth


Contents

  how do you take all data in memory and write to disk for restoring state later? gavino_himself <visploveslisp@gmail.com> - 2014-03-14 02:06 -0700
    Re: how do you take all data in memory and write to disk for restoring state later? Hans Bezemer <the.beez.speaks@gmail.com> - 2014-03-14 17:45 +0100
    Re: how do you take all data in memory and write to disk for restoring state later? "Elizabeth D. Rather" <erather@forth.com> - 2014-03-14 08:53 -1000
    Re: how do you take all data in memory and write to disk for restoring state later? marko <marko@marko.marko> - 2014-03-19 22:35 +1100
    Re: how do you take all data in memory and write to disk for restoring state later? marko <marko@marko.marko> - 2014-03-19 22:39 +1100
    Re: how do you take all data in memory and write to disk for restoring state later? marko <marko@marko.marko> - 2014-03-19 22:45 +1100
    Re: how do you take all data in memory and write to disk for restoring state later? marko <marko@marko.marko> - 2014-03-19 22:47 +1100
    Re: how do you take all data in memory and write to disk for restoring state later? marko <marko@marko.marko> - 2014-03-19 23:00 +1100
      Re: how do you take all data in memory and write to disk for restoring state later? marko <marko@marko.marko> - 2014-03-19 23:23 +1100
    Ok you are pretty clearly totally clueless (was Re: how do you take all data in memory and write to disk for restoring state later?) marko <marko@marko.marko> - 2014-03-19 23:52 +1100
    Re: how do you take all data in memory and write to disk for restoring state later? Mark Wills <markwills1970@gmail.com> - 2014-03-20 01:35 -0700
      Re: how do you take all data in memory and write to disk for restoring state later? Spam@ControlQ.com - 2014-03-20 13:29 -0400
        Re: how do you take all data in memory and write to disk for restoring state later? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-03-20 18:27 -0400
          Re: how do you take all data in memory and write to disk for restoring state later? gavino_himself <visploveslisp@gmail.com> - 2014-04-05 19:39 -0700
        Re: how do you take all data in memory and write to disk for restoring state later? gavino_himself <visploveslisp@gmail.com> - 2014-04-05 19:36 -0700
          Re: how do you take all data in memory and write to disk for restoring state later? Jason Damisch <jasondamisch@yahoo.com> - 2014-04-07 13:50 -0700
            Re: how do you take all data in memory and write to disk for restoring state later? the_gavino_himself <visphatesjava@gmail.com> - 2014-04-09 04:39 -0700
          Re: how do you take all data in memory and write to disk for restoring state later? Melzzzzz <mel@zzzzz.com> - 2014-04-09 14:40 +0200

#29039 — how do you take all data in memory and write to disk for restoring state later?

Fromgavino_himself <visploveslisp@gmail.com>
Date2014-03-14 02:06 -0700
Subjecthow do you take all data in memory and write to disk for restoring state later?
Message-ID<1d0c008e-66c7-4b77-a424-01f77879f8d5@googlegroups.com>
in forth?

[toc] | [next] | [standalone]


#29042

FromHans Bezemer <the.beez.speaks@gmail.com>
Date2014-03-14 17:45 +0100
Message-ID<5323320d$0$2839$e4fe514c@news2.news.xs4all.nl>
In reply to#29039
gavino_himself wrote:

> in forth?
It's terribly simple in 4tH: you allocate memory structures in blocks. You
can use them very much like "ordinary" variables.

Hans Bezemer

13.11 Virtual memory

Although computers have lots of memory nowadays, you may find yourself in a
situation where you don't have enough memory to cater for your needs. In
that case you may resort to using 4tH's virtual memory library.

4tH's virtual memory library uses block files, so you may need to create one
before you can use it. Since block files are character-oriented you need to
include another library if you need numerical data:

include lib/vmem.4th 
include lib/ncoding.4th

That's all so let's define some variables and open the block file we created
previously:

variable n1 nell vallot latest ! does> paging ;
variable s1   32 vallot latest ! does> paging ; 
variable s2  128 vallot latest ! does> paging ; 
variable s3  512 vallot latest ! does> paging ;
variable s4  512 vallot latest ! does> paging ;

s" vmemtest.scr" open-blockfile

When setting this up, you have to take three things in consideration:  

1. Although it isn't required, you'd better define virtual memory variables
in order, from the smallest to the largest;  

2. The size of a virtual memory variable may not exceed "B/BUF" address
units;

3. You have to make sure that all data fits in the block  file. Take into
consideration that no variable can span two blocks, so there'll be some
overhead. The easiest solution is not to take any risks and simply oversize
it - disk space is relatively cheap. 

  Now you can access them like any other variable: 

2960 n1 n! &

s" This is a virtual memory string" s1 place &

It looks (almost) completely normal, doesn't it? Except for that ampersand,
of course. This ampersand has to be added every time you write to a virtual
memory variable. It signals to the underlying block management system that
the block is now "dirty". If you think that's too cumbersome for your
taste, you may adopt another solution - it's not that complicated.

Reading a variable is no problem at all: do as you've always done:

n1 n@ . s1 count type cr

And what about arrays? Well, first of all they have to be character based.
And they're restricted to "B/BUF" address units. Or are they? As a matter
of fact, they don't - but they do need some special treatment.

First of all, you have to think of the element size, which must be a power
of two and may not exceed "B/BUF" address units. Second, you need to know
how many rows you require. Now we can define it:

64 constant /row
80 constant #row

variable a1    20 nells vallot latest !
  does> swap nells +paging ;

variable a2 /row #row * vallot latest !
  does> swap /row * +paging ;

So "a1" is an integer arrays and "a2" is a string array. So far, so good.
But what have we defined at the 'DOES>' part? Well, to address an array
we're going to write:

5 a1 10 a2

Which will return the addresses of the sixth element of "a1" and the
eleventh element of "a2" - we're counting from zero. Consequently, we pass
the element number and the address of the array to the 'DOES>' part of the
definition.

That's were the 'SWAP' comes in, since that one puts the element number on
top, which we multiply with the element size to get the offset of that
specific element in the array. Then we pass the whole bunch to "+PAGING".
That's where the magic begins! If you e.g. prefer a more FSL-like array,
now you know what to do..

The same rules apply here, if you want to write to a variable don't forget
the ampersand:

2960 5 a1 n! &

s" This is a virtual memory string" 10 a2 place &

And you can just as easily retrieve it:

5 a1 n@ . 10 a2 count type cr

That's all!  When you're done, you'll have to close your blockfile, of
course. But that ain't too tricky:

close-blockfile

[toc] | [prev] | [next] | [standalone]


#29044

From"Elizabeth D. Rather" <erather@forth.com>
Date2014-03-14 08:53 -1000
Message-ID<396dnXotEsKozb7OnZ2dnUVZ_oydnZ2d@supernews.com>
In reply to#29039
On 3/13/14 11:06 PM, gavino_himself wrote:
> in forth?
>

The same methodology as in any other language, except you write it in Forth.

Nowadays, of course, you'd just put your data files in Dropbox or 
equivalent.

Cheers,
Elizabeth

-- 
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================

[toc] | [prev] | [next] | [standalone]


#29071

Frommarko <marko@marko.marko>
Date2014-03-19 22:35 +1100
Message-ID<532980f8$0$9749$c3e8da3$aae71a0a@news.astraweb.com>
In reply to#29039
gavino_himself wrote:

> in forth?


general:

http://en.wikipedia.org/wiki/Cache_%28computing%29

In computer science, a cache (/ˈkæʃ/ KASH)[1] is a component that 
transparently stores data so that future requests for that data can be 
served faster. The data that is stored within a cache might be values that 
have been computed earlier or duplicates of original values that are stored 
elsewhere. If requested data is contained in the cache (cache hit), this 
request can be served by simply reading the cache, which is comparatively 
faster. Otherwise (cache miss), the data has to be recomputed or fetched 
from its original storage location, which is comparatively slower. Hence, 
the greater the number of requests that can be served from the cache, the 
faster the overall system performance becomes.

Should have been covered in computing 101 or any general readings of 
textbooks of that level.

For those who did not read the article, you can reverse the process to write 
the memory contents to disk.

In Forth, these are just general read/write operations, though your 
destinations may vary.  As the programmer, you define what happens.



[toc] | [prev] | [next] | [standalone]


#29072

Frommarko <marko@marko.marko>
Date2014-03-19 22:39 +1100
Message-ID<5329820e$0$10332$c3e8da3$9b4ff22a@news.astraweb.com>
In reply to#29039
gavino_himself wrote:

> in forth?


maybe its a stream you want?

http://en.wikipedia.org/wiki/Stream_%28computing%29

In computer science, a stream is a sequence of data elements made available 
over time. A stream can be thought of as a conveyor belt that allows items 
to be processed one at a time rather than in large batches.

Streams are processed differently from batch data – normal functions cannot 
operate on streams as a whole, as they have potentially unlimited data, and 
formally, streams are codata (potentially unlimited), not data (which is 
finite). Functions that operate on a stream, producing another stream, are 
known as filters, and can be connected in pipelines, analogously to function 
composition. Filters may operate on one item of a stream at a time, or may 
base an item of output on multiple items of input, such as a moving average.

Should have been covered in computing 101 or any general readings of 
textbooks of that level.

For those who did not read the article, you can reverse the process to write 
the memory contents to disk.

In Forth, these are just general read/write operations, though your 
destinations may vary.  As the programmer, you define what happens.

[toc] | [prev] | [next] | [standalone]


#29074

Frommarko <marko@marko.marko>
Date2014-03-19 22:45 +1100
Message-ID<53298350$0$55645$c3e8da3$b280bf18@news.astraweb.com>
In reply to#29039
gavino_himself wrote:

> in forth?

maybe its a queue you want?

http://en.wikipedia.org/wiki/Queue_%28data_structure%29

In computer science, a queue (/ˈkjuː/ KEW) is a particular kind of abstract 
data type or collection in which the entities in the collection are kept in 
order and the principal (or only) operations on the collection are the 
addition of entities to the rear terminal position, known as enqueue, and 
removal of entities from the front terminal position, known as dequeue. This 
makes the queue a First-In-First-Out (FIFO) data structure. In a FIFO data 
structure, the first element added to the queue will be the first one to be 
removed. This is equivalent to the requirement that once a new element is 
added, all elements that were added before have to be removed before the new 
element can be removed. Often a peek or front operation is also entered, 
returning the value of the front element without dequeuing it. A queue is an 
example of a linear data structure, or more abstractly a sequential 
collection.

Queues provide services in computer science, transport, and operations 
research where various entities such as data, objects, persons, or events 
are stored and held to be processed later. In these contexts, the queue 
performs the function of a buffer.

Queues are common in computer programs, where they are implemented as data 
structures coupled with access routines, as an abstract data structure or in 
object-oriented languages as classes. Common implementations are circular 
buffers and linked lists.

Should have been covered in computing 101 or any general readings of 
textbooks of that level.

For those who did not read the article, you can reverse the process to write 
the memory contents to disk.

In Forth, these are just general read/write operations, though your 
destinations may vary.  As the programmer, you define what happens.

[toc] | [prev] | [next] | [standalone]


#29075

Frommarko <marko@marko.marko>
Date2014-03-19 22:47 +1100
Message-ID<532983d4$0$55645$c3e8da3$b280bf18@news.astraweb.com>
In reply to#29039
gavino_himself wrote:

> in forth?


or was it a stack - hey that sound familiar


http://en.wikipedia.org/wiki/Stack_%28abstract_data_type%29

In computer science, a stack is a particular kind of abstract data type or 
collection in which the principal (or only) operations on the collection are 
the addition of an entity to the collection, known as push and removal of an 
entity, known as pop.[1] The relation between the push and pop operations is 
such that the stack is a Last-In-First-Out (LIFO) data structure. In a LIFO 
data structure, the last element added to the structure must be the first 
one to be removed. This is equivalent to the requirement that, considered as 
a linear data structure, or more abstractly a sequential collection, the 
push and pop operations occur only at one end of the structure, referred to 
as the top of the stack. Often a peek or top operation is also implemented, 
returning the value of the top element without removing it.

A stack may be implemented to have a bounded capacity. If the stack is full 
and does not contain enough space to accept an entity to be pushed, the 
stack is then considered to be in an overflow state. The pop operation 
removes an item from the top of the stack. A pop either reveals previously 
concealed items or results in an empty stack, but, if the stack is empty, it 
goes into underflow state, which means no items are present in stack to be 
removed.

A stack is a restricted data structure, because only a small number of 
operations are performed on it. The nature of the pop and push operations 
also means that stack elements have a natural order. Elements are removed 
from the stack in the reverse order to the order of their addition. 
Therefore, the lower elements are those that have been on the stack the 
longest.[2]
Should have been covered in computing 101 or any general readings of 
textbooks of that level.

For those who did not read the article, you can reverse the process to write 
the memory contents to disk.

In Forth, these are just general read/write operations, though your 
destinations may vary.  As the programmer, you define what happens.

[toc] | [prev] | [next] | [standalone]


#29076

Frommarko <marko@marko.marko>
Date2014-03-19 23:00 +1100
Message-ID<532986e6$0$58717$c3e8da3$12bcf670@news.astraweb.com>
In reply to#29039
gavino_himself wrote:

> in forth?


I can do buffer if you want, but it will end with

For those who did not read the article, you can reverse the process to write 
the memory contents to disk.

In Forth, these are just general read/write operations, though your 
destinations may vary.  As the programmer, you define what happens.

Do you really want me to do buffer?


[toc] | [prev] | [next] | [standalone]


#29077

Frommarko <marko@marko.marko>
Date2014-03-19 23:23 +1100
Message-ID<53298c53$0$7235$c3e8da3$76a7c58f@news.astraweb.com>
In reply to#29076
marko wrote:

> gavino_himself wrote:
> 
>> in forth?
> 
> 
> I can do buffer if you want, but it will end with
> 
> For those who did not read the article, you can reverse the process to
> write the memory contents to disk.
> 
> In Forth, these are just general read/write operations, though your
> destinations may vary.  As the programmer, you define what happens.
> 
> Do you really want me to do buffer?


Of course it should have incorporated the general unrestricted knowledge 
caveat of 

"Should have been covered in computing 101 or any general readings of 
textbooks of that level."

which is pretty much translated as "just google it" nowdays.

[toc] | [prev] | [next] | [standalone]


#29078 — Ok you are pretty clearly totally clueless (was Re: how do you take all data in memory and write to disk for restoring state later?)

Frommarko <marko@marko.marko>
Date2014-03-19 23:52 +1100
SubjectOk you are pretty clearly totally clueless (was Re: how do you take all data in memory and write to disk for restoring state later?)
Message-ID<5329930e$0$47998$c3e8da3$5d8fb80f@news.astraweb.com>
In reply to#29039
gavino_himself wrote:

> in forth?

What data do you want to write?

Where do you want to write it?

What operating system are you using?

What hardware are you using?

What Forth are you using?

Why are you asking this question?

[toc] | [prev] | [next] | [standalone]


#29095

FromMark Wills <markwills1970@gmail.com>
Date2014-03-20 01:35 -0700
Message-ID<bdd6abe6-b24a-4bdf-b54b-48600f0d4ed0@googlegroups.com>
In reply to#29039
On Friday, 14 March 2014 09:06:23 UTC, gavino_himself  wrote:
> in forth?

: shit ( -- )
  read_shit
  do_shit
  write_shit ;

That's how you do it.

[toc] | [prev] | [next] | [standalone]


#29099

FromSpam@ControlQ.com
Date2014-03-20 13:29 -0400
Message-ID<alpine.BSF.2.00.1403201321210.25718@yoko.controlq.com>
In reply to#29095
On Thu, 20 Mar 2014, Mark Wills wrote:

> Date: Thu, 20 Mar 2014 01:35:30 -0700 (PDT)
> From: Mark Wills <markwills1970@gmail.com>
> Newsgroups: comp.lang.forth
> Subject: Re: how do you take all data in memory and write to disk for
>     restoring state later?
> 
> On Friday, 14 March 2014 09:06:23 UTC, gavino_himself  wrote:
>> in forth?
>
> : shit ( -- )
>  read_shit
>  do_shit
>  write_shit ;
>
> That's how you do it.
>

Sorry, Mark.  Gavino is an experimental test program I left running some 
time ago, and seems to have gotten away on me.


: Gavino ( -- )
   begin
     get_random 2 mod if say_stupid_stuff else ask_dumb_question then
     ignore_response
     get_random duration go_away_for
   again ;

I guess given the amount of time it has been running, it can be considered 
a virus ... so if you find it ... KILL it!




[toc] | [prev] | [next] | [standalone]


#29103

From"Rod Pemberton" <dont_use_email@xnothavet.cqm>
Date2014-03-20 18:27 -0400
Message-ID<op.xc1kn4vb6zenlw@localhost>
In reply to#29099
On Thu, 20 Mar 2014 13:29:49 -0400, <Spam@controlq.com> wrote:
> On Thu, 20 Mar 2014, Mark Wills wrote:
>>  On Friday, 14 March 2014 09:06:23 UTC, gavino_himself  wrote:

>>> how do you take all data in memory and write to disk for
>>> restoring state later? in forth?
>>
>> : shit ( -- )
>>  read_shit
>>  do_shit
>>  write_shit ;
>>
>> That's how you do it.
>>
>
> Sorry, Mark.  Gavino is an experimental test program I left running some
> time ago, and seems to have gotten away on me.
>
> : Gavino ( -- )
>    begin
>      get_random 2 mod if say_stupid_stuff else ask_dumb_question then
>      ignore_response
>      get_random duration go_away_for
>    again ;
>
> I guess given the amount of time it has been running, it can be
> considered a virus ... so if you find it ... KILL it!
>

Except, it's been alive so long now, it must be more like a ghost in the
machine.  Someone must've attempted to kill it by now.  Apparently, it
simply respawns, perhaps like so...

: remove_Gavino
   ...
   ...
   ...
   Gavino \ tail call ghost in the machine
;

: find_Gavinos
   get_first_process
   begin
     dup 0= if exit then
     dup is_Gavino if kill_Gavino remove_Gavino else drop then
     get_next_process
   again
;

: Gavino_virus_scan ( -- )
   find_Gavinos
;

The virus scan would never terminate, infinite loop, perpetual respawn ...

Or, maybe someone thought POSTPONE Gavino meant something else.


Rod Pemberton

[toc] | [prev] | [next] | [standalone]


#29312

Fromgavino_himself <visploveslisp@gmail.com>
Date2014-04-05 19:39 -0700
Message-ID<1ca660df-9820-4c30-b8e6-95406bf8f191@googlegroups.com>
In reply to#29103
On Thursday, March 20, 2014 3:27:30 PM UTC-7, Rod Pemberton wrote:
> On Thu, 20 Mar 2014 13:29:49 -0400, <Spam@controlq.com> wrote:
> 
> > On Thu, 20 Mar 2014, Mark Wills wrote:
> 
> >>  On Friday, 14 March 2014 09:06:23 UTC, gavino_himself  wrote:
> 
> 
> 
> >>> how do you take all data in memory and write to disk for
> 
> >>> restoring state later? in forth?
> 
> >>
> 
> >> : shit ( -- )
> 
> >>  read_shit
> 
> >>  do_shit
> 
> >>  write_shit ;
> 
> >>
> 
> >> That's how you do it.
> 
> >>
> 
> >
> 
> > Sorry, Mark.  Gavino is an experimental test program I left running some
> 
> > time ago, and seems to have gotten away on me.
> 
> >
> 
> > : Gavino ( -- )
> 
> >    begin
> 
> >      get_random 2 mod if say_stupid_stuff else ask_dumb_question then
> 
> >      ignore_response
> 
> >      get_random duration go_away_for
> 
> >    again ;
> 
> >
> 
> > I guess given the amount of time it has been running, it can be
> 
> > considered a virus ... so if you find it ... KILL it!
> 
> >
> 
> 
> 
> Except, it's been alive so long now, it must be more like a ghost in the
> 
> machine.  Someone must've attempted to kill it by now.  Apparently, it
> 
> simply respawns, perhaps like so...
> 
> 
> 
> : remove_Gavino
> 
>    ...
> 
>    ...
> 
>    ...
> 
>    Gavino \ tail call ghost in the machine
> 
> ;
> 
> 
> 
> : find_Gavinos
> 
>    get_first_process
> 
>    begin
> 
>      dup 0= if exit then
> 
>      dup is_Gavino if kill_Gavino remove_Gavino else drop then
> 
>      get_next_process
> 
>    again
> 
> ;
> 
> 
> 
> : Gavino_virus_scan ( -- )
> 
>    find_Gavinos
> 
> ;
> 
> 
> 
> The virus scan would never terminate, infinite loop, perpetual respawn ...
> 
> 
> 
> Or, maybe someone thought POSTPONE Gavino meant something else.
> 
> 
> 
> 
> 
> Rod Pemberton

if you have answered the question, simply post the link
DONE
I don't think you have.

[toc] | [prev] | [next] | [standalone]


#29311

Fromgavino_himself <visploveslisp@gmail.com>
Date2014-04-05 19:36 -0700
Message-ID<2b794b45-cef1-43b7-be4a-efa19c673270@googlegroups.com>
In reply to#29099
On Thursday, March 20, 2014 10:29:49 AM UTC-7, Sp...@ControlQ.com wrote:
> On Thu, 20 Mar 2014, Mark Wills wrote:
> 
> 
> 
> > Date: Thu, 20 Mar 2014 01:35:30 -0700 (PDT)
> 
> > From: Mark Wills <markwills1970@gmail.com>
> 
> > Newsgroups: comp.lang.forth
> 
> > Subject: Re: how do you take all data in memory and write to disk for
> 
> >     restoring state later?
> 
> > 
> 
> > On Friday, 14 March 2014 09:06:23 UTC, gavino_himself  wrote:
> 
> >> in forth?
> 
> >
> 
> > : shit ( -- )
> 
> >  read_shit
> 
> >  do_shit
> 
> >  write_shit ;
> 
> >
> 
> > That's how you do it.
> 
> >
> 
> 
> 
> Sorry, Mark.  Gavino is an experimental test program I left running some 
> 
> time ago, and seems to have gotten away on me.
> 
> 
> 
> 
> 
> : Gavino ( -- )
> 
>    begin
> 
>      get_random 2 mod if say_stupid_stuff else ask_dumb_question then
> 
>      ignore_response
> 
>      get_random duration go_away_for
> 
>    again ;
> 
> 
> 
> I guess given the amount of time it has been running, it can be considered 
> 
> a virus ... so if you find it ... KILL it!

www.prevayler.org in FORTH is where I am going with this.

100,000-400,000 query /s second

dont need SQL

all data in ram

take a snapshot to the filesystem every so often?

each update is logged to disk and on desktop hardware this can be 1000s a second 

so

if power fails, read back last full image dump then rerun the transaction log to restore all state

this means VERY fast websites without need ing postgresql

WOW!!

now

I don't know why someone seems to think I GET any clear answers here.

Mostly is liek marko who go off in crazy tangents based not on wha tI asked but some bizarre arrogant mindset like I am not a computer pro and udnerstand of have setup 100s of caches or been using unix and understanding virtual memory for over a decade.

So you end up sounding like a moron, yet having the hilarious arrogance to call me dumb!! LOL

Look at the question I am asking.

I build high performance web platforms for a living and make grea tmoney but i am curious about things that can be even better esp things liek prevayler that cna be 100x times better than what it typically used.

I already know the garbage used by java shops cna easily be schooled.

thats EZ

[toc] | [prev] | [next] | [standalone]


#29404

FromJason Damisch <jasondamisch@yahoo.com>
Date2014-04-07 13:50 -0700
Message-ID<a3dab73a-ca79-457f-af56-e3a5c220c074@googlegroups.com>
In reply to#29311
> Look at the question I am asking.

> thats EZ


Gavino,

To write a great program in any language, including Forth, one must have a mastery of the problem domain.  Because you say that you have 10 years of experience in this problem domain, and are successful enough to perhaps take a year or two off of your regular job, then you could write such suite of Lexicons yourself, and treat us to a useable tool.  

Just saying.

> www.prevayler.org in FORTH is where I am going with this. 

Because you seem to be a fellow one of who's strengths is imagination and creativity, I'll let you in on a little technique we use sometimes over in Forth land.

Pretend that you were already sitting on top of the perfect Prevayler like system written in Forth.  Then write down all of the words that it would consist of.  Write the names, short descriptions inside of comments, and stack effects for each word.   Think about exactly how it would work and why it would be better than the C version.  This can be the seed of a speck for a real system.  It might even spur some interest on the part of some other people if you post it from your personal website.  

You may if you so choose, design from the top down and then develop from the bottom up, implementing words until you get to the top level words.

As far as saving stuff to disk and then restoring it, I'm not sure, but the journey of a thousand miles begins with a first step.

Take Care

Jason

[toc] | [prev] | [next] | [standalone]


#29488

Fromthe_gavino_himself <visphatesjava@gmail.com>
Date2014-04-09 04:39 -0700
Message-ID<5916dc8f-1153-4a96-991e-bdf0cb72d124@googlegroups.com>
In reply to#29404
On Monday, April 7, 2014 1:50:32 PM UTC-7, Jason Damisch wrote:
> > Look at the question I am asking.
> 
> 
> 
> > thats EZ
> 
> 
> 
> 
> 
> Gavino,
> 
> 
> 
> To write a great program in any language, including Forth, one must have a mastery of the problem domain.  Because you say that you have 10 years of experience in this problem domain, and are successful enough to perhaps take a year or two off of your regular job, then you could write such suite of Lexicons yourself, and treat us to a useable tool.  
> 
> 
> 
> Just saying.
> 
> 
> 
> > www.prevayler.org in FORTH is where I am going with this. 
> 
> 
> 
> Because you seem to be a fellow one of who's strengths is imagination and creativity, I'll let you in on a little technique we use sometimes over in Forth land.
> 
> 
> 
> Pretend that you were already sitting on top of the perfect Prevayler like system written in Forth.  Then write down all of the words that it would consist of.  Write the names, short descriptions inside of comments, and stack effects for each word.   Think about exactly how it would work and why it would be better than the C version.  This can be the seed of a speck for a real system.  It might even spur some interest on the part of some other people if you post it from your personal website.  
> 
> 
> 
> You may if you so choose, design from the top down and then develop from the bottom up, implementing words until you get to the top level words.
> 
> 
> 
> As far as saving stuff to disk and then restoring it, I'm not sure, but the journey of a thousand miles begins with a first step.
> 
> 
> 
> Take Care
> 
> 
> 
> Jason

Thank you at least for a serious reply.

Hmmm.

Well first off would be how do I read and write to the disk.

Then how do I store data in memory.

Then how do I run 'queries' on the data.

Then how do I do updates...deletes...CRUD

Then how do I make sure any update is first logged to disk then applied to the in memory storage.

Then how do I dump all in memory data to disk and how do I read it back later.

Then how do I wrap the outgoing respnses in HTML.

I happen to be insane enuf to think about 4 tags of HTML are needed for output, until I get to writing input forms.

For out put links, images, resizeable text, and frozen text/code pre tags are about all I need.

I then have to worry about if the path to the file system is correct (relative?)

html forms have to be parsed to accept inputs

Then how do I connect this html brain to incoming requests?  maybe a shortcut would be the apache tomcat way and let apache handle the incoming connection and then pass along to this html brain listening on internal unix port say 8888.

apache handles ssl url crap multiprocessing etc...

not sure if I then have to make html brain talk scgi or fastcgi...for multiple clients....

some lisp people and now perl etc seem to spawn a new brain for each client

this eats ram but apparently simplifies the coding to read and write for a given client (easier than whatever php or mod perl does)

wow

you really got me thinking

top down and bottom up!

damn I am inspired now, the most since jeff fox used to actually email little old me

wow

thanks for the post again!

[toc] | [prev] | [next] | [standalone]


#29489

FromMelzzzzz <mel@zzzzz.com>
Date2014-04-09 14:40 +0200
Message-ID<li3f3t$llk$1@news.albasani.net>
In reply to#29311
On Sat, 5 Apr 2014 19:36:15 -0700 (PDT)
gavino_himself <visploveslisp@gmail.com> wrote:

> On Thursday, March 20, 2014 10:29:49 AM UTC-7, Sp...@ControlQ.com
> wrote:
> > On Thu, 20 Mar 2014, Mark Wills wrote:
> > 
> > 
> > 
> > > Date: Thu, 20 Mar 2014 01:35:30 -0700 (PDT)
> > 
> > > From: Mark Wills <markwills1970@gmail.com>
> > 
> > > Newsgroups: comp.lang.forth
> > 
> > > Subject: Re: how do you take all data in memory and write to disk
> > > for
> > 
> > >     restoring state later?
> > 
> > > 
> > 
> > > On Friday, 14 March 2014 09:06:23 UTC, gavino_himself  wrote:
> > 
> > >> in forth?
> > 
> > >
> > 
> > > : shit ( -- )
> > 
> > >  read_shit
> > 
> > >  do_shit
> > 
> > >  write_shit ;
> > 
> > >
> > 
> > > That's how you do it.
> > 
> > >
> > 
> > 
> > 
> > Sorry, Mark.  Gavino is an experimental test program I left running
> > some 
> > 
> > time ago, and seems to have gotten away on me.
> > 
> > 
> > 
> > 
> > 
> > : Gavino ( -- )
> > 
> >    begin
> > 
> >      get_random 2 mod if say_stupid_stuff else ask_dumb_question
> > then
> > 
> >      ignore_response
> > 
> >      get_random duration go_away_for
> > 
> >    again ;
> > 
> > 
> > 
> > I guess given the amount of time it has been running, it can be
> > considered 
> > 
> > a virus ... so if you find it ... KILL it!
> 
> www.prevayler.org in FORTH is where I am going with this.
> 
> 100,000-400,000 query /s second

Well, on my machine maximum requests per second (connect,
read request ,write response ,close) on loopback interface is around
35k.

> 
> dont need SQL

Why?

> 
> all data in ram

Number of processed requests depends on kind of requests
that are performed. Scalability is main issue here
and I think it is very difficult to beat existing databases
(or pointless). 

> 
> take a snapshot to the filesystem every so often?
> 
> each update is logged to disk and on desktop hardware this can be
> 1000s a second 
> 
> so
> 
> if power fails, read back last full image dump then rerun the
> transaction log to restore all state
> 
> this means VERY fast websites without need ing postgresql

This means that you have to beat database in all this
which is very unlikely...

> 
> WOW!!





-- 
Click OK to continue...

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.forth


csiph-web