Lesson 2 (System Calls)

Cards (17)

  • What are the Operating System Services which are helpful to User:
    • User interface
    • Program execution
    • I/O operations
    • File-system manipulation
    • Communications
    • Error detection
  • What are the Operating Systems that ensure efficient operation of system via resource sharing?
    • Resource allocation
    • Accounting
    • Protection and security
  • What are system calls?
    • A programming interface to the services provided by the OS
    • Typically written in high-level language (C/C++)
    • Mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call use
  • What is Application Program Interface (API)?
    API specifies a set of functions that are available to an application programmer, including the parameters that are passed and expected return values
  • Why user APIs rather than system calls?
    • It provides an abstraction of the function call behaviour
    • provides interoperability amongst different OS/HW versions (libraries can work on diff architectures)
  • System Call Implementation (1)
    • A number is associated with each system call
    • System-call interface maintains a table indexed according to these numbers
    • The system call interface invokes intended system call in OS kernel and returns status of the system call and any return values
  • System Call Implementation (2)
    • If >1 application is accessing the API, both application can see the same memory region
    • API is storing the memory, but when in execution and not loaded, it is stored in HD/SSD
    • The caller need know nothing about how the system call is implemented
  • Three methods to pass parameters to Operating System:
    1. Pass parameters in registers
    2. Parameters stored in a block, or table, in memory, and address of block passed as a parameter in a register
    3. Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system
  • Characteristic and problem with passing parameters in register
    In some cases, may be more parameters than registers
  • Parameters stored in a block in memory, and address of block is passed as a parameter in a register:
    • approach taken by Linux and Solaris
    PROs: + Fast and Flexible
    CONs: - slower to access diff parameters in memory compared to accessing parametes in registers
  • Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system
    • Combines the first 2 methods together (memory + registers)
    pushes paraemters in stack + most function uses short parameters and is put in registers
  • Loadable Kernel Modules
    • implemented by most modern OS
    • Uses object-oriented approach
    • Each core component is separate
    • Each talks to the others over known interfaces
    • Each is loadable as needed within the kernel
  • Monolithic Operating Systems
    Consists of 2 seperable parts:
    1. Systems programs
    2. The kernel
    • Consists of everything below the system call interface and above the physical hardware
    • Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level
  • Mikrokernel System Structure
    • Moves as much from the kernel into user space (The kernel contains strictly the necessary services that the kernel needs to provide.)
    • Communication takes place between user modules using message passing
  • Pros and Cons of Mikrokernel System
    • Benefits:
    • Easier to extend a microkernel
    • Easier to port the operating system to new architectures
    • More reliable (less code is running in kernel mode)
    • More secure
    • Detriments:
    • Performance ovehead of user space to kernel space communication
  • Hybrid Kernels
    Combine a micro-kernel with extended functionality to enhance performance
  • Virtualisation
    Allows operating systems to run applications within other.
    Emulation used when source CPU type different from target type (i.e. ARM to Intel x86)
    • Generally slowest method but flexible
    • Translation of instruction/architecture if it a program
    • logically builds a CPU within the CPU
    Virtualization – OS natively compiled for CPU, running guest OSes also natively compiled