Sei sulla pagina 1di 16

Lecture 1 : The Functions of Operating System

Computing (9691/03) Upper Sixth


(a) Features of Operating System Part 1

Main features of OS
The operating system (OS) must provide and manage hardware resources as well as provide an interface between the user and the machine and between applications software and the machine. The OS must also provide other services such as data security.

Originally, if a program needed input, the program would have to contain the code to do this, similarly if output were required. This led to duplication of code so the idea of an OS was born. The OS contained the necessary input and output functions that could be called by an application. Similarly, disk input and output routines were incorporated into the OS.

This led to the creation of subroutines to do these simple tasks, such as read a character from a keyboard or send a character to a printer. The joining together of all these basic input and output routines led to the input-output control system (IOCS). Originally, the IOCS could only read a punched card or send data to a card punch. However, as new input and output media, such as magnetic tape and disk, were developed the IOCS became more complex.

Another complication was added when assembly and high-level languages were developed as the machine did not use these languages. Machines use binary codes for very simple instructions. With the development of these new types of programming language a computer would have to
a) b) c) d) e) f) g) load an assembler, compiler or interpreter, load the assembly or high-level program, do the translation, store the results somewhere in memory, execute the program, read input data, output the results.

The system had now become too complex for the human user to be able to organise it all. Also, as the processor could work much faster than the manual operator and the input and output devices, much time was wasted. Further, to make full use of the processor, more than one program should be stored in memory and the processor should give time to each of the programs.

Suppose two programs are stored in memory and, if one is using an input or output device (both very slow compared to the processor), it makes sense for the other program to use the processor. In fact this can be extended to more than two programs as shown in Fig. 3.1.a.1. The OS must now manage the memory so that all three programs shown in Fig. 3.1.a.1 are kept separate as well as any data that they use. It must also schedule the jobs into a sequence that makes best use of the processor.

The I/O phase should not hold up the processor too much which can easily happen if the I/O devices are very slow, like a keyboard or printer. This can be overcome by using Simultaneous Peripheral Operations On-Line (spooling). The idea is to store all input and output on a highspeed device such as a disk. Fig. 3.1.a.2 shows how this may be achieved,

Another problem is that programs may not be loaded into the same memory locations each time they are loaded. For example, suppose that three programs are loaded in the order A, B, C on one occasion and in the order C, A, B on another occasion. The results are shown in Fig. 3.1.a.3.

A further problem occurs if two or more users wish to use the same program at the same time. For example, suppose user X and user Y both wish to use a compiler for C++ at the same time. Clearly it is a waste of memory if two copies of the compiler have to be loaded into main memory at the same time. It would make much more sense if user X's program and user Y's program are stored in main memory together with a single copy of the compiler as shown in Fig. 3.1.a.4.

Now the two users can use the compiler in turns and will want to use different parts of the compiler. Also note that there are two different sets of data for the compiler, user X's program and user Y's program. These two sets of data and the outputs from the compiler for the two programs must be kept separate. Programs such as this compiler, working in the way described, are called re-entrant. Memory management, scheduling and spooling are described in more detail in the following Sections.

Distributed systems have operating systems that arrange for the sharing of the resources of the system by the users of that system. No action is required from the user. The file server and print server networks are examples of distributed computer systems. An example would be when a user A asks for a particular resource in a network system, the resource would be allocated by the O.S. in a way that is transparent to the user B. Another example, a computer A can run a program on computer B, using a file located elsewhere on the network without the user being aware of where execution is taking place or where the files are physically located.

Potrebbero piacerti anche