[TIL] Operating System Structure

  • Most operating system adopts monolithic structure, for it’s performance advantage. Linux, Unix and others(Although they aren’t totally monolithic).
  • Monolithic structure consist of a single, static binary file that contains all the functionalities of the kernel that runs in a single address space.
  • Monolithic structure is hard to implement and extend.
  • Layered Approach makes it easy to debug, easy to understand.
  • Layered Approach might has some overhead due to traversing through multiple layers to optain an operating system service.
  • A layer does not need to know the complicated implementation of deeper layers. All it needs to know is the functionalities of those deeper layers.
  • Microkernels removes all unnecessary components from the kernel and implement them as user level program which reside in seperate address spaces.
  • Mach is the most famous OS that uses microkernel approach. (Darwin, kernel for macOS uses Mach)
  • The client program and the server program interact indirectly by exchanging messages via the microkernel.
  • Microkernels makes extending the OS easier.
  • The performance issues explain why microkernels are rare. Since processes should communicate indirectly, it has performance drawbacks.
  • Modules enable not-core services to be implemented dynamically while the kernel is running. (Linking services dynamically either at boot time or during runtime)
  • Any module can call any other module.
  • Modules do not need to invoke message passing in order to communicate.
  • Modules are the best current methodology for OS design.
  • Linux and Windows are actually hybrid systems. Linux is monolithic since it has the OS in a single address space. However, Linux also modular, functionalities can be dynamically added to the kernel.
  • macOS is peculiar, since it’s kernel —Darwin— consists of two kernels.
  • macOS and iOS has much in common, yet they have some differences because of the differences of hardwares.
  • On top of the Darwin kernel, there are several layers including core frameworks, application frameworks(cocoa, cocoa touch), user experience and application layer.
  • Darwin is an open source weareas other layers(core, application framework, user experience) are closed.
  • Darwin consists of the Mach microkernel and the BSD UNIX kernel. So, Darwin provides two system-call interfaces.
  • Mach provides fundamental OS services. BSD UNIX provides POSIX(Portable OS Interface) functionality.
  • Darwin combines Mach, BSD, I/O kit and kernel extensions into a single address space, so message passings within Mach do not need copying(Better performance).
  • Android uses Java, yet developers uses Android API not standard Java API to impelment an application.
  • In Android Java codes are compiled to a Java bytecode at first and translated into executable .dex file then.
  • Android uses AOT(Ahead Of Time) compiler —NOT JIT—, .dex files are compiled into native machine code when they are installed on a device.
  • AOT compilation allows more efficient application execution with reduced power consumption.
  • Android uses Bionic standard C library instead of GNU C library.
  • At the deep bottom of Android, there is a Linux kernel which is modified is present to handle system calls.