CS330 Project: Pintos Overview - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

CS330 Project: Pintos Overview

Description:

Install a proper Linux distribution on your machine ... Project documentation. Refer to Appendix D in the pintos document. Coding standard. Style ... – PowerPoint PPT presentation

Number of Views:558
Avg rating:3.0/5.0
Slides: 22
Provided by: Jin106
Category:

less

Transcript and Presenter's Notes

Title: CS330 Project: Pintos Overview


1
CS330 Project Pintos Overview
??? Computer Architecture Lab. (Division of
Computer Science, KAIST)
2
Welcome to Pintos World!
  • What is Pintos?
  • An instructional operating system
  • Developed by Stanford university
  • A few of the source files are derived from code
    used in the MIT OS course
  • A real OS for 80x86 architecture (c.f. nachos)
  • Run on a regular IBM-compatible PC or an x86
    simulator
  • The original structure and form was inspired by
    the nachos
  • Written in C language
  • These projects are hard. Hang on!

3
Project Schedule
  • Project 0 Warming-up (1 week)
  • Project 1 Threads (2 weeks) ??? ??
  • Project 2 User Programs (3 weeks) ??? ??
  • Project 3 Virtual Memory (5 weeks) ??? ??
  • Project 4 File System (3 weeks)

4
System Startup (1/5)
  • Overview
  • BIOS
  • Boot Loader
  • Kernel Initialization

5
System Startup (2/5)
  • The BIOS
  • The CPU initializes itself and then executes an
    instruction at a fixed location (0xffff ffff0)
  • This instruction jumps into the BIOS
  • The BIOS finds a boot device and loads its first
    sector into memory
  • Starting from physical address 0x0000 7c00
  • The first sector contains the Pintos loader
    (threads/loader.S)
  • The BIOS transfers control to the loader

6
System Startup (3/5)
  • The boot loader
  • Enables memory accesses beyond first 1 MB
  • For historical reasons, this initialization is
    required
  • Asks the BIOS for the PCs memory size
  • Again for historical reasons, the function we use
    can only detect up to 64MB of RAM (This is the
    limit that Pintos can support)
  • The memory size is stored in the loader that the
    kernel can read after it boots
  • Creates a basic page table
  • This page table maps the 64 MB at the base
    (starting at virtual address 0) directly to
    identical physical address
  • It also maps the same physical memory starting at
    virtual address LOADER_PHYS_BASE (0xc000 0000)

7
System Startup (4/5)
  • The boot loader (contd)
  • Turns on protected mode and paging
  • Interrupts are still disabled
  • Loads the kernel from disk
  • Assumptions
  • The kernel is stored starting from the second
    sector of the first IDE disk
  • The BIOS has already set up the IDE controller
  • The loader loads the kernel starting 1 MB into
    physical memory
  • Jumps to the start of compiled kernel image
  • Using the linker script (thread/kernel.lds.S)

8
System Startup (5/5)
  • Kernel initialization
  • Clearing BSS, and get machines RAM size
  • Initializing threads system
  • Initializing VGA, serial port, and console
  • To print a startup message to the console
  • Greeting user and reading kernel command line
  • Kernel command line
  • Initializing memory system
  • Initializing random number generator and
    interrupt system
  • Starting thread scheduler and enabling interrupts
  • Initializing file system

9
Environments
  • Bochs
  • IA-32 emulator
  • We will run Pintos on this emulator
  • Bochs makes it easy to develop and debug Pintos
    projects
  • Linux Bochs
  • If you have an available Linux machine, we
    recommend this environment

10
Linux Bochs (1/4)
  • Linux
  • If you will use cc12-14 nodes, you may skip this.
  • Install a proper Linux distribution on your
    machine
  • Such as Fedora, Debian, Ubuntu, or whatever you
    like
  • You can use a pre-installed Linux machine
  • Install X development libraries
  • Install development tools
  • Including gcc, make, perl, gdb (option) and so
    on

11
Linux Bochs (2/4)
  • X Window Server to the Windows
  • Xmanager recommended
  • Xmanager Enterprise 2.1
  • Xming
  • VNC
  • Or similar

