Giter Club home page Giter Club logo

ostep-projects's Introduction

Projects for an Operating Systems Class

This repository holds a number of projects that can be used in an operating systems class aimed at upper-level undergraduates and (in some cases) beginning graduate students. They are based on years of teaching such a course at the University of Wisconsin-Madison.

Also (increasingly) available are some tests to see if your code works; eventually every project will have a set of tests available. The testing framework that is currently available is found here. A specific testing script, found in each project directory, can be used to run the tests against your code.

For example, in the initial utilities project, the relatively simple wcat program that you create can be tested by running the test-wcat.sh script. This could be accomplished by the following commands:

prompt> git clone https://github.com/remzi-arpacidusseau/ostep-projects
prompt> cd ostep-projects/initial-utilities/wcat
prompt> emacs -nw wcat.c 
prompt> gcc -o wcat wcat.c -Wall 
prompt> ./test-wcat.sh
test 1: passed
test 2: passed
test 3: passed
test 4: passed
test 5: passed
test 6: passed
test 7: passed
prompt> 

Of course, this sequence assumes (a) you use emacs (you should!), (b) your code is written in one shot (impressive!), and (c) that it works perfectly (well done!). Even for simple assignments, it is likely that the compile/run/debug cycle might take a few iterations.

C/Linux Projects

Initial Projects

These projects are meant to get you warmed up with programming in the C/UNIX environment. None are meant to be particularly hard, but should be enough so that you can get more comfortable programming.

Realize the best thing you can do to learn to program in any environment is to program a lot. These small projects are only the beginning of that journey; you'll have to do more on your own to truly become proficient.

  • Unix Utilities (cat, grep, zip/unzip)
  • Sort (text-based)
  • Sort (binary)
  • Reverse (very simple reverse program)

Processes and Scheduling

Virtual Memory

  • Memory Allocator

Concurrency

File Systems

Distributed Systems

Kernel Hacking Projects (xv6)

These projects all are to be done inside the xv6 kernel based on an early version of Unix and developed at MIT. Unlike the C/Linux projects, these give you direct experience inside a real, working operating system (albeit a simple one).

Read the install notes to see how to download the latest xv6 and install the tools you'll need.

Initial Projects

Processes and Scheduling

Virtual Memory

Concurrency

File Systems

ostep-projects's People

Contributors

jcavar avatar omodev avatar qwhex avatar remzi-arpacidusseau avatar sphynx avatar thasinaz avatar vinaybanakar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ostep-projects's Issues

Doestn't work in ostep-projects / initial-memcached

In repo ostep-projects/
initial-memcached, I followed every instruction the README.md file described, but failed to work, when I type the last command make, it produced an error:

make: No targets specified and no makefile found. Stop.

but other instructions worked out, can anyone help me figure this out?

Envirnoment: Ubuntu 20.04.4 LTS

I got some problem when installing the xv6 on my Mac

image

I tried to install xv6 on my Mac follow the install notes, after all the work, when I run "make TOOLPREFIX=i386-elf- qemu-nox" in the xv6-public, it began to show the above again and again. Is there some problem? and after I install Qemu but before the second software to be installed, when I run"qemu-system-x86_64 -nographic", it showed as follows

image

So where is the problem?

Book: a little typos

I don't know how to commit issue to the book directly, so come here.

  1. fix argument of example code 'swtch'

In Figure 6.4 of chapter 6, first argument of function swtch is struct context**old. I think it should be struct context *old, because the following code need a memory address of old context, not address of a pointer to the old context.

  1. better clear formula 9.2

In CFS scheduler section of chapter 9, formula 9.2 gives: vruntimei=vruntimei+weight0/weighti·runtimei. But the text didn't describe what weight0 for. This might confusing newbies like me to "process 0's weight".

After searching, it showed weight0 may be the value of "nice 0" into prio_to_weight[40].

  1. In chapter 23 page 10, bold "directory memory access" might be "direct memory access".

  2. In chapter 30, I could hardly find the problems in the broken CV codes but got an irrelevant one ;-( One producer produced loops values and two consumers consumed double. Sorry, professor :-) (just while(1) may be OK)

  3. fix Figure 33.1 code

18    int fd;
19    for (fd = minFD; fd < maxFD; fd++)
20        FD_SET(fd, &readFDs);
21
22    // do the select
23    int rc = select(maxFD+1, &readFDs, NULL, NULL, NULL);
24
25    // check which actually have data using FD_ISSET()
26    int fd;
27    for (fd = minFD; fd < maxFD; fd++)

The first argument of select() is maxFD+1, then the max monitored file descriptor is maxFD, so the two loop conditions should be fd <= maxFD(line 19, 27). And line 26 is redundant.

  1. In chapter 38 page 11, the table shows BLOCKs of 2 bits size, but the text above it shows 4 bits.

  2. Chapter 39. In the middle of page 6, in this spot (“hello”) might be in this spot (“hello\n”).

Page 8 struct { struct spinlock lock;... } ftable;, xv6 source shows that the lock indeed per whole instead of per entry.

Page 24 sidebar, it might be difficult for malicious user to attack the service via a call to rename(), but rather easy via ln command.

Thank you for the excellent book!

Missing 6.in file in wcat utilities tests directory

Hello, I ran the test-wcat.sh shell script and it returned the following output:

