Re: finite state machine/automaton framework?

看板DFBSD_kernel作者時間21年前 (2004/09/04 02:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/8 (看更多)
--Apple-Mail-2--36607979 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On 03.09.2004, at 19:54, Matthew Dillon wrote: > :hey, > : > :considering that operating systems in general (and dfly in special) > :have lots of finite state machines in source - most of them hidden as > :evil if/else constructs of which the authors supposedly never heard > :about FSM before. > :Is it a good or bad idea to have a (simple) FSM framework available > :which can be used by different parts of the operating system? If yes, > :do such frameworks already exist? > : > :Just a thought because of the need to implement a i8254 PIT > emulation... > Well, I don't think it's really applicable to what the kernel > has to do in most cases. For example, emulating an 8254 with an > FSM > would basically require emulating the 8254's logic, which would > take > megabytes through a generic FSM module, even one designed for logic > emulation. But it would only a few kilobytes if you 'faked' it in > C > (emulated the 8254 at a functional level rather then at a logic > level). I was thinking of a system that generates C code out of a formal description. This way the code wouldn't differ much from the hand written one, but it would definitely be better to maintain (compare yacc). for example: state_idle: if: written_byte & WHATEVER_BITMASK newstate: state_program_oneshot output: this_var = that_var; run_foo(); etc cheers simon -- /"\ \ / \ ASCII Ribbon Campaign / \ Against HTML Mail and News --Apple-Mail-2--36607979 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) iD8DBQFBOLJXr5S+dk6z85oRAsEwAKD768V4fEfpjnO1z0ddeqjbwxpVwgCfbXwV WRYCGjq75Cpf709Bk4oAVbA= =S4E4 -----END PGP SIGNATURE----- --Apple-Mail-2--36607979--
文章代碼(AID): #11EBYd00 (DFBSD_kernel)
討論串 (同標題文章)
文章代碼(AID): #11EBYd00 (DFBSD_kernel)