Chapter 4

Date: 26th Jan 2018 Reference:

  1. Virtualization - Dialogue
  2. Virtualization - Processes
  3. Virtualization - Process API
The Abstraction: The process
  1. Process: Simply a running program.
    • Program is just a bunch of instructions.
    • OS takes these instructions and sets them running.
    • Transforms a program into a process.
  2. Virtualisation: The illusion that each process has its own CPU.
    • There are a lot of process running simultaneously.
    • Each process needs to access CPU resources.
    • Time sharing is a method used to share the CPU time among processes.
    • Each process feels that the entire CPU is dedicated to it.
    • But in reality, CPU shares its resources with everybody.
  3. How to accomplish virtualisation ?
    • Mechanisms: Low level machinery.
    • Example: Context Switch which allows to switch between processes for time sharing.
    • Policies: High level machinery.
    • Policies are used for decision making in the OS.
    • Example: Job scheduling policies like LRU to decide which programs should be run.
  4. Process API: Interfaces used to directly interact with the OS.
    • Create: Interface for creating a new process.
    • Destroy: Interface to forcefully killing a particular process if not shut automatically.
    • Wait : Waiting interface to wait for a process to do something.
    • Status: Interface to get status info.
    • Miscellaneous Control: Interface for other purpose like suspending a certain application.
  5. Process Creation:
    • OS loads data and code from disk to main memory.
    • Earlier: Eager Loading, i.e, all loaded at ones.
    • Now: Lazy Loading, i.e, Load most important parts.
    • Some memory for program’s run time stack.
    • Stack: Local variables , function parameters, return addresses, etc.
    • Some memory for heap used for dynamically allocated data.
    • Heap: Used for linked list, trees, hash tables, etc.
  6. Process States:
    • Running: Process running on a processor
    • Ready: Ready to run but currently not run by OS at the given moment.
    • Blocked: Process not ready to run until some event like I/O occurs.
  7. Data Structures: OS wants to know what the process is doing. Hence, some data structures are required to maintain relevant info. About the process.
    • Process Control Block(PCB) : Analogous to a process list.
    • PCBs keeps track of all running programs of the system.
    • Every process has a particular execution context.
    • Executions contexts are used for context switching between processes for time sharing.
Future Discussion Points:
  1. What is the idea and use of kernel stack and how is it different form any other kind of stack like user stack?
  2. What are the various items stored in heap or stack while process execution.
  3. What is the idea of space sharing in process creation and execution.
  4. What are the differences between fork() and exec() system calls?