Sei sulla pagina 1di 5

Exercise #1 Familiarity with Linux/TI-OMAP and Threads/Processing

DUE: 9/8/2013 on Blackboard (before Midnight) Please thoroughly read Tanenbaum Chapters 1 &2 and bring any questions you have to class. Note that the slides for Chapters 1 & 2 have also been posted on Blackboard. Also, please make sure you come to the A219 lab and claim a Beagle xM Linux system (TI-OMAP) and note your DHCP assigned IP address. Once you have claimed a machine, change the password (initially and un-claimed machine will have username=ubuntu and password=uaaosa335). Please ask your instructor to label your machine you will use for the rest of the semester. You can remotely access your Linux Beagle as long as you know your DHCP assigned IP. Also, make sure your A219 cypher-lock access code works and allows you to access the lab during hours the SoE building is open. Finally, make sure you can log into the A219 Linux server (IP address 137.229.168.236, transformer.uaa.alaska.edu) using your UAA username and UAA student ID # as your initial password (change this password as well). If you have any issues using the lab, with remote access, or physical access, it is your responsibility to get help. Do not keep any critical files on your Beagle xM or on the A219 server (neither one is backed up) so keep your original files or copies on your own personal computer as a backup.

Exercise #1 Requirements:

1) [20 points] Verification of networking on your Beagle xM (or alternately on transformer.uaa.alaska.edu or your VB-Linux) should be performed please provide output from the Beagle xM. a) [2 pts] ifconfig b) [2 pts] ping 137.229.168.236 c) [2 pts] sudo apt-get install traceroute (test your package update capability for Ubuntu) d) [2 pts] traceroute google.com (Note: your will have to do sudo apt-get install traceroute first) e) [12 pts] Based on examination of your network interface, ability to ping our server, and ability to traceroute to an external service like google.com, explain how your system is networked and note any issues you have with any of the above commands if they produce errors (and see your instructor if they do). If all works, simple provide output requested and sketch a diagram of how your Beagle xM is connected to the A219 server, the A219 lab LAN, the campus WAN, and the Internet. 2) [35 points] Test your ability to download, build, edit, and run code on your Linux Beagle (or alternately on transformer.uaa.alaska.edu or your VB-Linux) using the example code website http://www.cse.uaa.alaska.edu/~ssiewert/a320_code/EXAMPLES/ by downloading fibsimple.tar.gz, simple-cloud-example.tar.gz, and hpc_cloud_grid.tar.gz and provide output to show that youve done what is asked. Note that youll need to use the command tar xvzf

fibsimple.tar.gz for example (likewise for other tape archive gzip compressed files you download) to create a directory with this source. a) [5 pts] Download, restore, and cd into fibsimple and do a make to build the source code thats there and run it capture output for user input of 50 and explain what you see and why this output is produced including any error messages. Practice editing the source code by adding your own banner output at the beginning of the program (use vi, nano, or emacs). If you need to install an editor, use sudo apt-get install nano for example to install your favorite editor (nano is usually best for beginners). If you have any problems building this C++ source code, note the problems in detail and see your instructor to get help. b) [10 pts] Download, restore, and build the Eratosthenes Sieve serial code in file simplecloud-example.tar.gz (note that on the Beagle xM and TI-OMAP, the directive in C flags to use SSE 3 wont work, so remove the flag msse3 from the Makefile using your editor before you build) it should work on VB-Linux however. Run this code, provide example output and explain how the code works (background on the basic algorithm can be found here - http://en.wikipedia.org/wiki/Eratosthenes_sieve ). Why does SSE 3 not work on Beagle xM? c) [10 pts] Do some research on TI-OMAP and ARM architecture on the web using google.com, Wikipedia.org and reading from beagleboard.org based on what you find, does the Beagle xM support NEON and does this provide similar capability to SSE? Provide a paragraph describing your understanding of SSE on x86 and NEON on ARM and what you find through your own web-based research using suggested web sites. d) [5 pts] Download, restore, and build the threaded Eratosthenes Sieve code hpc_cloud_grid.tar.gz (again fixing makefile as needed if SSE 3 flag needs to be removed) and edit the code so that it computes the number of primes between 0 and 1000000. Use the Linux time command to see how long it takes this code to run and how much user and system time this takes to complete e.g. time ./erast provide output to show you built and timed this code. e) [5 pts] While erast is running either in the background using ./erast & on an SSH connection or in another xterm if you are using the graphical interface, run top and when it comes up, enter H to toggle it into thread view mode. Capture the top output with a screen dump or just select and copy that shows how much CPU erast uses and if more than one thread is active (if you have trouble capturing this, just describe what you saw). 3) [35 points] Thread creation coding and synchronization design work for the next lab based on your understanding of the threaded erast.c example and reading of Tanenbaum, write a first cut C program that creates two threads, one that increments a global index and the other which decrements the same global index inside the process address space at this point do not worry about synchronizing the increment/decrement have both run for 10,000 iterations of increment or decrement and then do a pthread _join and print out the final value of your

index what is the value? Turn in your code and a Makefile for it (based on modification of one of the provided Makefiles). In the next lab, youll be asked to synchronize the increment and decrement so that the index is exactly ZERO after the pthread_join. 4) [10 points] Process creation design work for the next lab based on your reading of Tanenbaum, how would you write a program that in turn forks a new process where both the parent process and child increment an index every 1 second (using system call sleep(1)) and prints out its value to the console if both parent and child do this, will they provide the same output (will it be synchronized)? You can either just describe how youd do this, or provide your first cut at this as C source code in the next lab youll be expected to turn this in as a working program, so bring questions to class if you do not understand the fork() system call. Example code that implements a mini-shell using fork and exec is available to build, debug, read at http://www.cse.uaa.alaska.edu/~ssiewert/a320_code/EXAMPLES/Lab2-1.zip.

