Working on a state machine which requires re-entrant code.
Anyone had any experience with State Machines -- would like
to discuss??
Printable View
Working on a state machine which requires re-entrant code.
Anyone had any experience with State Machines -- would like
to discuss??
would you mind explaining what a state machine is?
also known as:Quote:
Definition: A model of computation consisting of a set of states, a start state, an input alphabet, and a transition function that maps input symbols and current states to a next state. Computation begins in the start state with an input string. It changes to new states depending on the transition function. There are many variants, for instance, machines having actions (outputs) associated with transitions (Mealy machine) or states (Moore machine), multiple start states, transitions conditioned on no input symbol (a null) or more than one transition for a given symbol and state (nondeterministic finite state machine), one or more states designated as accepting states (recognizer), etc.
Also known as finite state automaton.
I remember the Turing Machine from Data Processing 101.Quote:
Turing machine
(definition)
Definition: A model of computation consisting of a finite state machine controller, a read-write head, and an unbounded sequential tape. Depending on the current state and symbol read on the tape, the machine can change its state and move the head to the left or right. Unless otherwise specified, a Turing machine is deterministic.
I'm not sure if this is what he meant or not, but decided to GOOGLE it to see.
:D
Turing Machines was probably the single most interesting subject in college. After AI/NN of course. :D
I especially liked the Halting problem...
I 've designed state machines for PLD's. I'll help if I can
kevin
Thanks for the response kebo
Believe "for the most part" I've got it working. From what I've seen you can break down your reentrant code to the nth level
so limited mine reentrant code to any processing > 1 second.
I'm using a database as a circular buffer. Data is received from a server, where it is stored in the DB (master record table) and also the DB Buffer. No locks are used on the buffer table
A timer is used to query the buffer to process the records and if an outside event occurs (e.g. User using mouse) state machine enters a reentrant state until action is completed.
QUESTION:
Will the following cause a data loss or is there some work around??
I'm writing to the buffer using Recordset 1 (this is set to read/write and the write is initiated by receipt of data from server which I receive in a continuous stream and which I have no control over).
I am reading from the buffer using Recordset 2 (this is set as read/write and the read is timer initiated).
NO LOCKING is currently used.
To date I have had no problems but concerned that if if NO records exist in the buffer and if Recordset1 tries to write to the buffer at the same time Recordset2 tries to read it, a conflict will occur.