test 1: passed
test 2: passed
test 3: passed
test 4: passed
test 5: passed
test 6: 6.out incorrect
  what results should be found in file: tests/6.out
  what results produced by your program: tests-out/6.out
  compare the two using diff, cmp, or related tools to debug, e.g.:
  prompt> diff tests/6.out tests-out/6.out
  See tests/6.run for what is being run

I ran wcat myself and passed tests/6.out as an argument and saw that it did return the right output. So, I opened tests/6.run to see what is being run and noticed that it calls wcat with tests/6.in as argument, but I don't see that file there, I do see .in files for the other tests, but not for test 6. Am I missing something?.

Thanks!

Suggestions about setting up xv6

As the repo https://github.com/mit-pdos/xv6-public has been deprecated. I found it difficult to set up xv6. So i did a little search. Here is what i found:

  1. Follow the instructions here: https://pdos.csail.mit.edu/6.828/2021/tools.html

  2. Use this repo: https://github.com/mit-pdos/xv6-riscv.git instead of xv6-public.

    • The code is slightly different from what professor Arpaci-Dusseau talked about in the class, but not hard to figure out.
  3. And then run make qemu under the directory.

Hope this is helpful.

Some labs missing

Hi Prof,

It seems that Sort(text-based), Sort(binary), memory allocator, and web crawler lab are missing here. Can you provide the lab materials?

concurrency-webserver compiles with many warnings, has dangerous code

The concurrency-webserver directory builds, but produces about 15 warnings. The makefile specifies -Wall, but there's some quite dangerous code in the examples, and the compiler rightfully complains about it.

Here's the GCC version I'm using, on Ubuntu 20.04 LTS:

$ gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The errors are mostly about unchecked use of sprintf():

wclient.c:37:21: warning: ‘host: ’ directive writing 6 bytes into a region of size between 1 and 8192 [-Wformat-overflow=]
   37 |     sprintf(buf, "%shost: %s\n\r\n", buf, hostname);
      |                     ^~~~~~

and dubious behaviour expected of sprintf():

spin.c: In function ‘main’:
spin.c:41:13: warning: passing argument 1 to restrict-qualified parameter aliases with argument 3 [-Wrestrict]
   41 |     sprintf(content, "%s<p>My only purpose is to waste time on the server!</p>\r\n", content);
      |             ^~~~~~~                                                                  ~~~~~~~

Of course, those are just two of the 15 or so messages I get.

Students and readers will be baffled (or at least distracted) by these errors, so they should be fixed. It doesn't seem particularly good to present example code that allows buffer overruns.

Where is "Memory-allocation Library" lab?

Hello,

According to OSTEP book, there's a lab called "Memory Allocation", which requires students to implement some algorithms for dynamically allocating memory. But the README file does not provide its link, and I couldn't find any of its code in this repository.

I don't know whether I missed something or it just does not exist yet.

image

Adding notes of xv6 configuration for M1 Mac

Hi! Apple have migrated all their Mac to ARM M1 chip for 2 years, and stoped selling their old intel x86-64 product since 2020. In 2022, I noticed lots of my classmates using M1 Mac.

qemu and i386-jos-elf- both have ARM version, while gcc does not. But lldb is a practical substitute.

I tried to run the command make qemu-nox in my terminal

then the actual command generated is:

gcc -fno-pic -static -fno-builtin -fno-strict-aliasing -O2 -Wall -MD -ggdb -m32 -Werror -fno-omit-frame-pointer -fno-stack-protector   -c -o ulib.o ulib.c

Then I noticed the -ggdb option. I checked gcc's documentation, seems they only support gdb as the only one for debugging information.

Developing locally can improve efficiency dramatically to students, so just wondering if finishing xv6 project on M1 Mac is doable. (I'll also try to figure it out) Thanks!

[initial-xv6] test-getreadcount.sh: expect: spawn id exp4 not open

I modified the xv6 code to add getreadcount(), which for now just returns 42. However I'm having a problem with the testing script(s):

$ ./test-getreadcount.sh
doing one-time pre-test (use -s to suppress)
../tester/xv6-edit-makefile.sh: line 6: gawk: command not found
make: *** No rule to make target 'clean'.  Stop.
make: Nothing to be done for 'xv6.img'.
make: Nothing to be done for 'fs.img'.

test 1: out incorrect
  what results should be found in file: tests/1.out
  what results produced by your program: tests-out/1.out
  compare the two using diff, cmp, or related tools to debug, e.g.:
  prompt> diff tests/1.out tests-out/1.out

$ cat tests-out/1.err
expect: spawn id exp4 not open
    while executing
"expect "$ ""
    (file "../../tester/run-xv6-command.exp" line 25)

No warning if `/test-getreadcounts.sh` run without required dependencies

While working on initival-xv6 project, I ran the test script /test-getreadcounts.sh. Its resulting output showed test 1 had failed.

Digging deeper, I discovered the required dependency expect was not installed on my system. Directly running the test/1.run script, I received an error that expect could not be found.

However, there was no relevant warning or error displayed when I had run /test-getreadcounts.sh.

After installing expect, the test showed as passing.

process-run.py file

cannot find where this file is. Someone point this out?

This was mentioned in the homework section of Abstraction: The Process section.

The book: better clear formula 9.2

In CFS scheduler section of chapter 9, formula 9.2 gives: vruntimei=vruntimei+weight0/weighti·runtimei. But the text didn't describe what weight0 for. This might confusing newbies like me to "process 0's weight".

After searching, it showed weight0 may be the value of "nice 0" into prio_to_weight[40].

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.