2013年11月6日 星期三

[IOS] Ch2 System Structures #3


Virtual Machines

  • A virtual machine takes the layered approach to its logical conclusion. It treats hardware and the operating system kernel as though they were all hardware
  • A virtual machine provides an interface identical to the underlying bare hardware
  • The operating system host creates the illusion that a process has its own processor and (virtual memory)
  • Each guest provided with a (virtual) copy of underlying computer




History and Benefits

  • First appeared commercially in IBM mainframes in 1972
  • Fundamentally, multiple execution environments (different operating systems) can share the same hardware
  • Protect from each other
  • Some sharing of file can be permitted, controlled
  • Communicate with each other, other physical systems via networking
  • Useful for development, testing
  • Consolidation of many low-resource use systems onto fewer busier systems
  • “Open Virtual Machine Format”, standard format of virtual machines, allows a VM to run within many different virtual machine (host) platforms



Simulation

  • the host system has one system architecture and the guest system was compiled for a different architecture. 
  • run in an emulator that translates each of the outdated system's instructions into the native instruction set of the new system. 
  • can increase the life of programs and allow us to explore old architectures without having an actual old machine
  • major challenge is performance. 
    • Instruction-set emulation can run an order of magnitude slower than native instructions. 
    • the program running on the new machine will run slower than it did on its native hardware. 
    • it is difficult to create a correct emulator because this involves writing an entire CPU in software.

Para-virtualization

  • Presents guest with system similar but not identical to hardware
  • Guest must be modified to run on paravirtualized hardwareF
  • Guest can be an OS, or in the case of Solaris 10 applications running in containers

Operating-System Debugging

  • Debugging is finding and fixing errors, or bugs
  • OSes generate log files containing error information
  • Failure of an application can generate core dump file capturing memory of the process
  • Operating system failure can generate crash dump file containing kernel memory
  • Beyond crashes, performance tuning can optimize system performance
  • Kernighan’s Law: "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."
  • DTrace tool in Solaris, FreeBSD, Mac OS X allows live instrumentation on production systems
    • Probes fire when code is executed, capturing state data and sending it to consumers of those probes

Operating System Generation

  • Operating systems are designed to run on any of a class of machines; the system must be configured for each specific computer site
  • SYSGEN program obtains information concerning the specific configuration of the hardware system
  • Booting – starting a computer by loading the kernel
  • Bootstrap program – code stored in ROM that is able to locate the kernel, load it into memory, and start its execution

System Boot

Operating system must be made available to hardware so hardware can
start it
  • Small piece of code – bootstrap loader, locates the kernel, loads it into memory, and starts it

  • Sometimes two-step process where boot block at fixed location loads bootstrap loader

  • When power initialized on system, execution starts at a fixed memory location
    • Firmware used to hold initial boot code






Reference:  
Operating System Concepts 8th, by Silberschatz, Galvin, Gagne
Wikipedia

沒有留言:

張貼留言