Project 4b: xv6 ThreadsOverviewIn this project, you'll be adding real kernel threads to xv6. Sound like fun? Well, it should. Because you are on your way to becoming a real kernel hacker. And what could be more fun than that? Specifically, you'll do three things. First, you'll define a new system
call to create a kernel thread, called DetailsYour new clone system call should look like this: The other new system call is You also need to think about the semantics of a couple of existing system
calls. For example, Your thread library will be built on top of this, and just have a simple
Your thread library should also have a simple spin lock. There should be a
type To test your code, use the TAs tests, as usual! But of course you should write your own little code snippets to test pieces as you go. One thing you need to be careful with is when an address space is grown by a thread in a multi-threaded process. Trace this code path carefully and see where a new lock is needed and what else needs to be updated to grow an address space in a multi-threaded process correctly. ContestThe contest for this project will be a little different than usual: it is based on who builds the best threads library, which should be more fully functional than what is specified above. It can include things like condition variables (as well as demonstrations that they work), more advanced locks than spin locks (like ones that go to sleep when they cannot acquire the lock), and other advanced features as discussed in the book. The best few submissions will be selected for a demo, and then the best overall threading system will be chosen. The CodeThe code (and associated README) can be found in ~cs537-1/ta/xv6/ . Everything you need to build and run and even debug the kernel is in there, as before. As usual, it might be good to read the xv6 book a bit: Here . You may also find this book useful: Programming from the Ground Up . Particular attention should be paid to the first few chapters, including the calling convention (i.e., what's on the stack when you make a function call, and how it all is manipulated). |