220 likes | 418 Views
Subversion and Nachos tutorial. Bhavjit S Walha. What will we be covering?. Announcements Account set-up Introduction to subversion How to checkout the assignment How to turn-in Simple commands Basic Nachos tutorial Basic structure of the OS Threads package
E N D
Subversion and Nachos tutorial Bhavjit S Walha
What will we be covering? • Announcements • Account set-up • Introduction to subversion • How to checkout the assignment • How to turn-in • Simple commands • Basic Nachos tutorial • Basic structure of the OS • Threads package • How to get started on the 1st assignment
AnnouncementsGroups • I have received only 7 groups till now • Approx 8 students still unpaired. • Why is a group important? • You cannot download the assignment • Hence, you cannot turn it in • Rest of this tutorial will be useless. • SO PAIR UP NOW!!!
Announcements:Groups • Group 1 • hqiu, j9yang, dzheng, hschao • Group 2 • jmoe, kderaksh, wtlee • Group 3 • okhalili, j3davis, jalai, hnvo • Group 4 • dbjcarbaj, mpirkle • Group 5 • amancour, c1trinh, jwchan • Group 6 • sctang, tcchheng, ????
Group 7 • mson, e6park, mmm001, kngan? • Group 8 • ??? • Group 9 • ??? • Group 10 • ??? • Group 11 • ???
Subversion • An open source version control system • CVS on steroids • What does it do? • Manages files and directories over time • “Remembers” all changes made over time • Allows one to examine what changes were made, at what time and by whom. • Get the last working copy
Allows multiple users on different computers to work on the same piece of software • to co-operate without having to ‘e-mail’ the assignments. • Since the files are versioned – you can always go back in case somebody entered something wrong • If 2 users modify the same file, you can resolve the conflicts.
SubversionSet-up • The subversion server is already running: • http://cse120.textdriven.com/svn/cse120/ • Your logins and passwords are already in the mail • This DOES NOT have a web interface • You can checkout Nachos from: • http://cse120.textdriven.com/svn/cse120/trunk/nachos • Each group has been assigned a directory to manage their files • http://cse120.textdriven.com/svn/cse120/groupXX • You should always use your individual logins • The svn client is located in the public folder: • /home/linux/ieng6/cs120u/public
Environment variables • All settings required for bash and csh are included in the prepfile. • prep cs120u
Setting up your repository • Only 1 person in a group should do this. • The Nachos distribution has already been copied into your directories • svn copy http://cse120.textdriven.com/svn/cse120/nachosj/trunk http://cse120.textdriven.com/svn/cse120/group01 • Make a turnin directory • svn mkdirhttp://cse120.textdriven.com/svn/cse120/group01/turnin • svn mkdir http://cse120.textdriven.com/svn/cse120/group01/turnin/proj1 • Similarly make the turnin directories for projects 2 and 3
Turning in your projects • Once you are done: • svn copy http://cse120.textdriven.com/svn/cse120/group01/nachos http://cse120.textdriven.com/svn/cse120/group01/turnin/proj1
Subversion usage • Checkout the files from your repository • svn co http://cse120.textdriven.com/svn/cse120/group01/nachos • This will give you a local working copy in your account • Needed only once • Edit your local copy • When you are ready to make the changes visible to your group mates • svn commit [filename(s)] • It will ask you to enter a log message – is useful to track changes
Other subversion commands • To add a file to the repository • svn add [filenames...] • To delete a file: • svn remove [filenames...] • Add/Delete should be followed by a svn commit • To update your local files • svn update • There may be conflicts which you will need to resolve • To discard local change and revert to the copy in repository • svn revert • For other commands and help: • svn help [command name]
More useful subversion commands • Checking the history of changes • svn log • Checking out a particular revision • svn co –r 22 • Use svn help co for more options • To view the diffs between 2 revisions • svn diff • For more detailed information • http://svnbook.red-bean.com/ • http://subversion.tigris.org/faq.html
Nachos Not Another Completely Heuristic Operating System • An instructional Operating System developed at UC Berkeley. • Originally written in C++ • We would be using the Java version for our course (Nachos 5.0j) • More difficult to make mistakes • Faster debugging cycle
Simulates a real MIPS CPU and a number of H/W devices including: • Interrupts – can be enabled or disabled. • Timer – Simulates a real-time clock • Serial Console • Disk • Network Link • Details can be found in the machine directory • We will not be needing the last 3 in our projects
Nachos Thread package • The source-code is located in the threads directory • All Nachos threads are instances of nachos.threads.Kthread • Possible thread status: • statusNew: A newly created thread, not forked as yet • statusReady: In the ready queue, can be achieved by using Kthread.ready() • statusRunning: Set when KThread.restoreState() is called. • statusBlocked: Usually as a result of KThread.sleep() or waiting for some other resource. • statusFinished: Set by calling KThread.finish()
Scheduler • To create a new queue of threads conforming to the scheduling policy of the scheduler • scheduler.newThreadQueue() • To schedule the next thread from the ready queue (conforming with the policy) • ThreadQueue.nextThread()
Project 1 – Getting started • You will have to enhance the existing Thread package by implementing new synchronization primitives. • Read and understand scheduler.java, condition.java and KThread.java • All changes should be restricted to the threads directory • Do NOT • make changes to the Makefile • Use JAVA threads • Use the synchronized keyword • Add any packages of your own
Project 1 • Part 1: KThread.join() • Ideas?? • Part 2: Condition2.java • Condition.java is a good starting point • Difference between wake and wakeAll? • What about interrupts? • Part 3: • Make waitUntil() non-blocking
Project 1 – part 4(Can use Semaphores or Condition Variables) Initially: SharedData sd; boolean theCondition = false; Lock theLock = new Lock(); Condition AcanProceed = new Condition(theLock); Condition BcanProceed = new Condition(theLock); A's code: theLock.acquire(); while (!theCondition) { BcanProceed.wake(); AcanProceed.sleep(); // Releases the lock and go to sleep atomically. // And we will have the lock when we are waken up. } // Do something to sd ...... // Reset the flag. theCondition = false; // Wake up B BcanProceed.wake(); lock.release(); return;
Nachos • To compile: • cd proj1; gmake • Useful resources: • A guide to Nachos 5.0j. /home/linux/ieng6/cs120u/public/nachosj-walkthrough.pdf • Nachos Roadmap: http://www.cs.duke.edu/~narten/110/nachos/main/main.html • Guide to reading the Nachos source (C version): http://people.cs.uchicago.edu/~odonnell/OData/Courses/CS230/NACHOS/reading-code.html • Nachos homepage: http://www.cs.washington.edu/homes/tom/nachos/