12
Linux Bochs (3/4)
  • Bochs
  • If you will use cc12-14 nodes, you may skip this
    installation.
  • Get the source (the 2.2.6 version)
  • http//bochs.sourceforge.net/getcurrent.html
  • Install bochs
  • Must use patches in pintos.
  • Using script. ( pintos/src/misc/bochs-2.2.6-build.
    sh )
  • yjlee_at_cc14 misc ./bochs-2.2.6-build.sh
  • usage env SRCDIRltsrcdirgt
    PINTOSDIRltsrcdirgt DSTDIRltdstdirgt sh
    ./bochs-2.2.6-build.sh
  • where ltsrcdirgt contains bochs-2.2.6.tar.gz
  • and ltpintosdirgt is the root of the pintos
    source tree
  • and ltdstdirgt is the installation prefix (e.g.
    /usr/local)
  • yjlee_at_cc14 miscenv SRCDIR/home/yjlee/bochs-2.2
    .6/ PINTOSDIR/home/yjlee/pintos
    DSTDIR/usr/local/ sh /home/yjlee/pintos/src/bochs
    -2.2.6-build.sh
  • Maybe need the latest version of Binutils Make.

13
Linux Bochs (4/4)
  • Pintos
  • Get the source
  • http//www.stanford.edu/class/cs140/pintos/pintos.
    tar.gz
  • Extract the source for Pintos into pintos/src
  • tar xzf pintos.tar.gz
  • Test your installation
  • cd pintos/src/threads
  • make
  • ../utils/pintos run alarm-multiple

14
Building Pintos
  • Building Pintos
  • Use make command in each of project folders
  • threads, userprog, vm, and filesys
  • Interesting files (in the build directory)
  • kernel.o, kernel.bin, loader.bin, and os.dsk

15
Running Pintos
  • Running Pintos
  • Add pintos/src/utils folder to PATH
  • Execute pintos option -- argument
  • Option
  • Configuring the simulator or the virtual hardware
  • Argument
  • Each argument is passed to Pintos kernel verbatim
  • pintos run alarm-multiple instructs the kernel
    to run alarm-multiple
  • Pintos script
  • Parse command line
  • Find disks
  • Prepare arguments
  • Run VM (bochs)

16
Grading
  • Testing
  • make check (in build directory)
  • Design
  • Demonstration
  • Design document
  • Data structure
  • Algorithm
  • Synchronization
  • Rationale
  • Source code
  • Refer to the pintos document by Ben Pfaff

17
Misc.
  • Project documentation
  • Refer to Appendix D in the pintos document
  • Coding standard
  • Style
  • C99
  • Unsafe string functions

18
Useful Tools
  • Gdb
  • The GNU Project debugger, allows you to see what
    going on inside another program while it executes
  • Tags
  • An index to the functions and global variables
  • make tags in pintos/src
  • CVS
  • A version control system

19
Cheating
  • What is cheating?
  • Any attempt to represent another persons work as
    your own
  • What is not cheating?
  • Helping others use systems or tools
  • Helping others with high-level design issues
  • Helping others debug their code
  • Sharing useful information for the problem
  • Cheating will not be tolerated in this course!
  • Anyone who involved in cheating will be penalized

20
Project 0 Warming-up (1/2)
  • Prepare your environment
  • Choose an development environment for Pintos
  • Install the required tools and Pintos
  • Assignments
  • Test your installation and capture it
  • The capture(s) should contain
  • Your OS (Linux, and so on)
  • A result of Pintos execution
  • pintos run alarm-multiple (in pintos/src/threads
    folder)

21
Project 0 Warming-up (2/2)
  • Assignments (contd)
  • Write a document about how the above test works
  • Add a new test program
  • A new test prints hello, world! (refer to
    pintos/src/tests/threads)
  • You should submit screen shot(s) of a result of
    the following command
  • pintos run hello (in pintos/src/threads folder)
  • Due data
  • 4/7 (Sat) ??, email to yjlee_AT_camars.kaist.ac.kr
Write a Comment
User Comments (0)
About PowerShow.com