Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Biscuit: an operating system written in go

559 visualizaciones

Publicado el

Biscuit is a monolithic operating system kernel that is written in Go. This talk introduces the kernel and demonstrate how to build, install, and analyze the code.

Publicado en: Tecnología
  • Sé el primero en comentar

Biscuit: an operating system written in go

  1. 1. Biscuit: An Operating System Written in Go SeongJae Park <sj38.park@gmail.com>
  2. 2. These slides were presented for 1st GDG Golang Korea Meetup (https://www.meetup.com/GDG-Golang-Korea/events/261344405/)
  3. 3. This work by SeongJae Park is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/.
  4. 4. I, SeongJae Park ● SeongJae Park <sj38.park@gmail.com> ● PhD candidate at Seoul National University ● Interested in memory management and parallel programming in OS kernels
  5. 5. The kernels are written in the C language ● The C language was designed for the operating system kernel (UNIX) ● Most popular *NIX kernels (C, BSD UNIXs, ...) are written in the C language https://www.oldcomputerbooks.com/pictures/C810975.jpg?v=1315840637
  6. 6. Why not the C++? > When I first looked at Git source code two things struck me as odd: > 1. Pure C as opposed to C++. No idea why. Please don't talk about > portability, it's BS. *YOU* are full of bullshit. C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much much easier to generate total and utter crap with it. Quite frankly, even if the choice of C were to do *nothing* but keep the C++ programmers out, that in itself would be a huge reason to use C. - Linus Torvalds, 2007-09-06 (https://lwn.net/Articles/249460/)
  7. 7. … How about Go? >I wonder what is your opinion about the Go language. Does >it look like a move in the right direction? Hey, I think Go picked a few good and important things to look at, but I think they called it "experimental" for a reason. I think it looks like they made a lot of reasonable choices. But introducing a new language? It's hard. Give it a couple of decades, and see where it is then. - Linus Torvalds, 2010-06-08 (https://www.realworldtech.com/forum/?curpostid=104302&threadid=104196) ● Almost one decade has already passed (It’s 2019-05-30, now)...
  8. 8. Biscuit: An OS kernel in a high-level language ● Biscuit is a monolithic, POSIX-subset operating system kernel in Go ● A research project of the MIT PDOS lab ● Code is available (https://github.com/mit-pdos/biscuit) ● The paper about the project has published to OSDI’18 https://pdos.csail.mit.edu/projects/
  9. 9. Brief review of the paper ● I will reuse the slides from the authors rather than inventing another wheel ;) https://www.usenix.org/sites/default/files/conference/protected-files/osdi18_slides_cutler.pdf
  10. 10. Demonstration: Build & Run $ git clone https://go.googlesource.com/go go1.4; cd go1.4 $ git checkout release-branch.go1.4; cd src $ ./make.bash $ cd ../../ $ git clone https://github.com/mit-pdos/biscuit.git; cd biscuit/src $ ./make.bash $ cd ../biscuit/ $ make qemu CPUS=2
  11. 11. Build: What the ‘make qemu’ did? ● Build bootloader, kernel (src/kernel/bins.go), and applications ● Create the root file system ● Start qemu with the root file system 220 qemu: gqemu 234 gqemu: go.img 235 $(QEMU) $(QOPTS) -nographic 224 QOPTS += -device ahci,id=ahci0 225 -drive file=go.img,if=none,format=raw,id=drive-sata0-0-0 226 -device 125 go.img: $(K)/boot $(K)/main.gobin $(SKELDEPS) $(FSPROGS) ./mkfs 126 ./mkfs $(K)/boot $(K)/main.gobin $@ $(SKEL) 146 $(K)/main.gobin: chentry $(GOBIN) $(K)/bins.go $(KSRC) $(FSRC) $(PSRC) biscuit/GNUmakefile
  12. 12. Code in detail: Page fault handling of Biscuit ● When a process accesses a memory area that is not mapped in the page table, page fault occurs ● Kernel allocates a page frame and create a mapping in the page table main (src/kernel/main.go) Sched_add (src/proc/proc.go) run (src/proc/proc.go) trap_proc (src/proc/proc.go) Pgfault (src/vm/as.go) Sys_pgfault (src/vm/as.go) Ptefor (src/vm/vm.go) pmap_pgtbl (src/vm/pmap.go) https://qph.fs.quoracdn.net/main-qimg-a6f4d4dc4b1dc24bdb9366d1d20a9718
  13. 13. Conclusion ● Biscuit is an OS kernel written in Go ● Benefits and costs of writing a kernel in Go is clear ● You can use, read, and modify the source :D https://images.fineartamerica.com/images/artworkimages/mediumlarge/2/funny-himalayan-groundhog-with-biscuit-on-a-green-meadow-oleg-ivanov.jpg
  14. 14. Thanks

×