Explain different types of OS (operating System) structure

Monolithic system
  • In this approach the entire operating system runs as a single program in kernel mode. 
  • The operating system is written as a collection of procedures, linked together into a single large executable binary program. 
  • When this technique is used, each procedure in the system has a well-defined interface in terms of parameters and results, and each one is free to call any other one, if the latter provides some useful computation that the former needs.
  • To construct the actual object program of the operating system, when this approach is used, one first compiles all the individual procedure and then binds (group) them all together into a single executable file using the system linker.
  • The services (system calls) provided by the operating system are requested by putting the parameters in a well-defined place (e.g., on the stack) and then executing a trap instruction. 
  • This instruction switches the machine from user mode to kernel mode and transfers control to the operating system. 
  • The operating system then fetches the parameters and determines which system call is to be carried out. 
  • This organization suggests a basic structure for the operating system.
  • A main program that invoke (call up) the requested service procedure.
  • A set of service procedures that carry out the system calls.
  • A set of utility procedures that help the service procedure. 
  • In this model, for each system call there is one service procedure that takes care of it and executes it. 
  • The utility procedures do things that are needed by several services procedure, such as fetching data from user programs. 
Layered system 

  • The first system constructed in this way was the THE system.
  • The system had six layers.
  • Layer 0 dealt with allocation of the processor, switching between processes when interrupts occurred or timers expired.
  • Layer 0 provided the basic multiprogramming of the CPU.
  • Layer 1 did the memory management. It allocated space for process in main memory and on a 512K word drum used for holding parts of processes for which there was no room in main memory. 
  • Layer 2 handled communication between each process and the operator console(i.e. user).
  • Layer 3 takes care of managing the I/O devices and buffering the information streams to and from them. 
  • Layer 4 was where the user programs were found. 
  • The system operator process was located in layer 5. 
  • A further generalization of the layering concept was present in the MULTICS system.
  • Instead of layers, MULTICS was described as having a series of concentric rings, with the inner ones being more privileged than the outer ones.
  • When a procedure in an outer ring wanted to call a procedure in an inner ring, it had to make the equivalent of a system call, that is, a TRAP instruction whose parameters were carefully checked for validity before allowing the call to proceed.
  • Although the entire operating system was part of the address space of each user process in MULTICS, the hardware made it possible to designate individual procedures (memory segments, actually) as protected against reading, writing, or executing. 
  • With the layered approach, the designers have a choice where to draw the kernel user boundary. 
  • Traditionally, all the layers went in the kernel, but that is not necessary.
  • In fact, a strong case can be made for putting as little as possible in kernel mode because bugs in the kernel can bring down the system instantly.
  • In contrast, user processes can be set up to have less power so that a bug may not be fatal.
  • The basic idea behind the microkernel design is to achieve high reliability by splitting the operating system up to into small, well defined modules, only one of which the microkernel runs in kernels mode and the rest of all are powerless user processes which would run in user mode. 
  • By running each device driver and file system as separate user processes, a bug in one of these can crash that component but cannot crash the entire system.
  • Examples of microkernel are Integrity, K42, L4, PikeOS, QNX, Symbian, and MINIX 3.
  • MINIX 3 microkernel is only 3200 lines of C code and 800 lines of assembler for low level functions such as catching interrupts and switching processes.
  • The C code manages and schedules processes, handles inter-process communication and offer a set of about 35 systems calls to the rest of OS to do its work. 
  • The process structure of MINIX 3 is shown in figure 1-5, with kernel call handler labeled as Sys.
  • The device driver for the clock is also in the kernel because the scheduler interacts closely with it. All the other device drivers run as separate user processes. 
  • Outside the kernel, the system is structured as three layers of processes all running in user mode.
  • The lowest layer contains the device driver. Since they run in user mode they do not have access to the I/O port space and cannot issue I/O commands directly. 
  • Above driver is another user mode layer containing servers, which do most of the work of an operating system. 
  • One interesting server is the reincarnation server, whose job is to check if the other servers and drivers are functioning correctly. In the event that a faulty one is detected, it is automatically replaced without any user intervention.
  • All the user programs lie on the top layer. 
Virtual Machine 
  • The initial releases of OS/360 were strictly batch systems. But many users wanted to
    be able to work interactively at a terminal, so OS designers decided to write
    timesharing systems for it.  
The heart of the system, known as the virtual machine monitor, run on the bare
hardware and does the multiprogramming, providing not just one but several virtual
machines to the next layer up.
Each virtual machine is identical to the true hardware; each one can run any OS that will run directly on the bare hardware. 
  • Different virtual machines can run different operating systems.
  • On VM/370, some run OS/360 while the others run single user interactive system called CMS (Conversational Monitor System) for interactive time sharing users.
  • When CMS program executed a system call, a call was trapped to the operating system in its own virtual machine, not on VM/370. 
  • CMS then issued the normal hardware I/O instruction for reading its virtual disk or whatever was needed to carry out the call. 
  • These I/O instructions were trapped by VM/370 which then performs them. 
  • The idea of a virtual machine is heavily used nowadays in a different context.
  • An area where virtual machines are used, but in a somewhat different way, is for running Java programs. 
  • When Sun Microsystems invented the Java programming language, it also invented a virtual machine (i.e., a computer architecture) called the JVM (Java Virtual Machine).
  • The Java compiler produces code for JVM, which then typically is executed by a software JVM interpreter.
  • The advantage of this approach is that the JVM code can be shipped over the Internet to any computer that has a JVM interpreter and run there. 
Virtual Machines rediscovered 
  • Many huge companies have considered virtualization as a way to run their mail servers, Web servers, FTP servers and other servers on the same machine without having a crash of one server bring down the rest. 
  • Virtualization is also popular in Web hosting world. 
  • Web hosting company offers virtual machines for rent, where a single physical machine can run many virtual machines; each one appears to be a complete machine. 
  • Customers who rent a virtual machine can run any OS or software they want to but at a fraction of the cost of dedicated server. 
  • Another use of virtualization is for end users who want to be able to run two or more operating systems at the same time, say Windows and Linux, because some of their favorite application packages run on one and some am on the other. 
  • Rather than cloning (copying) the actual machine, as is done with virtual machines, another strategy is partitioning it. 
  • In other words, giving each user a subset of the resource. 
  • For example one virtual machine might get disk blocks 0 to 1023, the next one might get block 1024 to 2047, and so on. 
  • Program running at the bottom layer (kernel mode) called the exokernel. 
  • Its job is to allocate resources to virtual machines and then check attempt to use them to make
  • sure no machine is trying to use somebody else’s resources. 
  • The advantage of the exokernel scheme is that it saves a layer of mapping. 
  • In the other designs, each virtual machine thinks it has its own disk, with blocks
  • running from 0 to some maximum, so the virtual machine monitor must maintain tables to remap disk addresses. 
  • In exokernel remapping is not needed. 
  • The exokernel need only keep track of which virtual machine has been assigned which resource. 

If you have any doubts please feel to free and comment and ask to questions.

Previous Post Next Post

Contact Form