Running on the Bare Metal with GeekOS

Similar documents
Embedded Linux Architecture

Operating System. Operating System Overview. Structure of a Computer System. Structure of a Computer System. Structure of a Computer System

CSI3131 Final Exam Review

Main Points of the Computer Organization and System Software Module

Exam Guide COMPSCI 386

CS307 Operating Systems Introduction Fan Wu

Kernel Types Simple OS Examples System Calls. Operating Systems. Autumn CS4023

Operating System Architecture. CS3026 Operating Systems Lecture 03

The Performance of µ-kernel-based Systems

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT I

Linux Operating System

TDDI04, K. Arvidsson, IDA, Linköpings universitet Operating System Structures. Operating System Structures Overview. Operating System Services

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Operating-System Structures

Unit 2 : Computer and Operating System Structure

Chapter 15: The Linux System

Chapter 15: The Linux System. Operating System Concepts Essentials 8 th Edition

Operating System: Chap2 OS Structure. National Tsing-Hua University 2016, Fall Semester

Example Sheet for Operating Systems I (Part IA)

CS350: Final Exam Review

Outline Background Jaluna-1 Presentation Jaluna-2 Presentation Overview Use Cases Architecture Features Copyright Jaluna SA. All rights reserved

MARUTHI SCHOOL OF BANKING (MSB)

Chapter 21: The Linux System. Chapter 21: The Linux System. Objectives. History. The Linux Kernel. Linux 2.0

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Build an Operating System from Scratch: A Project for an Introductory Operating Systems Course

Operating System Kernels

Example Sheet for Operating Systems I (Part IA)

Last class: OS and Architecture. OS and Computer Architecture

Last class: OS and Architecture. Chapter 3: Operating-System Structures. OS and Computer Architecture. Common System Components

Sistemi in Tempo Reale

Chapter 3: Operating-System Structures

OS and Computer Architecture. Chapter 3: Operating-System Structures. Common System Components. Process Management

COS 318: Operating Systems

Module 20: The Linux System

Chapter 2: Operating-System Structures

Extensible Kernels: Exokernel and SPIN

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Chapter 2. Operating-System Structures

Notes to Instructors Concerning the BLITZ Projects

File System Performance (and Abstractions) Kevin Webb Swarthmore College April 5, 2018

Module 3: Operating-System Structures. Common System Components

Operating Systems. Operating System Structure. Lecture 2 Michael O Boyle

EEE 435 Principles of Operating Systems

OS structure. Process management. Major OS components. CSE 451: Operating Systems Spring Module 3 Operating System Components and Structure

Chapter 21: The Linux System

Introduction: Context Switch

OS - Introduction Ezio Bartocci Institute for Computer Engineering

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Chapter 2: Operating-System Structures

Chapter 2: System Structures

Chapter 2: Operating-System Structures

Advanced Operating Systems. COMP9242 Introduction

Linux Kernel Architecture

Chapter 2: Operating-System Structures. Operating System Concepts 9 th Edit9on

CS 5460/6460 Operating Systems

Processes and Threads

OS concepts and structure. q OS components & interconnects q Structuring OSs q Next time: Processes

Kid Operating System

Chapter 2: Operating-System Structures

Operating Systems (2INC0) 2018/19. Introduction (01) Dr. Tanir Ozcelebi. Courtesy of Prof. Dr. Johan Lukkien. System Architecture and Networking Group

CS 5523 Operating Systems: Memory Management (SGG-8)

Chapter 2: Operating-System Structures. Chapter 2: Operating-System Structures. Objectives. Operating System Services

The microkernel OS Escape

Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering)

Operating Systems Structure and Processes Lars Ailo Bongo Spring 2017 (using slides by Otto J. Anshus University of Tromsø/Oslo)

Module 22: The Linux System

Lecture 4: Memory Management & The Programming Interface

Background: Operating Systems

IO-Lite: A Unified I/O Buffering and Caching System

