• Like
オペレーティングシステム 設計と実装 第3版(20101211)
Upcoming SlideShare
Loading in...5
×

オペレーティングシステム 設計と実装 第3版(20101211)

  • 2,192 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,192
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
21
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. oracchahttp://d.hatena.ne.jp/oraccha/
  • 2. MINIX•• Google Group https://groups.google.com/group/minixReadingClub
  • 3. Andrew S. Tanenbaum Albert S. Woodhull
  • 4. OS OS
  • 5. • •• MINIX 3
  • 6. MINIX• 1987 MINIX 1: UNIX (v7) OS • 8088 16bit• 1997 MINIX 2 • 386 32bit • v7 → POSIX.1 IEEE1003.1/ISO 9945-1• 2006 MINIX 3 (book version MINIX 3.1.0)
  • 7. OS• OS • CPU IO • CPU •• OS • • OS
  • 8. 1. fork, waitpid, exec, exit, ...2. sigaction, sigreturn, kill, alarm, ...3. creat, open, close, read, write, ...4. mkdir, rmdir, mount, unmount, chdir, ...5. chmod, chown, unmask, ...6. time, stime, utime, times
  • 9. OS THE MULTICS VM/370 exokernel MINIX 3
  • 10. • OS•• P.55
  • 11. Jochen Liedtke“Toward Real Microkernels,” CACM Vol. 39, No.9, 1996.
  • 12. • A New Hope: • 1980 UNIX • Mach Chorus Mach• The Microkernel Strikes Back: • • L4 Exokernel• Return of Virtual Machines: • • VMWare Xen
  • 13. • • CPU •• OS CPU
  • 14. •• ‣CPU • ‣ • Peterson • TSL•• Mars Pathfinder’s Sojourner
  • 15. • Peterson • Dekker • N • Filter • Lamport Bakery • TSL
  • 16. PERTERSONint turn;boolean interested[2];do { do { enter region interested[0] = TRUE; interested[1] = TRUE; turn = 0; turn = 1; while (turn == 0 && interested[1]); while (turn == 1 && interested[0]); /* critical region */ /* critical region */ leave region interested[0] = FALSE; interested[1] = FALSE; /* non critical region */ /* non critical region */} while (TRUE); } while (TRUE); 0 1
  • 17. TSL• Test-and-Set Lock • read write read cmp 1• • ts (System/360) • cas (68000, SPARC) • xchg, cmpxchg (x86) • ll/sc (MIPS), ldrex/strex (ARMv6)
  • 18. • sleep&wakeup• Semafore Semaphore • P: down sleep • V: up wakeup• • • • • •
  • 19. • CPU I/O•• • ••
  • 20. MINIX 34 init ...3 (pm) (vfs) (vm) (inet) (rs) TTY Ethernet2 ... (at_wini) (tty) (lance)1 (kernel) (system) (clock) P.121
  • 21. • boot monitor • init• MINIX kernel •• init(8) • /etc/rc • service(8) • /etc/ttytab getty (login)
  • 22. • PM •• service(8)• MINIX3 • C.Giuffrida, “We Crashed, Now What?,” USENIX HotDep’10
  • 23. • F4• is kill# cd servers/is# vi dmp_kernel.c# diff dmp_kernel.c.orig dmp_kernel.c338c338< ! printf("(%02u) %-7.7s %s %s %7d",---> ! printf("(%02u) %-7.7s %s %s %6d",# make && make install# kill 38
  • 24. PS PID TTY TIME CMD(-4) ? 0h44 idle(-3) ? 0:00 clock(-2) ? 0:00 system(-1) ? 0:00 kernel 5 ? 0:00 pm 7 ? 0:00 vfs 4 ? 0:00 rs 8 ? 0:00 memory: 1 ? 0:00 init: 122 co 0:00 sh 123 c1 0:00 getty
  • 25. • MINIX3 book v3.1.0 ISO Appendix B • MINIX3 book version (v3.1.0) current version (v3.1.8) • http://www.minix3.org/doc/
  • 26. /USR/SRCinclude make world /usr/include sys POSIX minix MINIX 3 OS ibm IBM PCkerneldriversservers
  • 27. • src/tools make ( http://wiki.minix3.org/en/DevelopersGuide/RebuildingSystem) • /boot/boot: • /boot/images: • /sbin: # cd /usr/src/tools # make image # make install
  • 28. • newminix
  • 29. • MINIX C/S• • • •
  • 30. S kernel R• send ( ) • send receive sendrec receive • S kernel R receive • sendrec send
  • 31. • • notify •
  • 32. • priv • ipc_to: IPC • traps: IPC send receive sendrec notify • pm vfs rs sendrec sendrec send sendrec pm vfs vm inet rs drivers kernel
  • 33. sys_fork PM sys_exec PM EXEC SP sys_exit PM sys_privctl RS sys_irqctl driver sys_devio driver I/O sys_umap driver sys_vircopy FS, driversys_physcopy driver sys_getinfo all P.208
  • 34. FORK&EXEC• UNIX PDP-7 • OS TSS• fork exec • fork exec • SDS 930 TSS • D.M.Ritchie, ”The evolution of the UNIX Time-sharing system,” 1979
  • 35. • IDT iretd• CPU TSS SS ESP stackframe_s• stackframe_s• iretd •
  • 36. 31 16 15 14 13 12 8 7 0 IA32 D P P 0 0 1 0 1 4 L 31 16 15 0 TSS 0IDTR 31 16 15 14 13 12 8 7 5 4 0 base limit 31..16 P D P L 0 D 1 1 0 0 0 0 4 IDT 31 16 15 0 15..0 0 + 55 31 16 15 14 13 12 D 8 7 5 4 0 31..16 P P 0 D 1 1 1 0 0 0 4 L 31 16 15 0 15..0 0 DPL 33 SYS386_VECTOR P D 1=32 0=16 5-2. IDT 5.12. 256 ! "#$$ 32 255 0 zero divide ! %& "#$$ ! ()*)+)
  • 37. IA32 SS SS ESP ESP EFLAGS EFLAGS IRET pop CS CS EIP EIP (Error Code) CPU push (Error Code)• push• push push• IRET pop
  • 38. restart()service(int) syscall() save() P.188
  • 39. _RESTART struct stackframe_s (struct proc ) call save save jmp SS SS k_stktop _restart ESP ESP EFLAGS EFLAGS CS CS EIP EIP hwint_XX ret address (RETADR) hwint_XX ret address EAX mov esp, k_stktop ECXsave EDX EBX save ret jmp ESP hwint_XX ret _restart push EBP ESI v3.1.8 EDI DS ES FS GS struct stackframe_s
  • 40. call save SS SS ESP ESP EFLAGS EFLAGS CS CS EIP EIP (Error Code) CPU push old EFLAGS old CS old EIP _exception or_errexceptionC