principles of operating systems: design & applications
DESCRIPTION
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 - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/1.jpg)
Principles of Operating Systems:Design & Applications
Chapter 3
Inferno Structure and Initialization
![Page 2: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/2.jpg)
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
![Page 3: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/3.jpg)
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”
![Page 4: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/4.jpg)
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
![Page 5: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/5.jpg)
Principles of Operating Systems: Design & Applications 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
![Page 6: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/6.jpg)
Principles of Operating Systems: Design & Applications 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
![Page 7: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/7.jpg)
Principles of Operating Systems: Design & Applications 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
![Page 8: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/8.jpg)
Principles of Operating Systems: Design & Applications 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
![Page 9: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/9.jpg)
Principles of Operating Systems: Design & Applications 9
Inferno Structure
![Page 10: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/10.jpg)
Principles of Operating Systems: Design & Applications 10
Source Directory Structure
![Page 11: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/11.jpg)
Principles of Operating Systems: Design & Applications 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
![Page 12: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/12.jpg)
Principles of Operating Systems: Design & Applications 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
![Page 13: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/13.jpg)
Principles of Operating Systems: Design & Applications 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);
![Page 14: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/14.jpg)
Principles of Operating Systems: Design & Applications 14
In emu/port/main.c: main()Set Initial Host Owner eve = strdup("inferno");
Call Host OS-Specific Initialization libinit(imod);
![Page 15: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/15.jpg)
Principles of Operating Systems: Design & Applications 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);
![Page 16: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/16.jpg)
Principles of Operating Systems: Design & Applications 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);
![Page 17: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/17.jpg)
Principles of Operating Systems: Design & Applications 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);
![Page 18: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/18.jpg)
Principles of Operating Systems: Design & Applications 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 */
![Page 19: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/19.jpg)
Principles of Operating Systems: Design & Applications 19
In emu/port/main.c: emuinit()Create First Dis Interpreter kproc("main", disinit, imod, KPDUPFDG|KPDUPPG|KPDUPENVG);
![Page 20: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/20.jpg)
Principles of Operating Systems: Design & Applications 20
In emu/port/dis.c: disinit()Create Initial Floating Point State Fpinit(); Fpsave(&up->env->fpu);
Initialize Dis VM opinit(); modinit(); excinit();
![Page 21: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/21.jpg)
Principles of Operating Systems: Design & Applications 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);
![Page 22: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/22.jpg)
Principles of Operating Systems: Design & Applications 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
![Page 23: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/23.jpg)
Principles of Operating Systems: Design & Applications 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
![Page 24: Principles of Operating Systems: Design & Applications](https://reader035.vdocuments.us/reader035/viewer/2022062520/56815bd4550346895dc9c691/html5/thumbnails/24.jpg)
Principles of Operating Systems: Design & Applications 24