Operating-System Structures

CSE 153 Design of Operating Systems

Virtual Memory Outline

An Overview of the BLITZ System

Chapter 2: Operating-System Structures. Operating System Concepts Essentials 8 th Edition

CMPS 111 Spring 2003 Midterm Exam May 8, Name: ID:

VIREOS: An Integrated, Bottom-Up, Educational Operating Systems Project with FPGA Support

Chapter 2: Operating-System

Operating System Review

CHAPTER 2: SYSTEM STRUCTURES. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Contents. 1.1 What Operating Systems Do Computer-System Organization Computer-System Architecture 12. Operating-System Structures

CSE 410: Systems Programming

Systems I: Programming Abstractions

Staff. Advanced Operating Systems. Why are you here? What can you expect?

Caching and Demand-Paged Virtual Memory

Chapter 3: Operating-System Structures

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

CPS 210: Operating Systems

LINUX OPERATING SYSTEM Submitted in partial fulfillment of the requirement for the award of degree of Bachelor of Technology in Computer Science

Here to take you beyond. ECEP Course syllabus. Emertxe Information Technologies ECEP course syllabus

Course Contents/Syllabus: Weightage (%) Module I: Introduction to operating system: 15

CSE 120 Principles of Operating Systems

COS 318: Operating Systems

To Everyone... iii To Educators... v To Students... vi Acknowledgments... vii Final Words... ix References... x. 1 ADialogueontheBook 1

Today: Protection! Protection!

Spring 2017 :: CSE 506. Introduction to. Virtual Machines. Nima Honarmand

Last 2 Classes: Introduction to Operating Systems & C++ tutorial. Today: OS and Computer Architecture

L4/Darwin: Evolving UNIX. Charles Gray Research Engineer, National ICT Australia

Four Components of a Computer System

OPERATING SYSTEMS INTERNALS AND DESIGN PRINCIPLES. William Stallings SIXTH EDITION. Pearson Education International. Prentice Hall

Operating-System Structures

Transcription:

Running on the Bare Metal with GeekOS David Hovemeyer, Jeffrey K. Hollingsworth, and Bobby Bhattacharjee University of Maryland, College Park 1

Outline Motivation Overview Projects Classroom Experience Conclusions 2

OS Kernel == Magic An operating system kernel is a program But, it makes the execution of other programs possible! This is a mind expanding idea Sort of like recursion: a snake eating its own tail Our belief: the operating system course should be faithful to this idea 3

How Are OS Projects Designed? Many approaches out there: High level simulation [e.g., Dickinson SIGCSE 2000] User mode process [e.g., Minix/Solaris] Java? CPU simulator + user level threads [e.g., Nachos] Emulator [e.g., System/161] Real Hardware [e.g., Minix, Topsy] 4

Our Approach Target commodity hardware platform (x86 PC) We provide minimal foundation, students build real, complete OS on top of it Students add processes, VM, filesystem, IPC Two motivations: Philosophical Practical 5

Philosophical Motivations Targeting real hardware 100% realism Peel away all layers of abstraction Intellectual satisfaction So that's how it works! Try it out on a real machine Students can do this at the end of the course! 6

Practical Motivations x86 fairly easy to program Tool support is outstanding GCC, binutils, gdb, nasm Bochs emulator Lots of good documentation in books, on web 7

Outline Motivation Overview Projects Classroom Experience Conclusions 8

GeekOS Facts Project hosted at Sourceforge: http://geekos.sourceforge.net Current version: 0.2.0 Free software (MIT license) Includes manual with projects We do not publically distribute project solutions 9

Overview of GeekOS Written in C and x86 assembly Size: Minimal configuration: 7100 lines Maximal configuration (all drivers, VFS, buffer cache, stubs for console, pipes, VM): 13300 lines All projects completed: 17000 lines These figures include whitespace, comments, assertions, debug statements 10

