The Week 3 tutorial contains various synchronisation familiarisation exercises. Please prepare for it. Additionally, feel free to ask any assignment related questions in the tutorial. The following is a brief setup guide. If you need more detail, refer back to ASST0. We have provided you with a framework to run your solutions for ASST1. You have to configure your kernel itself before you can use this framework.
CS 161: Operating Systems (Spring 2017)
It will install the kernel if the build succeeds. The sys If not, follow the instructions below to obtain another copy. A pre-configured sys configuration is available here: sys This is the same as starting up with sys kernelthen running "at" at the menu prompt invoking the array testthen when that finishes running "bt" bitmap testthen quitting by typing "q".
This is the simplest example. This will start the kernel up, then quit as soon as it's finished booting. Try it yourself with other menu commands. Remember that the commands must be separated by semicolons ";". If your code is properly synchronised, the timing of context switches, the location of kprintf calls, and the order in which threads run should not influence the correctness of your solution.
Of course, your threads may print messages in different orders, but you should be able to easily verify that they follow all the constraints required of them and that they do not deadlock. While the randomness is fairly close to reality, it complicates the process of debugging your concurrent programs. This means that you can reproduce a specific execution sequence by using a fixed seed for the random number generator. You can pass an explicit seed into the random device by editing the "random" line in your sys For example, to set the seed to 1, you would edit the line to look like:.
We recommend that while you are writing and debugging your solutions you start the kernel via command line arguments and pick a seed and use it consistently. Once you are confident that your threads do what they are supposed to do, set the random device to autoseed. This should allow you to test your solutions under varying conditions and may expose scenarios that you had not anticipated.
To reproduce your test cases, you need to run your tests via the command line arguments to sys as described above, otherwise system behaviour will depend on your precise typing speed and not be reproducible for debugging. The aim of the week 3 tutorial is to have you implement synchronised data structures using the supplied OS synchronisation primitives. See the Week 03 Tutorial for details. It is useful to be prepared to discuss both the questions and the following assignment in your tutorial.
A deeper understanding can be useful when debugging, but is not strictly required. After which, walking through the implementation of the synchronisation primitives themselves should be relatively straightforward. The following problems will give you the opportunity to write some fairly straightforward concurrent systems and get a practical understanding of how to use concurrency mechanisms to solve problems. We have provided you with basic driver code that starts a predefined number of threads that execute a predefined activity in the form of calling functions that you must implement or modify.GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Work fast with our official CLI. Learn more. If nothing happens, download GitHub Desktop and try again. If nothing happens, download Xcode and try again. If nothing happens, download the GitHub extension for Visual Studio and try again.
We use optional third-party analytics cookies to understand how you use GitHub. You can always update your selection by clicking Cookie Preferences at the bottom of the page. For more information, see our Privacy Statement. We use essential cookies to perform essential website functions, e. We use analytics cookies to understand how you use our websites so we can make them better, e.
Skip to content. Dismiss Join GitHub today GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up. Go back. Launching Xcode If nothing happens, download Xcode and try again. Latest commit. Git stats 2 commits.
Failed to load latest commit information. View code. About lock,semphore, and condition variable. Releases No releases published. Packages 0 No packages published. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Accept Reject. Essential cookies We use essential cookies to perform essential website functions, e. Analytics cookies We use analytics cookies to understand how you use our websites so we can make them better, e.
Save preferences.The thread system provides interrupts, control functions, spinlocks, and semaphores. Have implemented working locks, condition variables, and reader-writer locks that you can use it later assignments. Be able to properly address different synchronization problems by choosing and applying the correct synchronization primitive.
ASST1 is your first chance to write real kernel code. Here are the guidelines for how to work with other students and work with your partner if you have one :. If you are working alone, you will appreciate this yourself.
If you are working with others, they will appreciate it. If you are publishing code to the broader community, others will both appreciate and be impressed by it.
These assignments provide you with a chance to continue developing good code writing habits. If you are working with a partner, good style will help them understand your code and you understand theirs.
It will also help the course staff understand your code when you need help. And you are starting with a very well-formatted and commented code base which provides an excellent example of what to do.
There is no single right way to organize and document your code. It is not our intent to dictate a particular coding style for this class. Pay close attention to the lines of comments which most clearly and efficiently explain what is going on.
When you write code yourself, keep these observations in mind. Note that commenting, while potentially useful, does not make up for poor coding conventions. In many cases, well-structured code with good choices of variables and function names needs comments only in cases where something unusual must be pointed out. For example, try to determine what the following intentionally obfuscated code on the left does. The click on the right side for the much better solution.Release date : Jan.
The first part of this document briefly discusses the code on which you'll be working and the tools you'll be using. You can find more detailed information on Git and GDB. The following sections provide instructions on what you must do for this assignment. The OS distribution contains a barebones operating system source tree, including some utility programs and libraries.
After you build the operating system you boot, run, and test it on the simulator. We use a simulator in OS because debugging and testing an operating system on real hardware is extremely difficult. Apart from floating point support and certain issues relating to RAM cache management, it provides an accurate emulation of a MIPS processor.
Besides this initial assignment, there will be an OS programming assignment for each of the following topics:. OS assignments are cumulative. You will need to build each assignment on top of your previous submission.
So you will have to make sure that each of your assignments work correctly! Most programming you have probably done has been in the form of 'one-off' assignments: you get an assignment, you complete it yourself, you turn it in, you get a grade, and then you never look at it again.
The commercial software world uses a very different paradigm: development continues on the same code base producing releases at regular intervals. This kind of development normally requires multiple people working simultaneously within the same code base, and necessitates a system for tracking and merging changes.
Your will be working in teams of 2 on OS and will be developing a code base that will change over the couse of several assignments.
Therefore, it is imperative that you start becoming comfortable with Git, an open source version control system. Git is a powerful tool, but for OS you only need to know a subset of its functionality. The Git handout contains all the information you need to know and should serve as a reference throughout the term. If you'd like to learn more, there is comprehensive documentation available here. In some ways debugging a kernel is no different from debugging an ordinary program.
On real hardware, however, a kernel crash will crash the whole machine, necessitating a time-consuming reboot. First, a kernel crash will only crash the simulator, which only takes a few keystrokes to restart.
Second, the simulator can sometimes provide useful information about what the kernel did to cause the crash, information that may or may not be easily available when running directly on top of real hardware.
This is called csgdb. An important difference between debugging a regular program and debugging an OS kernel is that you need to make sure that you are debugging the operating system, not the machine simulator.
Not good. Login to the lab machines. On your first log-in, you should change the password on your account for security purposes. You can use the passwd command to do so. Start by setting up your personal information for Git, if you have not done it previously. The "--global" option will update the. Next step, make sure that your home directory is not accessible to others. This way you can ensure that you code will not be available to others accidentally. Here, the permission grants yourself full access to the home directory, and denies any access no read, write or execute access to group members or other users.
For more information on Linux file permissions, you can read this article. The ranges of machines that are accessible are roughly ugugugug and ug You will need to setup your path to access the OS tools. To do so, you should check whether you use csh or bash as follows:.Another assignment objective is to get you working efficiently in a Linux development environment using standard command-line development tools.
Unlike many of the things you will find online ASST0 is not a tutorial. Another objective of this course is to help you learn to use common development tools, particularly Git. However, like most programming tools the best way to learn Git is through the extensive online documentation and multiple good online tutorials 12etc.
As a result, we have removed Git coverage from this introduction. Any documentation we could provide is unlikely to be complete and up-to-date, and this will also provide you with good practice in online learning. Feel free to ask your course staff or other students for help, either in person or using the forum.
Chances are many of them use Git on a daily basis. Like anything else, learning Git takes practice, more practice, and patience. ASST0 focuses on getting your environment set up and familiarizing you with the source code you will be modifying. There is a small amount of coding involved, but not too much. These comprise the test testing framework, the sys system simulator, and cross-compilers to create sys executables.
Please follow those instructions carefully and return when have the toolchain set up. We distribute the ops-class. Starting with a clone of our repository makes it easy for us to distribute updates, which can be merged easily into your repository. If you are using our Vagrant virtual machine, you can run Git either inside or outside of your virtual machine, assuming your host machine has Git installed.
ASST0: Introduction to OS/161
If you have the toolchain installed natively you can create your source directory wherever you want. Clone our ops-class. Note that we refer to this directory as your source directory. In contrast, your root directory is where your built kernel and other binaries are installed and where you run sys You need to do this very short step only when you completely remove your source tree for some reason. Run configure --help to find out more including available command line options. This has caused confusion for some students previously, so please be careful.
You should notice a configuration script, a base configuration file conf. You should take a look at conf. Configure a kernel now with dumbvm enabled. In particular, conf.GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
We use optional third-party analytics cookies to understand how you use GitHub. Learn more. You can always update your selection by clicking Cookie Preferences at the bottom of the page. For more information, see our Privacy Statement. We use essential cookies to perform essential website functions, e. We use analytics cookies to understand how you use our websites so we can make them better, e.
Skip to content. Permalink Dismiss Join GitHub today GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together. Sign up. Go to file T Go to line L Copy path.
Raw Blame. Kernel config file for assignment 1. Device drivers for hardware. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Accept Reject. Essential cookies We use essential cookies to perform essential website functions, e.
Analytics cookies We use analytics cookies to understand how you use our websites so we can make them better, e. Save preferences.The purpose of this assignment is to introduce you to the code you will be using throughout the rest of the course. You have already completed significant portions of this assignment in class and in your web work -- setting up your virtual machine, cloning the code repository, learning how to configure and build kernels -- these are all different aspects of becoming familiar with the system you'll be using.
Once you have completed the written and programming exercises, you should have a fairly solid grasp of the pitfalls of concurrent programming and, more importantly, how to avoid those pitfalls in the code you will write later this semester. The thread system provides interrupts, control functions, and semaphores. You will implement locks and condition variables. For this assignment, you will hand in an individual problem set. You may speak to other students about the probems, but you may communicate only in a spoken language, not in C or any other programming language.
You may not search the web for solutions. All the work you turn in should be your own.Week06-Build OS161 in Ubuntu
Begin Your Assignment First, "tag" your Git repository. The purpose of tagging your repository is to make sure that you have something against which to compare your final tree.
Make sure that you do not have any uncommitted updates in your repo. Now, tag your repository as shown here:. We have provided an example framework in which you can implement and test your solutions for ASST1. You have to reconfigure your kernel before you can use this framework:. To that end, you should look through the files and begin to internalize how the code is structured, what goes where, and how things work.
This applies both to the build system and the codebase itself. To guide you in this process please write up and hand in answers to the questions found below in this section. Put them in a text file asst1-answers. The questions are designed to encourage code exploration.
We've tried to avoid questions that can be answered simply using grep. The goal is to help you understand key parts of the system. That said, you are not yet expected to understand everything you see; that's what the rest of the course is for. But you should get the "gist," and your answers should reflect that. Please be as detailed as possible, giving function names and full pathnames in the source tree where appropriate.
You don't need to explain what every last line of a function does, but your answers should be conceptually complete.