Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 14 in printed book and digital formats -- plus a one-year subscription so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Print:
PDF:

Feature

REALScience

Finite State Machines

Issue: 6.3 (March/April 2008)
Author: JC Cruz
Article Description: No description available.
Article Length (in bytes): 17,227
Starting Page Number: 24
RBD Number: 6312
Resource File(s):

Download Icon 6312.zip Updated: Saturday, March 15, 2008 at 12:35 PM

Related Web Link(s):

http://en.wikipedia.org/wiki/Tower_of_Hanoi
http://en.wikipedia.org/wiki/Bubble_sort
http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
http://en.wikipedia.org/wiki/Finite_state_machine

Known Limitations: None

Excerpt of article text...

In today's REALScience, we will study the concept of finite state machines. First, we will learn the basic workings of such a machine. Then, we will build one using the REALbasic Thread class. Finally, we will build a demo project that will put our machine through its phases.

Threads Revisited

Starting an application creates a process. A process gets it share of resources (disk, memory, network, etc) from its host system. It also remains active until it gets a quit signal from the user or a fatal error during its run.

A process always runs its tasks in a sequential fashion. When it starts one task, it waits for that task to complete before starting the next one. Consider, for example, a menu process. When users click on the menu, the process first displays a list of menu items and waits for those users to make their choice. Next, it identifies which menu item was chosen. Then, it disposes the list and runs the task for that menu item.

There are, however, certain tasks that do not lend well to sequential execution. Some tasks take a long time to complete. Others have to wait for a specific event or value to appear. To handle these tasks, a process may spin them off as separate threads.

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com