Like any OS, the IOS must implement a set of elemental principles:
  • Process Management
  • Memory Management
  • Devices Management
  • User Interface
Let’s talk about processes; the IOS is a multi-task cooperative Operating System (not preemptive). Each process is responsible for giving back the CPU to the next process. The IOS does not implement multithreading (1 Process = 1 Thread). The IOS uses the interrupt mechanism in order to achieve fast packet switching between interfaces. Each time a packet comes to an interface, an interrupt is launched. So, the CPU is able to process the packet in priority. The fact that a process is responsible for its CPU time can lead to lot of mayhem if, for example, a process enters an endless loop. The “WatchDog Timer” is an IOS’s special process that can kill a process taking up too much CPU time (default is 2*2sec). A process has 6 states:
  • Create State
    • The process is created by the Kernel or by the Parser (cli / config)
    • Resources allocation
  • Modify State (optional)
    • A terminal can be added to the process (by default: no std::in /out/err in Create State)
    • Some parameters can be added
  • Ready State
    • The process is ready to run
  • Running State
    • The process is on the CPU
    • It can:
      • Let another process take the CPU (Suspend). Go back to Ready State.
      • Run to completion then self-terminated
      • Wait for an event (Idle State)
  • Idle State
    • The process is waiting for a specific event (Wait for External Event)
  • Dead State
    • The process is self-terminated
    • The process was killed by the Kernel
    • The process has completed its job (Run to completion)
Process Lifecycle: image There are 4 process priorities (one queue FIFO/priority):
  • Critical
  • High
  • Medium
  • Low
The scheduler takes care to remove a process in Ready State from a priority queue and run it on the CPU (Running State). Notes:I could only find 4 priorities among the sources I consulted. However when we use the “show list” command:
#show list | inc Sched
8 650F2910 0/- Sched Preemptive
9 650F2310 0/- Sched Critical
10 650F21F0 0/- Sched High
11 650F1C10 2/- Sched Normal
12 650F1C60 0/- Sched Low
13 650F1E10 0/- Sched Preemptive ION
14 650F2180 262/- Sched Idle
15 650F0800 0/- Sched Dead
16 6535B660 0/- Sched Normal (Old)
17 6535B6C0 0/- Sched Low (Old)
We can see that there is a queue called “Sched Preemptive”. This queue is against the fact that the IOS is not preemptive! (Maybe my sources are pretty old …) This command also displays the number of processes on each of the queues. There are 262 processes in Idle State and 2 “Normal” priority processes in Ready State. A process moved to “Dead State” doesn’t automatically get its resources freed, hence the necessity of a “Dead Queue”. In my next post, I’ll explain the working of the IOS’s Scheduler.