archive-edu.com » EDU » H » HWS.EDU

Total: 727

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • xComputerLab 3
    black box Parameters and Local Names It is not always possible to pass parameter values in registers In xComputer for example there is only register the accumulator that can be used for parameter passing But some subroutines require two or more parameters The solution is to use reserved memory locations for the parameter values just as is done for the subroutine s return address Similarly a return value from a subroutine can be placed in a reserved memory location rather than in a register This method is a little more difficult than using registers but it is also more flexible Look at the sample program MultiplyTwoNumbers txt This sample program includes a subroutine that can multiply any two numbers The numbers that are to be multiplied are parameters to the subroutine and the product of the two numbers is its return value The memory locations labeled N1 N2 and Answer are used to hold the two parameter values and the return value These locations can be found at the beginning of the subroutine along with a memory location to hold the return address Before it calls the subroutine the main program must load the two numbers that it wants to multiply into N1 and N2 When the subroutine ends the main program can get the answer by loading the contents of memory location Answer You should read the program try it out and make sure that you understand all this The program contains a list of detailed instructions for using the subroutine Note that you don t have to understand the method that the subroutine uses for multiplying the numbers In fact it s a fairly complex procedure By the way when you read the Multiply subroutine you ll notice that it uses nine different labeled memory locations Five of these ret addr N1 N2 Answer and Multiply are used for communication with the main program The other four are part of the internal working of the subroutine Ideally the main program wouldn t have to know about them at all because the main program is only interested in the task performed by the subroutine not in its internal workings These labels are called local names since they are meant to be used only locally inside the subroutine Unfortunately in the simple assembly language of xComputer it is not possible to actually hide these names from the main program and you have to be careful not to use the same name for a different purpose in the main program In my sample subroutines I have tried to use local names that are not likely to occur elsewhere in the program such as loop m and done m In real programming languages local names are actually invisible to the rest of the program so there is no possibility of a conflict Passing Pointers The final sample program ListSumSubroutine txt illustrates one more aspect of parameter passing The subroutine in this example is meant to add up an entire list of numbers There is no limit placed on the number of items in the list How is it possible to pass a potentially limitless number of parameters to the subroutine The solution is that the numbers in the list are not passed to the subroutine at all Instead the main program tells the subroutine where in memory to look for the list There is only one parameter the address of the starting location of the list This address is said to be a pointer to the list In the ListSumSubroutine txt example the main program stores a pointer to the list in the memory location labeled ListStart The subroutine then accesses the numbers in the list using indirect addressing in a LOD I instruction This is a nice example that demonstrates once again the usefulness of pointers and indirect addressing Reality Check It s actually kind of crazy to try to write subroutines for xComputer The limited variety of machine language instructions for xComputer makes it very hard to express the idea of a subroutine in that language Not surprisingly real computers have special purpose machine language instructions for working with subroutines The first thing that a machine language needs is a pair of instructions for calling a subroutine and for returning from a subroutine These instructions might be called jump to subroutine and return from subroutine The jump to subroutine instruction would automatically save a return address and then jump to the starting point of the subroutine The computer could figure out the return address on its own instead of leaving it up to the programmer by looking at the value in the Program Counter register The Program Counter holds the address of the next instruction after the one that is currently being executed and that s exactly the point that the subroutine should jump back to The return from subroutine instruction would get the return address that was previously saved by jump to subroutine and jump back to that address These two instructions would make it unnecessary for a programmer to even think about return addresses Real computers also have a more systematic way of dealing with parameters An area of memory called the stack is used to hold the parameters for all subroutines In fact the stack also holds return addresses and data values used internally by subroutines The stack is just a list of values When a subroutine is called the parameters and return address for the subroutine are added to the end of the list When the subroutine ends the return address and parameters are removed from the stack The jump to subroutine instruction stores the return address on the stack and return from subroutine removes it from the stack when it s time for the subroutine to end Typically a computer has a register called the Stack Pointer to keep track of how big the stack currently is And machine language typically includes instructions called push and pop to add items from the stack and to

    Original URL path: http://math.hws.edu/TMCM/java/labs/xComputerLab3.html (2016-02-07)
    Open archived version from archive


  • xTuringMachine Lab
    New Machines In this part of the lab you will learn how to construct new machines in the xTuringMachine applet To begin a new machine select New from the pop up menu at the top of the applet This will give you an empty rule table that you can fill in to define the machine you want The xTuringMachine applet does not allow you to simply type in a rule Instead it has procedures for adding a new rule to the table and for modifying rules that are already in the table The type of editing that you can do is similar to what you already know about setting the Turing machine s state and changing the contents of its tape New rules are added to the rule table using the Rule Maker that is located just above the table of rules The Rule Maker has a set of five boxes where you create the rule and a Make Rule button that you can click to add the rule to the table You can edit any of the five items in the Rule Maker Just click on the item that you want to change The item will be hilited In the above picture the second item other is hilited The blue rectangular palette will display the values that you can legally put in the hilited spot You can either type the value you want or click on it in the palette Note that other is represented in the palette by a If you want to enter the value other you have to type or click on it Once you ve set up the rule you want in the Rule Maker you can either click the Make Rule button or press the Return key to add it to the table of rules The rule has no effect on the Turing machine until you add it to the table A newly added rule will be displayed in the table in red The rule shown in red is selected You can delete the selected rule from the table by clicking on the Delete Rule button You can select any rule in the table by clicking on the rule Once a rule has been added to the table you can edit the last three columns in the rule Click on the item you want to change and edit it in the usual way Note that the last three columns of the table specify the action that the Turing machine will take when it is in the specified state and reading the specified symbol You are only allowed to change the action part of the rule once it is in the table Often the easiest way to create a table of rules is to quickly create a bunch of rules without worrying about the action specified in each rule You can then edit the action parts of all the rules in the table There are lots of things in the xTuringMachine applet that you can edit You can use the arrow keys and the tab key to move among the various editable items Often this is quicker than using the mouse You will notice that sometimes the Make Rule button changes into a Replace button This will happen whenever the first two items in the Rule Maker match the first two items in an existing rule If you click on the Replace button the rule in the Rule Maker will replace the rule in the table Before you do the exercises at the end of the lab you should get some practice at creating and editing a table of rules Here is a table of rules for a Turing machine that Nudges a string of x s y s and z s one square to the left The machine must be started on the leftmost symbol in the string and it will only work if there are a couple of blank squares surrounding the string You should make a copy of this machine by adding each of the above rules to the applet s rule table Begin by selecting New from the pop up menu at the top of the applet if you haven t done so already You should also type an input string of x s y s and z s onto the Turing machine s tape and move the machine to the leftmost symbol in the input Then you can start making the rules one by one and adding them to the table When you are all done you should have a machine that will perform as advertized One more feature of the applet deserves to be mentioned here Suppose that you click the Step or Run button and the Turing machine finds itself in a situation that is not covered by any rule in the rule table In this case the machine will stop and will display the message No Rule Defined It will also set up the Rule Maker with the its current state and the symbol that it is reading so that it is all set for defining the missing rule It s possible to define a machine using this feature Start with an empty table of rules Click Step The machine will protest You can define the rule and click Step again You can proceed in this way until the whole rule table has been defined However you have to be careful to make sure that you have in fact covered all the situations that might arise Binary Arithmetic The operations of incrementing adding one to or decrementing subtracting one from a binary number are simple enough to be done easily by Turing machines The algorithm for adding one can be described as follows If the digit on the tape is a zero then simply change that digit to a one If the digit is a one change it to a zero move left and apply the same procedure at that position This is like carrying a one

    Original URL path: http://math.hws.edu/TMCM/java/labs/xTuringMachineLab.html (2016-02-07)
    Open archived version from archive

  • Web Publishing with Netscape Composer
    in order to see Publish In the Publish dialog box make sure that the two boxes under Links and Images are checked Then fill in the following information under Default Publishing Information substituting your own username for username Publish to FTP or HTTP ftp username escher hws edu export home username www Browse to HTTP http escher hws edu username Then click the OK button This will allow Netscape Composer to find your account on escher hws edu so that it can upload your pages into that account You will need the password for the account later when you have a page ready to go Note Netscape Communicator includes an on line help facility that has lots of information about Composer and HTML as well as about all of Communicator s other features To access this information choose Help Contents from the Help menu To get information about Composer in particular select the link to Creating and Editing Web Pages in the help window that appears Making Your First Page There are several ways to start up Netscape Composer From Netscape s File menu select the New submenu and then select Blank Page Click on the small Composer icon in the bottom right corner of a Netscape browser window Select Page Composer from the Netscape menu Use any one of these methods to open a window where you can create your page There will be a large area where you can type your page and several toolbars along the top of the window One toolbar is used to set the style of the text you type You can have italic text big text colored text centered text and so on The other toolbar is used to add HTML features such as graphics links and tables to the page The toolbar commands are also available in Insert and Format menus in case you prefer using menus I suggest that you start by typing some text for your page Start with a headline for the page on a line by itself Press return a couple of times and type in a paragraph or two of introductory text As with a word processor you should press return only at the end of a paragraph lines within a paragraph will be wrapped automatically to fit in the window where the page is displayed Once you ve gotten some text on the page you can go back and add formatting First of all you should try changing the color of the text and of the page background To do this you need to access a Page Properties dialog box Click on the page with the right mouse button A pop up menu will appear Choose Page Properties from the pop up menu Note that on a Macintosh you can click and hold the mouse button to get the same pop up menu This dialog box has several panels You should be looking at a panel called Colors and Background Each page has five associated colors one for the page background one for regular text and three different colors that are used to display links You can select the colors for your page from the Color Scheme pop up menu Alternatively you can set each color individually Now make some changes to the text If you have a page heading on the first line of text hilite it and then select Heading 1 from the pop up menu at the left end of the toolbar Center the heading by selecting centered text from the pop up menu at the right end You might also use the color pop up menu in the toolbar to change the color of the heading You can make similar changes to any text on your page Dividing lines can help to organize a page Add one to your page by clicking on the H Line button Once the line appears on your page you can drag its edges to change its size and you can right click on it to get a pop up dialog with various options To make a hypertext link on your page use the Link button in the toolbar You will get a dialog box where you can type in the URL of the page to which you want to link You can also enter the text of the link that you want to appear on the page Alternatively you could hilite the link text before clicking the Link button Remember that an easy way to get the URL for a page is to go to that page in the Netscape browser and then Cut and Paste the URL from the Location box at the top of the browser window Once the link is created on the page you can right click on it to get a pop up dialog with various options You should play with the basic tools mentioned in this section until you get your page into reasonable shape As a final step you will probably want to run a spell checker on your page by clicking on the Spelling button in the toolbar You will then be ready to publish your page Publishing Your Page To publish a page that you have created in Netscape Composer click on the Publish button in the toolbar This will bring up a dialog box that looks something like this The Location and Username should already be filled in with the configuration information that you entered earlier You can fill in the password for your account or you can leave it blank If you leave it blank Netscape will ask you for it later If you are working with a newly created page then the Page Title and HTML Filename boxes will be blank You should fill in these two boxes Ordinarily the HTML Filename for your home page should be index html The Page Title can be anything you want this is the title that will appear in the title bar of a browser window when

    Original URL path: http://math.hws.edu/TMCM/java/labs/WebPublishingLab.html (2016-02-07)
    Open archived version from archive

  • xTurtle Lab 1
    the brightness parameter is pretty clear with a value of one representing the brightest color of a given shade The saturation can be thought of as follows A saturation value of one gives the purest possible version of a color Decreasing the saturation from one towards zero is like mixing paint of that color with gray paint of equal brightness The basic color remains the same but it becomes diluted You ll find some examples of using the rgb and hsb commands later in the lab Writing xTurtle Programs The power of a computer comes from its ability to execute programs The xTurtle applet allows you to write and run programs Programs can include all the basic commands described above They can also include loops decisions subroutines and other features The applet can be configured to load one or more programs when it starts up The applet that you launched with the button above should have loaded several sample programs that you will use in this lab You can also write new programs from scratch You can select among the programs that the applet knows about using the pop up menu at the very top of the applet You can begin a new program by clicking on the New Program button or by choosing New from the pop up menu There are also buttons for loading programs from files and for saving programs to files however the configuration of your Web browser might prevent these buttons from functioning One of the sample programs for this lab is called Necklace Select this program from the pop up menu at the top of the xTurtle applet This program contains an example of a loop The program itself reads PenUp moveTo 0 5 PenDown LOOP arc 5 20 circle 0 5 EXIT IF heading 0 END LOOP In addition to these commands the program contains a lot of comments A comment is anything enclosed between braces and Comments are meant for human readers of the program and are completely ignored by the computer You should read the comments on the sample program to help you understand what it does and how it works In an xTurtle program a loop consists of the word loop then a sequence of instructions then the words end loop One of the instructions must be an exit statement which gives a condition for ending the loop In the sample program the statement exit if heading 0 includes the condition heading 0 Since the heading is the direction that the turtle is facing this condition is true when the turtle is facing in the direction zero that is directly towards the right When a loop is executed the computer will execute the statements in the loop repeatedly Each time the exit statement is executed the computer tests the condition specified by that statement If the condition is satisfied the computer jumps out of the loop Ordinarily after exiting from a loop the computer jumps to the statement that follows the end loop In this example there is no further statement after the loop so the program ends when the loop ends To run a program in the xTurtle program select it from the pop up menu if necessary so it is visible on the screen Then click on the Run Program button If there are no errors in the program the computer will switch back to the drawing area and execute the program You can control the rate of execution with the speed pop up menu You can pause the execution with the Pause button and you can terminate it permanently with the Stop button After the program has been executed you can run it again by clicking the Run Program button Note that every time you run a program the turtle starts out in its initial configuration at the center of the drawing area facing right with the pen down and with the drawing color set to red Run the Necklace program and try to understand how it works As another example click on the New Program button and then type in and run the following program Instead of typing it you might want to be clever and use cut and paste DECLARE hue hue 0 LOOP hsb hue 1 1 forward 5 back 5 turn 360 100 hue hue 0 01 exit if hue 1 END LOOP This program uses a variable named hue You can use any names you want for variables as long as you avoid words that already have a special meaning such as loop and if A variable is just a memory location which has been give a name and which can be used to store a value In xTurtle you give a name to a memory location with a declare statement Once you have declared a variable you can store a value in it with an assignment statement which has the form variable name value The operator is called the assignment operator It tells the computer to calculate the value on the right and to store it into the variable on the left The value on the right can be given as a number as another variable or as a mathematical formula For example hue hue 0 01 x 17 newAmount oldAmount cost length width costPerSquareFoot Next we turn to an example that introduces the if statement This is the sample program RandomWalk which should already be loaded into the xTurtle applet Select the RandomWalk program from the pop up menu and run the program several times This program makes the turtle do a random walk in which it repeatedly moves in a randomly chosen direction Read the program and the comments on it and try to understand how it works In particular look at the if statement in the Random Walk program An if statement is used to decide among alternative courses of action An if statement begins with the word if and ends with the words end if The end

    Original URL path: http://math.hws.edu/TMCM/java/labs/xTurtleLab1.html (2016-02-07)
    Open archived version from archive

  • xTurtle Lab 2
    subroutine and optionally a list of one or more parameter names The subroutine name and the parameters form the interface of the subroutine everything from there up until the END SUB is the implementation The sample program SpiralsSubroutine defines a subroutine named spiral Select this program from the pop up menu at the top of the xTurtle applet and read the program and comments When you click the Run Program button to run this program it will look like nothing has happened But in fact the effect of the program is to define the subroutine Ordinarily the computer has no idea what the word spiral means but once the computer compiles the subroutine definition it will then understand commands like spiral 61 and spiral 89 Such commands can be added to the program after the subroutine definition or they can be entered into the text input box below the drawing area in the xTurtle applet Try it Some of the pictures you can make are rather pretty Exercises Exercise 1 Consider each of the pictures b c d and e in the nested squares illustration shown above For each of these incorrect versions determine what small change in the program NestedSquares would produce that picture In each case it s a question of removing one or more statements from the correct program so that one or more of the required preconditions are not met In each case determine which statement to remove and what precondition or preconditions are unmet in the resulting program Exercise 2 Select the sample program Quadratic from the pop up menu at the top of the xTurtle applet When you run this program it will ask you to input three numbers A B and C It will then compute and display the solutions to the quadratic equation A x 2 B x C 0 If you run the program and enter the values 1 1 and 1 for A B and C it will work fine However if you enter 1 1 and 1 as the values of A B and C the program will crash This crash can be traced to the fact that at a certain point in the program there is a precondition that might not be satisfied If it is not satisfied an error occurs and the program crashes What precondition is not properly checked by the program It has something to do with the square root function Recall that in some cases the quadratic equation has no solutions Modify the program so that it does not crash when the input values fail to meet the precondition Instead of crashing the program should display an error message and halt Exercise 3 This is a continuation of Exercise 2 The Quadratic sample program actually exhibits another precondition which is violated if A equals zero Where does this precondition occur in the program and what exactly is the problem with having A 0 Exercise 4 This is a continuation of Exercises 2 and 3

    Original URL path: http://math.hws.edu/TMCM/java/labs/xTurtleLab2.html (2016-02-07)
    Open archived version from archive

  • xTurtle Lab 3
    the Koch curve You should try complexity levels of 0 1 2 3 and 4 A Koch curve of complexity 0 is defined to be a straight line segment A Koch curve of complexity 1 is a line segment with a bump or detour The complexity one curve is made up of four line segments but you should think of each line segment a Koch curve of complexity zero A Koch curve of complexity 2 is obtained from the curve of complexity 1 by adding a detour to each line segment in the curve You should look at a Koch curve of complexity 2 as being made up of four smaller pieces where each piece is a Koch curve of complexity 1 More generally a Koch curve of complexity N is made up of four smaller Koch curves of complexity N 1 Once again this is a recursive definition and the subroutine that draws Koch curves is a recursive subroutine Try to understand how the pictures you see are produced by the Koch subroutine The KochCurves program also defines a subroutine named Snowflake which draws Koch snowflakes A Koch snowflake is made by joining three Koch curves together at their endpoints producing a symmetric snowflake like picture Try it Exercises Exercise 1 Add the following lines to the end of the SymmetrySubs sample program after all the subroutines Run the program a few time to see what it does The write a short essay explaining exactly how the program works and why it produces the pictures that it does Try running this at fastest speed with the turtle turned off declare x x 0 loop face 360 random hsb x 1 1 multiforward 0 4 x x 0 005 if x 1 then x 0 end if exit if 1 2 end loop Exercise 2 The mathematics used in the subroutines defined in SymmetrySubs is not trivial How much did you need to know about this mathematics to use the subroutines What point about subroutines does this illustrate Exercise 3 The Speed pop up menu in the xTurtle applet works by inserting delays betweens commands Since circle is a single command a complete circle is drawn instantaneously no matter what the setting of the speed menu This disappointed one of my students who wanted to be able to watch the circles being drawn Write a subroutine SUB SlowCircle radius that will draw a circle by drawing 60 arcs where each arc covers 6 degrees Then use your subroutine to slowly draw a picture like the following Exercise 4 Modify your subroutine from Exercise 3 so that it draws each of the arcs of the circle in a different color The color of an arc can be set to hsb hue 1 1 At the beginning the value of hue should be zero After drawing each arc it should be increased by 1 60 Exercise 5 A subroutine such as the one you wrote for Exercise 4 can be used in

    Original URL path: http://math.hws.edu/TMCM/java/labs/xTurtleLab3.html (2016-02-07)
    Open archived version from archive

  • xSortLab Lab
    is done by applying QuickSortStep recursively to each part The great cleverness of QuickSortStep is in the efficient way in which it divides the list into smaller items and bigger items but that is easier seen than described The picture below shows QuickSortStep being applied to the original list of sixteen items An item has been removed from the list and placed in Temp A box encloses items that have not yet been compared to Temp as far as the program knows Temp could end up in any of the locations enclosed by the box Items to the left of the box are known to be smaller than Temp Items to the right are known to be larger Each step shrinks the box by one location moving an item from that location to the other side of the box if necessary In the end there is only one location left in the box and that is where Temp belongs Using the Timed Sort Mode Now that you understand how some sorting algorithms work the next step is to investigate how efficiently lists of items can be sorted In this part of the lab you will use the Timed Sort mode of the xSortLab applet Select this mode from the pop up menu at the very top of the applet which you launched above In the Timed Sort mode the computer works behind the scene to sort arrays of randomly generated numbers An array is just a numbered list of items the size of the array refers to the number of items in the list As the computer sorts the arrays it displays various statistics in the large green area in the center of the applet The statistics are updated about twice every second At the top of the applet there is a text input box where you can type the size of the arrays to be sorted There is also a box where you can type the number of arrays to sort The computer will create the number of arrays that you specify Each array will have the size that you specify The computer fills all the arrays with random numbers Then it sorts each array one after the other The reason for using more than one array is that for small arrays the time it takes to sort a single array is a tiny fraction of a second Since xSortLab can t measure very small time intervals accurately the only way to get an accurate idea of the sorting time for small arrays is to sort a lot of arrays measure the time it takes to sort them all and divide the total time by the number of arrays For larger array sizes using more than one array is not so important but it might still give you a more accurate measurement At the bottom of the applet you will see a pop up menu that can be used to select the sorting algorithm that is to be applied to the arrays There is a also a Start Sorting button Once you have selected the sorting method and set up the size of the arrays and the number of arrays click on the Start Sorting button to begin If you are dealing with a large number of items there will be a noticeable time interval before the computer starts sorting The pause occurs while the computer is filling the arrays with random numbers When you click the Start Sorting button the name of the button will change to Abort Use the Abort button if you want to terminate the sorting operation before the computer finishes The xSortLab applet displays several different statistics about the sorts its does For this lab you will only need the Approximate Compute Time This is different from the Elapsed Time because as it is computing the applet allows some time about 20 of the time available for other activities such as redrawing the screen It is only the time actually devoted to sorting that you are interested in The compute time is approximate because it is possible for your browser or other programs on your computer to steal time from the applet The applet might incorrectly include this time in the compute time it reports However if you are not doing anything else with your computer at the same time that the applet is sorting then the reported time should be reasonably accurate The computer measures time in units of 1 1000 of a second and this also limits the accuracy of measurements In particular you should not try to use measurements that are less than say 0 1 seconds Ideally you should adjust the number of arrays so that the compute time is at least a couple of seconds Your task in this part of the lab is to gather timing statistics about each of the five available sorting methods You want to measure how long it takes each method to sort arrays of various sizes You will need this data for the exercises at the end of the lab so you should record the data as you work For each experiment that you do record the array size the number of arrays and the compute time that is reported by the applet You should apply each method to arrays of at least the following sizes 5 10 100 and 1000 In addition you should apply Merge Sort and QuickSort to arrays of size 10000 You might also want to try Merge Sort and QuickSort on arrays with 100000 items And you might try Bubble Sort Selection Sort and Insertion Sort with 10000 items For the largest array sizes it will be good enough to sort a single array For the smaller array sizes you will have to set the number of arrays to be rather large to get a decent measurement Don t be afraid to sort 10000 or even 100000 arrays of size 5 Use your judgement If the arrays require

    Original URL path: http://math.hws.edu/TMCM/java/labs/xSortLabLab.html (2016-02-07)
    Open archived version from archive

  • xTurtleLab 4
    run all the processes at exactly the same rate of speed To turn this option on click on the Lock Step checkbox in the bottom right corner of the xTurtle window When this box is checked all the turtles on the screen will move in lock step While this might not be an accurate simulation of multitasking it can be pretty to watch You might want to try executing some of the sample programs with this option turned on Shared Variables In all the examples you have seen so far the multiple processes are completely independent The various turtles go about their business without interacting with the other turtles in any way This is not quite true since the turtles have to share the same screen You might have noticed that one turtle will sometimes wipe out the image of another turtle temporarily Things can get more interesting when the processes have to communicate with each other In xTurtle processes communicate through shared variables When a variable is declared before a fork command there is only one copy of that variable which is shared by all the processes If any of those processes changes the value of the variable then all the other processes can see the new value This is the only form of communication between processes that can occur in xTurtle As explained in The Most Complex Machine great care must be taken when shared variables are used for communication so that one process does not change the value of a variable while another process is using that value A process must obtain exclusive access to a shared variable while it is using that variable This is the mutual exclusion problem In xTurtle the grab statement is provided to make mutual exclusion possible A grab statement takes the form GRAB global variable name THEN statements END GRAB Only one process at a time is allowed to grab a given variable When a process comes to a grab statement the computer checks to see whether another process has already grabbed the variable If so then the second process must wait until the first process releases its lock on the variable by finishing the execution of its grab statement Only then is the second process allowed to grab the variable and execute the statements in its own grab statement Of course this can cause big problems if a process grabs a variable and doesn t release it Other processes that want to grab the variable will never get a chance to run at all The statements inside a grab statement are called a critical region As long as access to shared variables is confined to critical regions processes can use the variables to communicate in relative safety Even with the grab statement communication among processes can still be very complicated A relatively straightforward example can be found in the sample program SynchronizedRandomWalk txt Select this program from the pop up menu read the comments and run the program You will

    Original URL path: http://math.hws.edu/TMCM/java/labs/xTurtleLab4.html (2016-02-07)
    Open archived version from archive