The operating system is a difficult program, in which detail are imposed at each other. That the system could provide desirable possibilities, the unifying model is necessary. Let's consider approaches to design of operating systems on an example of widespread models.
It is possible to present model of an operating system as a framework which connects all means and the services which are provided by system, on the one hand, and carried out by it of a task with another in a whole.
There is a set of ways of structuring operating systems. In small operating systems, for example, in MS-DOS, use a principle of the organization of system as a set of procedures, any user procedure can cause each of which. Such model is called as monolithic.
Such structure doesn't provide isolation of data as in different sites of a code information on the device of all system is used. Expansion of operating systems of this kind inconveniently as change of some procedure can cause mistakes in other parts of system which at first sight don't have to it the relations.
In all monolithic operating systems, except the simplest, appendices are separated from actually code of an operating system. Differently, the code is executed in an exclusive mode of the processor which in literature kernel mode often is called and has access to data of system and equipment. Programs of the user are executed in not exclusive so we call user mode in which the limited set of interfaces and limited access to system data is provided to them. When the program of the user mode causes system service, the processor intercepts a call and switches a defiant stream in a kernel mode. When performance of a system call comes to the end, the operating system switches a stream back in the user mode and gives the chance to the defiant program to continue performance.
Other approach to structuring system assumes division it on the modules, layered one over another. Each module provides a set of functions which can be caused by other modules. The code located in some layer, causes a code only from underlying layers. In some operating systems which are under construction on this model, for example, in VAX/VMS or in Multics system, the lot of layer even is compulsorily caused by hardware.
One of advantages of the level-by-level organization of an operating system is that the code of each layer gets access only to interfaces necessary for it and structures of these underlying layers. Thus, the volume of the code possessing an absolute power decreases. Besides, such structure allows beginning when debugging an operating system with the lowermost layer and to add on one level until all system won't melt to work correctly. The level-by-level structure facilitates also expansion of systems; it is possible to replace entirely any level, without mentioning other parts.
The third approach to design of operating systems is a model the client server. His idea consists in system division into some processes, each of which realizes one set of services: for example, memory distribution, and creation of processes or planning of processes. Each server is carried out in a mode of the user, all the time checking, whether any client addressed to it for service. The client whom can be or other component of an operating system, or the applied program, requests service performance, sending to the server the message. The kernel of an operating system which is carrying out in a mode of a kernel, delivers the message to the server. That carries out required actions then the kernel returns to the client results in the form of other message.
When using a client-server approach the operating system consisting of independent components of the small size turns out. As all servers are carried out as separate processes in a mode of the user, failure and, probably, restart of one of servers doesn't break work of other parts of system. Moreover, different servers can be carried out on different processors of the multiprocessing computer or even on different computers. It does the operating system constructed on such model suitable for distributed computing environments.
There is a set of versions of the client-server systems which part perform in a kernel mode small volume of work while others – bigger. For example, the Mach operating system, one of modern examples of client-server architecture, has a kernel of the minimum size as which planning of streams, transmission of messages, and management of virtual memory and drivers of devices enters. All the rest, including various interfaces of applied programs, file systems, network support, and works in the user mode.
Recently more and more popular there is an objective model of an operating system. As well as in case of other big program systems, it is difficult to find one, the main program which operates all operating system. Thus, instead of developing system from top to down, on object-oriented methodology, at first consider data with which the program for performance of the task should work. For operating systems such data are system resources – files, processes, memory and so on.
Main objective of system development with orientation to data – creation of the software which would be possible easily, and the main thing is cheap, to change. One of ways of minimization of necessary changes in object-oriented programs is a concealment of physical data presentation in objects. The object represents structure of the data which physical format is latent in type definition. It has a set of the properties called by attributes, and with it the group of services works.
Many operating systems use objects for representation of system resources. Each system resource which some processes can share, is realized as object and is processed by objective services. Such approach reduces influence of changes which can occur in system eventually. For example, if change in an operating system is caused by change in equipment, it is necessary to change only the object representing this hardware resource, and its services. Thus the code which uses object doesn't need updating. Similarly if it is necessary to enter support of the new device into system, the new object, and addition it to system is created doesn't break an existing code.
Besides that influence of changes decreases, creation of an operating system on the basis of objects has some more doubtless advantages:
· Access of system to resources and work with them are unified. Creation, removal and the reference to object is carried out absolutely similarly. And as each resource is an object, control of use of resources is reduced to tracking of creation and use of objects.
· Protection as for all objects it is carried out equally becomes simpler. In attempt of access to object the subsystem of protection interferes and checks operation admissibility irrespective of the fact which the resource represents object.
· Objects provide the convenient and unified base for sharing of resources by two or several processes. For work with objects of any type descriptors of objects are used. Two processes share object when each of them opened its descriptor. The system can trace quantity of the descriptors open for this object to define, whether really it is still used. After that the system can remove objects which more aren't used.