GeekOS Features Threads, memory allocation, drivers for essential devices VFS layer, read only filesystem (for loading programs), system call layer Minimal C library, small collection of user programs Students add everything else! 11

Outline Motivation Overview Projects Classroom Experience Conclusions 12

GeekOS and Bochs We develop and run GeekOS using the Bochs emulator: http://bochs.sourceforge.net Advantages over running on actual hardware: Runs as ordinary user mode process Boots in seconds Extensive diagnostics, debugging with gdb 13

Project 1 User Mode Students add user processes using segmentation for memory protection Programs loaded from ELF executables Each process allocated a fixed, contiguous block of memory Segmentation is easier than paging 14

Project 2 Scheduling Original scheduler is static priority, round robin Students implement Alternative scheduler with dynamic priorities Semaphores Students measure and evaluate both schedulers under workloads we provide So they understand how the new scheduler addresses shortcomings of the original scheduler 15

Project 3 Virtual Memory Students replace the segmentation based user mode with one based on paging When no free pages are available, a victim is selected using LRU and paged out Page fault handler: Stack faults (add new page for accesses in red zone) Page in previously evicted pages 16

Project 4 Filesystem Students implement a hierarchical read/write filesystem Students must handle locking for files and directories accessed concurrently 17

Project 5 Interprocess Communication Students extend the VFS to include The console (keyboard and screen) Pipes (anonymous, half duplex, like Unix) ACLs are added to the filesystem Each process gets a uid 18

Demo 19

Outline Motivation Overview Projects Classroom Experience Conclusions 20

Classroom Experience Classroom experience has been positive Most students find GeekOS to be relatively easy to work with Using Bochs is a win Good diagnostics when things go wrong Much easier than dealing with actual hardware Lots of possibilities for alternative projects Combat plagarism 21

Outline Motivation Overview Projects Classroom Experience Conclusions 22

Conclusions Targeting real hardware platform is a viable choice Intellectually satisfying A good emulator makes it practical Instructors can easily choose how low level they want students to get Students gain experience with system level programming 23

Future Work Fix bugs, improve documentation Make GeekOS smaller and simpler Port to a safe C dialect such as Cyclone Statically demonstrate absence of memory errors! 24

Related Work Minix (real hardware, complete OS) Nachos (user process + CPU simulator) OS/161 (emulator, close to real HW) Topsy (microkernel, embedded MIPS target) Many others... 25

Questions? 26

Feature Comparison OS Target Microkernel? Lines Minix x86, others Yes 32000 Nachos MIPS (CPU sim) No 9000 OS/161 MIPS (emulator) No 15000 Topsy MIPS (embedded) Yes 13000 GeekOS x86 PC No 13000 Of these, only Minix and GeekOS target commodity hardware 27

Motivation Why another educational OS? We wanted two properties: Realism: target a real hardware platform Simplicity: make it as simple as possible Give students a feel for real kernel hacking Without overwhelming them with detail 28

How is GeekOS Different? GeekOS is different mainly in that It targets commodity hardware It tries to be minimal What we provide is merely a foundation Students build all of the interesting parts of the kernel 29

Core Services GeekOS provides the minimum functionality needed to build higher level services: Memory allocation: page and heap Interrupt handling Threads (with preemptive task switching) Device drivers: screen, keyboard, floppy, IDE disk VFS layer, minimal read only filesystem System call layer 30

GeekOS Userland Minimal libc: Console I/O, file I/O, subprocess support, string routines Does not adhere to any standard API Small set of user programs Shell, file and directory utils 31

Projects Students implement features of a modern kernel: Multilevel feedback scheduler User processes with paged virtual memory Read/write hierarchical filesystem Pipes When finished, resembles a simple version of Unix 32

x86 PC is a Good Platform Targeting the x86 PC has many practical benefits: Excellent tool support: Linux and FreeBSD come with complete GeekOS friendly toolchain installed by default x86 is easy to program Lots of good documentation for system level programming 33