1 / 24

Principles of Operating Systems: Design & Applications

Principles of Operating Systems: Design & Applications. Chapter 3 Inferno Structure and Initialization. Objectives. understand where Inferno fits into the history of operating system development have an appreciation for its position as a descendant of CTSS, Multics, UNIX, and Plan 9

sheryl
Download Presentation

Principles of Operating Systems: Design & Applications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Principles of Operating Systems: Design & Applications Chapter 3 Inferno Structure and Initialization

  2. Objectives • understand where Inferno fits into the history of operating system development • have an appreciation for its position as a descendant of CTSS, Multics, UNIX, and Plan 9 • understand key concepts that are probably unfamiliar: per-process name spaces, everything as a file server, and Styx

  3. Objectives (cont.)‏ • have a mental picture of how the major components of Inferno are organized and how the source code is organized • understand the division of labor between host-dependent and host-independent initialization • understand how and why the first kproc and the first user process are created “by hand”

  4. Objectives (cont.)‏ • understand how the system goes from its starting point to time-sharing • understand that the initial user process becomes the ancestor of all other processes that run during the lifetime of the system • understand how the system call mechanism of Inferno differs from that of most other systems

  5. Inferno History • Multics begat UNIX–Ken Thompson and Dennis Ritchie: 1969 • UNIX begat Plan 9–Ken Thompson and Rob Pike • Plan 9 begat Inferno • Vita Nuova purchased Inferno • Vita Nuova open sourced Inferno Principles of Operating Systems: Design & Applications 5

  6. Inferno Concepts • Native and Hosted operation • Hosted on FreeBSD, HP-UX, Irix, Linux, Mac OS X, Windows NT, Plan 9, Solaris, and Unixware • Native on CerfCube 1110, CerfCube 250, CerfCube 405, MPC8xx FADS development board, Ipaq , Brightstar ipEngine, JavaStation 1, Arm 7 evaluator kit, IBM PC compatibles, Embedded Planet RPXLite MPC823 Principles of Operating Systems: Design & Applications 6

  7. Inferno Concepts (cont.)‏ • Per-process name spaces • Can assemble name space from separate files and directories • Name spaces can be inherited • Everything is a file server • Extends the UNIX idea that (almost) everything is a file • Directories and files provided by file servers • File servers both built in to the kernel and run as normal applications Principles of Operating Systems: Design & Applications 7

  8. Inferno Concepts (cont.)‏ • Styx • Used by all File servers • Limbo and Dis • All apps written in Limbo • Limbo compiled to Dis • Dis runs the same on all host OSs and hardware • Just-in-time compilers for most platforms Principles of Operating Systems: Design & Applications 8

  9. Inferno Structure Principles of Operating Systems: Design & Applications 9

  10. Source Directory Structure Principles of Operating Systems: Design & Applications 10

  11. Inferno Initialization • Process command line arguments and environment parameters • Identify the host owner • Do host OS-specific initialization • Create first kernel process • Initialize devices • Build initial name space Principles of Operating Systems: Design & Applications 11

  12. Inferno Initialization (cont.)‏ • Create second kproc to run Dis VM • Create initial floating-point state • Initialize the Dis VM • Load the initial Dis module and set it to ready • Start the Dis VM Principles of Operating Systems: Design & Applications 12

  13. In emu/port/main.c: main()‏ Process Parameters: if((p = getenv("INFERNO")) != nil || (p = getenv("ROOT")) != nil)‏ strecpy(rootdir, rootdir+sizeof(rootdir), p); opt = getenv("EMU"); if(opt != nil && *opt != '\0') { enva[0] = "emu"; envc = tokenize(opt, &enva[1], sizeof(enva)-1) + 1; enva[envc] = 0; option(envc, enva, envusage); } option(argc, argv, usage); Principles of Operating Systems: Design & Applications 13

  14. In emu/port/main.c: main()‏ Set Initial Host Owner eve = strdup("inferno"); Call Host OS-Specific Initialization libinit(imod); Principles of Operating Systems: Design & Applications 14

  15. In emu/Linux/os.c: libinit()‏ Create First kproc p = newproc(); p->kstack = stackalloc(p, &tos); pw = getpwuid(getuid()); if(pw != nil)‏ kstrdup(&eve, pw->pw_name); else print("cannot getpwuid\n"); p->env->uid = getuid(); p->env->gid = getgid(); executeonnewstack(tos, emuinit, imod); Principles of Operating Systems: Design & Applications 15

  16. In emu/port/main.c: emuinit()‏ Initialize Devices chandevinit(); Create Name Space Root e->pgrp->slash = namec("#/", Atodir, 0, 0); cnameclose(e->pgrp->slash->name); e->pgrp->slash->name = newcname("/"); e->pgrp->dot = cclone(e->pgrp->slash); Principles of Operating Systems: Design & Applications 16

  17. In emu/port/main.c: emuinit()‏ Open Standard Input, Output, and Error if(kopen("#c/cons", OREAD) != 0)‏ fprint(2, "failed to make fd0 from #c/cons: %r\n"); kopen("#c/cons", OWRITE); kopen("#c/cons", OWRITE); Principles of Operating Systems: Design & Applications 17

  18. In emu/port/main.c: emuinit()‏ Create Initial Name Space kbind("#U", "/", MAFTER|MCREATE); setid(eve, 0); kbind("#^", "/dev", MBEFORE); /* snarf */ kbind("#^", "/chan", MBEFORE); kbind("#m", "/dev", MBEFORE); /* pointer */ kbind("#c", "/dev", MBEFORE); kbind("#p", "/prog", MREPL); kbind("#d", "/fd", MREPL); kbind("#I", "/net", MAFTER); /* will fail on Plan 9 */ Principles of Operating Systems: Design & Applications 18

  19. In emu/port/main.c: emuinit()‏ Create First Dis Interpreter kproc("main", disinit, imod, KPDUPFDG|KPDUPPG|KPDUPENVG); Principles of Operating Systems: Design & Applications 19

  20. In emu/port/dis.c: disinit()‏ Create Initial Floating Point State Fpinit(); Fpsave(&up->env->fpu); Initialize Dis VM opinit(); modinit(); excinit(); Principles of Operating Systems: Design & Applications 20

  21. In emu/port/dis.c: disinit()‏ Load Initial Module root = load(initmod); Schedule Initial Module p = schedmod(root); Start the Virtual Machine vmachine(nil); Principles of Operating Systems: Design & Applications 21

  22. System Calls • Apps see ordinary cross-module function calls • System calls in module, Sys • Sys module built in to kernel • Calls kernel functionality with normal function calls Principles of Operating Systems: Design & Applications 22

  23. Summary • Inferno derives from a long line of research operating systems • Inferno has a number of unique features • Initialization covers everything from beginning to time-sharing • System calls implemented through special module Principles of Operating Systems: Design & Applications 23

  24. Principles of Operating Systems: Design & Applications 24

More Related