Download presentation
Presentation is loading. Please wait.
Published byWilla Anderson Modified over 6 years ago
1
Using Virtual Machines to Teach CS-502 Operating Systems
PEDS November 6, 2006 Assumptions: Graduate level Operating Systems Making Choices about operation systems Why a micro-century? …just about enough time for one concept PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
2
Using Virtual Machines to Teach CS-502
Problem Project work in Operating Systems course has a “make believe” quality about it Fossil Lab not available to M. Sc. Students Part-time students not present on campus — so could not use Fossil Lab even if available User space projects do not demystify the system infrastructure Too much of what OS does is still hidden from students No practical experience about insides of OS PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
3
Using Virtual Machines to Teach CS-502
Approach Create VMware virtual machine with Linux Assign programming projects inside kernel Expose Workings of an OS kernel Differences between working inside of OS and outside Practical experience with principles that we teach PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
4
Using Virtual Machines to Teach CS-502
This Presentation An interim report on experiences in CS-502 during Fall 2006 Practical problems with using VMware Successes and missteps Pedagogical issues Problem assignments Grading PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
5
Using Virtual Machines to Teach CS-502
Starting out Created VMware virtual machine on csopt4 SUSE Linux 9.3 same as CS Department 5 GByte hard drive, 256 MByte RAM, single processor NAT (Network Address Translation) networking VMware Tools installed Students copy virtual machine to own directories Minor adjustment to change Ethernet MAC address Students access remotely on or off campus via VMware Console (aka VMware client) PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
6
Panic in system team! 20-21 registered students, implies 100+ gigabytes on /xtra_space Close to total available space; Pressure on disk drives; Pressure on processors PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
7
Using Virtual Machines to Teach CS-502
Another Problem VMware console is awkward and jerky to use from off campus To the point of being impractical to use Affects about ½ to ¾ of students PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
8
Solution (to both problems)
Created a virtual machine using my own copy of VMware Workstation on my Pentium at home Includes VMware Tools (needed for display) Copied onto DVDs, distributed to class Also on CDs; also available for download from csopt4 Most students downloaded VMware Player Freeware player capable of running virtual machines created on other VMware products No snapshots, no reconfiguration of VM, etc. Three students chose to remain on csopt4 One elected to switch to VMware Player for next project Two students created own virtual machines on Macintosh Parallels (Intel platform) Instructions published on course web-site PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
9
Using Virtual Machines to Teach CS-502
Recommended Resource Robert Love, Linux Kernel Development, 2nd edition, Novell Press, 2005 Other kernel development books are available PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
10
Using Virtual Machines to Teach CS-502
Practical Issues Networking — bridged vs. NAT Wireless users on campus must use NAT Macintosh Parallels does not offer NAT Must use web-based turnin program CCC turnin too awkward from virtual machine Incompatible virtual machines Pentium and Opteron (csopt4) are different kinds of CPUs Virtual machines constructed on one do not run on other Kernel projects developed on one are incompatible at source code level with those of the other Network connections are fragile Seem to fail when new kernels are installed; no solution yet PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
11
Using VMware Player on a Windows PC
Full Linux with KDE desktop environment, Mozilla browser, etc. GUI based system administration (YaST) & other tools Uniform compiler, build environment, etc. VM runs either in window or full-screen Rapid switch between Windows and VM First class citizen on my home network Good, responsive performance even with other Windows applications active Missing: cut, copy, paste between Windows and Linux PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
12
Using Virtual Machines to Teach CS-502
Building Linux Kernel Create copy-on-write tree cp –al /usr/src/linux kernelSrc Edit kernel by replacing files within tree Automatic with EMACS, patch Needs extra step with vi, kwrite, Eclipse, etc. Build to separate build tree make O=~/kernelBuild xconfig (or oldconfig) make O=~/kernelBuild Install make O=~/kernelBuild modules_install install Automatically installs in grub PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
13
Using Virtual Machines to Teach CS-502
Build performance Entire kernel from scratch Approx 1 hour on 3-GHz, 1-Gigabyte Pentium Approx 40 minutes on csopt4 Opteron Rebuild with new label ~ 30 minutes on 3-GHz, 1-Gigabyte Pentium < 20 minutes on csopt4 Opteron Rebuild with same label (make oldconfig) 5 minutes on 3-GHz, 1-Gigabyte Pentium < 2 minutes on csopt4 Opteron PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
14
Submitting Kernel Project
Create patch file diff -urN /usr/src/linux kernelSrc Submit patch file test program(s) Makefile to build test programs Write-up, etc. Notes: Building to separate build-tree keeps junk out of patch file Symbolic link in original kernel source adds junk to patch PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
15
Preparing to Grade a Kernel Project
Build entire kernel (on each machine type) cp –al /usr/src/linux kernelSrc cd kernelSrc make O=~/kernelBuild xconfig make O=~/kernelBuild Fetch students’ submissions from turnin Expand to separate directories for each student Take snapshot of virtual machine Allows restoring to same state for each student Keeping same label on kernel minimizes rebuild time PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
16
Grading Kernel Project
Restore virtual machine to snapshot for each student Patch and rebuild cd kernelSrc patch –p1 < {student’s patch file} make O=~/kernelBuild oldconfig make O=~/kernelBuild Install, reboot, and test make O=~/kernelBuild modules_install install reboot cd {student’s directory} make run tests About minutes to actually build and test per student PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
17
Using Virtual Machines to Teach CS-502
Problems and Issues Building and installing new kernel seems to make network fail May be due to VMware Tools vs. kernel modules Installation order is critical (modules must be 1st!) make O=~/kernelBuild modules_install install make install assumes new kernel is default Can be corrected by copying and modifying scripts /sbin/installkernel and /sbin/mkinitrd printk() output doesn’t appear on syslog Seems to be filtered; unable to find correct settings Use cat /proc/kmsg or /bin/dmesg instead PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
18
Problems and Issues (continued)
printf semantics don’t work in printk Ability to embed “%d” in strings, etc. Plenty of examples in kernel where it is supposed to work! make gconfig doesn’t work Superior interface for configuration Some Gnome libraries are missing from virtual machine; don’t know which Grader needs access to tools VMware Workstation, PC big enough to run it Printing in general Works fine in my home network via CUPS Haven’t been able to set up in CS Department PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
19
Problems and Issues (continued)
No practical way for students to back up their work Untried: ability to map to drives on other machines Possibility: USB flash drive Alternative: create a virtual machine with two hard disks (one for kernel, one for user) This problem needs a solution — the whole idea of the virtual machine is to be able to safely make mistakes! PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
20
Using Virtual Machines to Teach CS-502
Project Assignments Project #1 completed Add a system call and use printk() Project #2 in progress Mailbox and messaging system Optionally use kdb Project #3 to be assigned TBD, probably Page replacement PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
21
Project #1 — Add a system call
Learn to build kernel Claypool, “Linux dabbling” Add “Hello, world” system call, use printk Silbershatz, Chapter 2 project Add getprinfo system call Prof. Jason Nieh (Columbia Univ) Three weeks total Could be reduced to two weeks when bugs are ironed out Educational value Kernels are different (and difficult) A lot of fumbling before running Overcome the intimidation of reaching inside something “magic” PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
22
Project #2 – Mailbox and Message system
Patterned after similar user-space projects of previous terms Lauer, Tabloski, Wills, etc. Educational value Memory allocation, esp. in kernel Synchronization via semaphores, reader-writer locks Difference between kernel code and user-space wrapper This turns out to be a really hard project Even in user space! PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
23
Using Virtual Machines to Teach CS-502
Other Kernel Projects Nieh Thread synchronization GWRR scheduling Page replacement algorithm Access control lists for files Claypool Linux Dabbling Background scheduling policy Hidden processes Process, thread accounting PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
24
Using Virtual Machines to Teach CS-502
Teaching Goals Kernel is not magic Kernel is not like any other program Cement the fundamental concepts of an operating system course Ability to say at a job interview:– “Yes indeed, I have worked inside a major OS kernel.” PEDS, November 6, 2006 Using Virtual Machines to Teach CS-502
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.