OS Structures and Clocks
OS Structures and Clocks
1. Monolithic systems
2. Layered systems
3. Microkernels
4. Client- server systems
5. Virtual machines
6. Exokernels
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Monolithic Systems
The entire operating system runs as a single program in kernel
mode.
Basic structure of OS
1. A main program that invokes the requested service procedure.
2. A set of service procedures that carry out the system calls.
3. A set of utility procedures that help the service procedures.
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Monolithic Systems
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Monolithic Systems
Examples :
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Monolithic Systems
Linux Operating System
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Monolithic Systems
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Monolithic Systems
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Layered Systems
The operating system is organized as a hierarchy of layers, each
one constructed upon the one below it, e.g. the THE system built
at the Technische Hogeschool Eindhoven in the Netherlands by E.
W. Dijkstra (1968) and his students.
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Layered Systems
MS - DOS
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Microkernels
The basic idea is to achieve high reliability by splitting the
operating system up into small, well-defined modules, only one of
which—the microkernel—runs in kernel mode and the rest run as
relatively powerless ordinary user processes.
MINIX 3
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Client-Server Model
• Servers provide some service.
• Clients use these services.
• Communication between clients and servers is often by message
passing.
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Virtual Machines
Virtual Machines
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Virtual Machines
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Virtual Machines
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Virtual Machines
Control Program/Cambridge Monitor System (CP/CMS)
App
CMS is a single user OS
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Virtual Machines Rediscovered
(a) A type 1 hypervisor. (b) A pure type 2 hypervisor. (c) A practical type 2
hypervisor.
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Virtual Machines Rediscovered
Type 1 hypervisor
Example:
ESXi (Elastic Sky X Integrated):
1. Type-1 hypervisor
2. Runs directly on system hardware
3. No need for an operating system (OS)
Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Virtual Machines Rediscovered
Type 2 hypervisor(VirtualBox)
Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Clock Hardware
Clocks are built out of three components:
1) Crystal oscillator
Can generate a periodic signal, typically in the range of
several hundred megahertz to a few gigahertz, depending on the
crystal chosen.
2) Counter
This signal is fed into the counter to make it count down
to zero. When the counter gets to zero, it causes a CPU
interrupt.
3) Holding register
The value of the holding register is copied into the counter.
Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Clock Hardware
A programmable clock.
Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Clock Hardware
One-shot mode
When the clock is started, it copies the value of the holding
register into the counter and then decrements the counter at each
pulse from the crystal. When the counter gets to zero, it causes
an interrupt and stops until it is explicitly started again by
the software.
Square-wave mode
After getting to zero it causes an interrupt, the value of the
holding register is copied into the counter and whole process is
repeated again indefinitely. These periodic interrupts are called
clock ticks.
Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Clock Hardware
Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Clock Software
Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Clock Software
Maintaining the time of day
Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Clock Software
Maintaining the time of day
Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Clock Software
Maintaining the time of day
Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Clock Software
Start a second timer, distinct from the main system timer, whenever
a process is started up. When that process is stopped, the timer
can be read out to tell how long the process has run. To do things
right, the second timer should be saved when an interrupt occurs
and restored afterward.
Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Clock Software
Handling alarm system call from user processes
Each entry on the list tells how many clock ticks following the
previous one to wait before causing a signal.
Example:
Signals are pending for 4203, 4207, 4213, 4215, and 4216.
Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Clock Software
Handling alarm system call from user processes
Example:
Signals are pending for 4203, 4207, 4213, 4215, and 4216.
Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Clock Software
https://www.youtube.com/watch?v=GC6dGypGctQ
Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Linux
sysconf(_SC_CLK_TCK)
Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.