Overall, provide a well-documented professional report of your findings, output, and tests so that it is easy for a colleague (or instructor) to understand what youve done. Include any C/C++ source code you write (or modify) and Makefiles needed to build your code. I will look at your report first, so it must be well written and clearly address each problem providing clear and concise responses to receive credit. Note: Linux manual pages can be found for all system calls (e.g. fork()) on the web at http://linux.die.net/man/ - e.g. http://linux.die.net/man/2/fork In this class, youll be expected to consult the Linux manual pages and to do some reading and research on your own, so practice this in this first lab and try to answer as many of your own questions as possible, but do come to office hours and ask for help if you get stuck. Upload all code and your report completed using MS Word or as a PDF to Blackboard and include all source code (ideally example output should be integrated into the report directly, but if not, clearly label in the report and by filename if test and example output is not pasted directly into the report). Your code must include a Makefile so I can build your solution on Ubuntu VB-Linux or Beagle xM. Please zip or tar.gz your solution with your first and last name embedded in the directory name. Note 2: For your convenience, any example code posted at http://www.cse.uaa.alaska.edu/~ssiewert/a320_code/EXAMPLES/ I will also copy to /tmp/src on
137.229.168.236, transformer.uaa.alaska.edu so you can scp it to your Beagle xM. E.g. use the command scp r <username>@137.229.168.236:/tmp/src . This will create an equivalent src directory where you execute this command e.g. heres how I used it to grab a copy onto my VB-Linux:

Be careful to not do this to a location where you OVERWRITE your existing src directory!! I would make a unique directory for each exercise to contain your sources (src) and make sure you also backup what you develop onto your VB-Linux or at least one other machine. The scp command is convenient and powerful for moving sources between Linux systems (and widely used by systems programmers, but takes some getting used to).

Grading Rubric [20 points] Verification of networking on your Beagle xM: [2 pts] ifconfig _______________________________________________________ [2 pts] ping 137.229.168.236 ____________________________________________ [2 pts] sudo apt-get install traceroute ______________________________________ [2 pts] traceroute google.com ____________________________________________ [12 pts] sketch a diagram of how your Beagle xM is connected__________________ [35 points] Test your ability to download, build, edit, and run code on your Linux Beagle: [5 pts] Download fibsimple and run it capture output _________________________ [10 pts] Download, Eratosthenes Sieve serial code, run, explain _________________ [10 pts] Do some research on TI-OMAP and ARM architecture on SSE ___________ [5 pts] Download, the threaded Eratosthenes Sieve and time ____________________ [5 pts] While erast is running capture the top output ___________________________ [35 points] Thread creation coding and synchronization design work ____________________ [10 points] Process creation design work for the next lab ______________________________

Potrebbero piacerti anche