Question-1 Explain different types of operating system structure. OR Explain architectures of different operating system structure.
- 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.
- In this system, operating system is organized as a hierarchy of layers, each one constructed upon the one below it as shown below in figure 1-4.
- 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.
Client Server Model
- A slight variation of the microkernel idea is to distinguish classes of processes in two categories.
- First one is the servers, each of which provides some services, and the second one is clients, which use these services.
- This model is known as the Client Server model.
- Communication between clients and servers is done by message passing.
- To obtain a service, a client process constructs a message saying what it wants and sends it to the appropriate services.
- The service then does the work and sends back the answer.
- The generalization of this idea is to have the clients and servers run on different computers, connected by a local or wide area network.
- Since a client communicates with a server by sending messages, the client need not know whether the message is handled locally in its own machine, or whether it was sent across a network to a server on a remote machine.
- A PC sends a request for a Web page to the server and the Web page comes back. This is a typical use of client server model in a network.
- 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.
- This situation is illustrated in Fig. 1-8(a), where the term “virtual machine monitor” has been renamed type 1 hypervisor in recent years.
- VMware Workstation is a type 2 hypervisor, which is shown in Fig. 1-8(b). In contrast to type 1 hypervisors, which run on the bare metal, type 2 hypervisors run as application programs on top of Windows, Linux, or some other operating system, known as the host operating system.
- After a type 2 hypervisor is started, it reads the installation CD-ROM for the chosen guest operating system and installs on a virtual disk, which is just a big file in the
- host operating system’s file system.
- When the guest operating system is booted, it does the same thing it does on the actual hardware, typically starting up some background processes and then a GUI.
- Some hypervisors translate the binary programs of the guest operating system block by block, replacing certain control instructions with hypervisor calls.
- The translated blocks are then executed and cached for subsequent use.
- A different approach to handling control instructions is to modify the operating system to remove them. This approach is not true virtualization, but para- virtualization.
- 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.
You may be interested in:
Operating System Short Descriptive Questions and Answers