Tutorial #1 Notes Friday Sept 12 @1:10 pm (CDF Lab - Downstairs) ================= This is what the TAs will be covering in the first LAB. 0) Login: - Your account name is a468xxxx, where xxxx are the first four letters in your lastname. Your password is your student ID number. If you are a graduate student, your account name is a2204xxx. - If student accounts are not set up, there are three dummy accounts a468tst{a,b,c} 1) Tell students about subscribing to the course newsgroup: ut.cdf.csc468h - Try: trn ut.cdf.csc468h or : rn ut.cdf.csc468h or : nn ut.cdf.csc468h - We will put important assignment, room change, midterm solutions, and carry out any assignment discussions on this newsgroup * Clarifications or changes to assignments made in the newsgroup become official parts of the assignment. - Students should submit questions through here so that other students can see the answers and questions (and maybe contribute to the answers) 2) A directory has been created where students can get application code executable files, more information about the assignments, etc. - This directory is: /u/csc468h/include 3) Start up oot: - Type in: oot & - Select "Start Up OOT" by clicking on it - You should see 3 new windows on the screen: * Note: Each window has menus that can be dropped/revealed by clicking on them with a mouse (these are the rectangular boxes). You can select options within them by holding down the left mouse button and highlighting the option required. The ellipses/buttons are associated with actions/functions instead of menus. For example, one button on the Control Panel is "Run Main." It is a shortcut for Ctrl-M, which runs the current OOT program in the main File Viewer. * One window is labeled "Object Oriented Turing - Control Panel" From here OOT run options, help commands, and debugging options are initiated. (Top left hand corner) There is a green information line above the menu options which tells you what is currently happening (which files are running or compiling, etc). Initially this will say "Main program is unnamed." * The second window is labeled: "OOT File Viewer" - This is OOT's text editor - The name in the brackets is the file you are editing in that window. Initially this says "(Main: unnamed)." - There can be more than one of these open - The editor is automatically in insert mode - The window allows you to edit one file * The third window is the "OOT Directory Viewer" - Allows you to search for directories, manipulate files (like rm, open for edit, run, copy, etc.). - The current directory is displayed in the line below the menu options. - The directory contents are in the lower portion of the window. Double click on a directory to change to that directory. - Directories have the "/" character at the end of their name, making it easier to distinguish between files and directories. If you double click on a file, it will be opened in the "OOT File Viewer." - The "Chdir" menu can be used to change directories to: Home (your root directory), Startup (directory where you started up OOT), %oot (contains OOT samples), or some other directory (you type it in). 4) Create a simple oot program: - In the editor window type in: put "hello world" NOTE: "Cursor" move and "Edit" actions menu can allow cutting and pasting (just choose the text to cut or copy by putting the cursor at the start and holding the left mouse button. Move the cursor to the end and release the button. The text should be highlighted. Select "Cut" or "Copy" and move the editor cursor to where you want to place the text and select "Paste" (note the editor cursor and the mouse cursor are 2 different entities (for trek fans))) - Run the program by selecting "Run^R" from the editor window, or select "Run Main ^M" from the "Control Panel" (this always runs the file selected at the "Main" program and can be seen in the editor window as "Main:" besides the files name which in our case is "unnamed") - When an OOT program is run it creates a separate "Run Window" where all the program's output is displayed (for toot the output and input are displayed to stdout and stdin) - Input to files are also to be input at the run window which implies moving the cursor to that window. - Once a program is finished, the run window remains open (even if we close the "OOT File Viewer" window). Therefore we must close this window ourselves by selecting the "Close Run Windows ^C" option within the "Run Options" menu of the "Control Panel" window (WHEW! I hope you're all still with me 'cause I'm getting confused myself). - Save the file: To give it a name, select "Save As" in the "File" menu from the "OOT File Viewer." Once you type in a new name and hit return, the name is displayed at the top of the "OOT File Viewer" and added to the file list in the "OOT Directory Viewer." The file will be saved in your current directory at this time. (Before doing this make sure you are in your home directory by selecting the "Chdir" option in the Directory Viewer. This will open a small window to enter the directory name. Select the "Home" option here.) Once your current file is named, you now only have to select "Save" in the "File" menu of the "OOT File Viewer" to save further changes to this file. 5) Enter an error and run it: - Type in garbage (2 or 3 lines worth) in the file and run it - A new window is opened on the middle right of the screen called the "OOT Error Viewer" - Errors are displayed in this window with some explanations - Double click on the 2nd error and see what happens to the "OOT File Viewer" window (the line with the error is highlighted and the editor cursor is moved there) - Fixing the error(s) and re-running the file will remove the window (a new one is created if the new file again has errors). (or you could close the error window yourself) - Close the file for editing: Select the "Close ^W" option in the "OOT File Viewer." You'll be asked if you want to save changes. * NOTE: You can use your favorite text editor with OOT too, whether it is vi or emacs or whatever. Simply edit and save the file and then double click on the filename in OOT's Directory Viewer. 6) Change to the "%oot" directory using the "Chdir" option in the "OOT Directory Viewer." 7) %oot is a predefined directory name known by this oot system (if you select "../" directory by double clicking on it you will move up a directory level and see what the actual path name is) (i.e. it is currently /local/include/oot) 8) In the %oot directory there is a "Minotaur" directory (Minotaur is an oot application to simulate an operating system) and a "demos" directory (you should go through all of these in your spare time, but we will look at a few of the demos for this lab) - There are other directories with an online reference manual, more examples, help, etc. (for the reference manual double click on the "help/" directory and you will see a file for every oot command - double click to display the man page - actually opens an "OOT File Viewer" window) 9) change to the "demos" directory (double click on "demos/") - You will see all the demos possible by selecting the README file for display. All demos are placed in separate directories. - For this course we are probably going to cover concurrency, modules, monitors (with waits and signals), separate compilation, error handling 10) Change to the Concurrency directory and open "hiho.demo" - Note all demos have an explanation about what they do - This demo creates two processes which run concurrently (explained in tutorial 2 and lecture 1 and 2) - "fork" creates a new thread of execution which runs at the same time as the current one. It uses the code for the "process" whose name follows the fork command (e.g. here we fork off process "speak") - Each process's code is written as you would a procedure - Run the program. You can see that one process is printing out "Hi" and the other is printing out "Ho" (actually printing to the screen should only allow one process to use the display device at a time -> wrap a monitor around print statements - This will be explained in a later tutorial) - Now run it again by selecting the "Stop ^." option in the "Control Panel" after one line of Hi's and Ho's is displayed. - At this point you have halted the execution with the processes still existing in the system. The reason we want you to do this is to see what the "Dump Processes" option in the "Run Options" menu of the "Control Panel" does. - Select this option. This gives you all the info about the processes currently created by your program (useful for debugging) in a "OOT Process Viewer" window. - The line with the asterisks shows the states of the processes below - The process names are displayed below this - Double click on a name -> this gives more debug info (location of file where you are executing, any procedures that are called from others are shown by the lines with "...") - Double click on any of these lines and the "OOT File Viewer" will highlight and put the cursor on the line that is described (the "OOT File Viewer" is opened if the file is not being edited -> To see this, CLOSE the demo file and select a line in the process viewer and the "OOT File Viewer" should be opened and the line highlighted) - Close the Process Viewer window - Select the "Turn Trace On" option in the "Control Panel." This highlights the current program line being executed and is also useful for debugging (as well as "Step" and "Step Over") Warning: Don't confuse "Turn Trace On" with "Trace On". - Run the program and see what happens - You can Turn Trace On/Off while the program is running - close the demo and run windows and turn trace off 11) Other good demos: - Modules (stack program written with a module) - SeparateCompile (shows how to split up a file into 2 or more files - this splits the stack program above into 2 files. One has the main program, the other the stack module.) 12) On-line help information - This is in the "Information" menu of the "Control Panel;" select it and view all the options. - There are options here to display what is the main program, the stdin and stdout file, any arguments entered the execution directory, and the current directory. - Select "Help" from the "Information" menu. - This moves the directory to %oot/help - It also opens up the [LANDSCAPE] figure (you can do some interactive help commands) (Other useful directories may have a predefined figure you can search around as well) - The description of how to use "help" is placed in a "OOT File Viewer." This file is actually "%oot/help/help". - Move you cursor into the rectangle containing "Overview" in the Landscape Viewer and type "f" to see details. - Close the Landscape Viewer and Help files. Congratulations you are done. Go wild!!