Chapter 6: System Software and Virtual Machine

To program a computer as described in chapters 4 and 5, we would have to d...
Operating System

Language Translators               Memory Managers                  Information managers
1. Machine language uses binary. There are not English-like words, symbols, etc. to
   make the language more readable.

                                                          extra 8 bits
      A p...
information to be brought from an i/o device, etc. For example there will be three
     states that a program can be in at...
•  The output tape is taken back to the small i/o computer where the results are read,
   separated and printed out.
• The...
Upcoming SlideShare
Loading in...5

Chapter 6


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Chapter 6

  1. 1. Chapter 6: System Software and Virtual Machine To program a computer as described in chapters 4 and 5, we would have to do so by converting the program into machine code and enter it one (byte) by one (byte). If the program is large, this will very likely lead to numerous mistakes. Also, to run the program, we would have to load the address of the first instruction in the PC (program counter) ourselves. All of this will take time and may be difficult, not to mention the errors that may occur due to typing. To make it easier, we create a user interface that interact between the user and the hardware. This user interface would have the following characteristics: 1. Hide from the user the messy details of the underlying hardware. 2. Present information about what is happening in a way that does not require indepth knowledge of the internal structure of the system. 3. Allow easy user access to the resources available on this computer. 4. Prevent accidental and/or intentional damage to hardware, data and programs. This interface is known as a “system software”. System Software: Is a collection of computer programs that manage the resources of the computer and facilitate access to those resources. Note: Software consists of sequences of instructions – programs - that solve a problem. The system software presents the user with a set of services and resources that are used to interact with the actual machine. These services and resources, seen by the user, are referred to as the virtual machine or they create a virtual environment. For example, if the user had to solve the following expression a =b+c He should not have to worry about: 1. Loading ALU registers from memory cells b and c. 2. Activating the ALU. 3. Selecting the output from the addition circuit via the multiplexor. 4. Sending the result to memory cell a. The user should only see a virtual machine that understands how to do these things – provided by the system software. He (She) should only issue one command – execute my program. The machine should load the program into memory and then carry out all instructions without the user having to see all details. He (she) should then be presented with the output or prompts for input as the case may be. Then he/she should have the option to save the output on the medium he/she chooses. Types of System Software: There are many components that make up a system software as the following diagram shows. The operating System, which is the most important part of the system software, controls the overall operation of the computer. 1
  2. 2. Operating System Language Translators Memory Managers Information managers Utilities Interpreters Scheduler Garbage Collectors Assemblers Compiliers Loaders Linkers File Systems Database Systems Text Editors Graphics Routines 1. User Interface: All modern operating systems provide a GUI that gives the user an intuitive visual overview as well as graphical control of the capabilities and services of the computer. 2. Language Translators: programs that allow you to write a program in a user- oriented language rather than the machine code (language). 3. Memory Managers: routines that allocate memory space for programs and data and load programs into memory prior to execution. 4. Information Managers: these routines handle the storage and retrieval of information on mass storage devices such as disks, CD-Roms and tapes. 5. I/O Systems: These software packages enable us to use the various input/ouput devices. These packages are normally known as drivers. 6. Scheduler: keeps a list of programs ready to run on the processor and selects the one that will execute next. Generally, it works on a priority basis – the program with the highest priority is executed next. 7. Utilities: A collection of library routines that provide services to either the user or other system routines. Text editors, graphics routines, and windowing packages are examples of utility routines. These may be arranged into collections called program libraries. These system routines are used in every phase of problem solving by the computer. On a virtual machine, the messy details of the machine are no longer visible to the user who could now spend his/her time writing programs, executing those programs, and saving and analyzing the results. The example of the use of all of these processes on page 244. Assemblers and Assembly Language: Owing to the difficulties presented with the use of machine language, we needed a more user friendly programming language – the first of which was assembly language. The reasons why we needed a more user friendly language over machine language are: 2
  3. 3. 1. Machine language uses binary. There are not English-like words, symbols, etc. to make the language more readable. 2. It allows only numeric memory addresses. A programmer cannot name an instruction or a piece of data and refer to it by name. 3. It is difficult to change. If we insert or delete an instruction, all memory addresses following that instruction will change. 4. It is difficult to create data. If a user wishes to store a piece of data in memory, the internal binary representation of that data must be computed before it could be stored. This is very difficult. So assembly language was developed (in the early 50’s) and was considered as a second generation language. It provided, at the time, a more user friendly programming environment. Note: Assembly Language is categorized as a second-generation language with machine language (binary) being the first-generation. However, to today’s standard, assembly language is considered a low level language (closely related to machine language) because each assembly instruction is translated into exactly one binary machine language instruction. Unlike languages like C++, Pascal, etc. whereby each instruction is generally converted into more than one machine language instruction and these languages are more english-like (user friendly). Operating Systems: To carry out such services as translating, loading and executing a program, we need to issue system commands. The operating system will carry out these commands. Some of the tasks performed by the operating systems are: 1. The User Interface: Provides a prompt (in the case of DOS or UNIX) or icons and/or menus (in the case of Windows) for the user to negotiate. The diagram on the next page shows the flow. 2. System Security and Protection: The operating system also controls access to the computer and its resources, i.e. it must prevent unauthorized users from using the computer as well as prevent authorized users from doing unauthorized things. So a potential user must have a username and password to gain access to most public computer system. Of course a home computer may also enable the owner to enforce these securities measures. Furthermore, the operating must also safeguard the file that consist the passwords, etc. There is generally one or so person(s) who will have access to the password file. This is the person who would maintain the file. Passwords are generally encrypted by converting the characters and/or digits into binary and then a special value placed at the right hand end (maybe). For example if a password is XY47;, then the binary (in 8-bits) equivalent is: X(78H) Y(79H) 4 7 01111000 01111001 00000100 00000111 Putting these together we get: 01111000011110010000010000000111 And now perhaps 8 bits could be inserted to the right to make it a 40-bit password scheme such as: 3
  4. 4. 0111100001111001000001000000011100001111 extra 8 bits A program (encryption) must be available to create this password by adding the extra bits and so also to decode the password. Should somebody steal the password, they would also need to steal this program to decode the passwords. Operating systems may also determine what the users should or should not do with files, example: • Read the information in the file but do not change it • Append new information to the end of the file but cannot change the rest of the file. • Change existing information in the file. • Delete the entire file from the system. Start Wait for user to make a request Print an error message. No leg it a t? re al es Is qu Yes Determine which software package will handle this request. Schedule that software package to run on the compiler. 3. Efficient allocation of Resources: The operating system keeps a queue of programs ready to run. Thus, the processor will not have to sit idle waiting for some 4
  5. 5. information to be brought from an i/o device, etc. For example there will be three states that a program can be in at some time or the other – Waiting, Ready, and Running. 4. The safe Use of Resources: Prevent deadlocks which can occur in a number of ways. • Two programs may want to use the same device at the same time without either one deciding to let go or one may be using device A while the other is using device B. Now the first program want access to device B and the second program want access to device A, but neither program is giving up their hold on the current device they have. • Communication lines may also see deadlock – one computer sending information to another computer. The process is that the receiving computer must acknowledge the receipt of a message before the sending computer start sending again. If the sending computer does not receive this message it will sit there waiting. At the other end, the receiving computer will also sit there waiting to receive. To solve these problems, the OS uses two methods – deadlock prevention and deadlock recovery. • Deadlock prevention: The idea is resource allocation and one of many solutions is – If you do not have all it takes to solve a problem, then you must give up whatever you have and place a new request. • Deadlock recovery: Using the example of the communications: The idea is if the last message sent was not acknowledged, wait for a period and resend it. If it was received already, discard it after sending the acknowledgement message and communications will resume. Historical Development of OS: First Generation (1945 – 1955): No operating system existed – programmer would sign up for a block of time to use the computer. He/she would do all of the operations – including loading the programs, staring the program running, etc. When the program finish executed, he spend time going over results while the computer lay there idle. Only very highly skilled persons were allowed to do this. Also in 1946, Konrad Zuse , a German engineer working alone while hiding out in the Bavarian Alps, develops Plankalkul. He applies the language to, among other things, chess. Second Generation (1955 – 1965): The development of the batch OS. The process is as follows: • The programmers write their programs on punch cards. • A professional computer operator would take a number of programs and put them together forming a “batch” of programs. • He would use a small i/o computer to put these programs onto a tape. • The tape is taken into the computer room and loaded onto the “big” computer that runs the programs and put the results on another tape. 5
  6. 6. • The output tape is taken back to the small i/o computer where the results are read, separated and printed out. • The results are then given to the respective programmer. But with the advent of the transistors, computation became faster. The batch system could not keep up mainly because only one program was loaded in memory at a time. Thus time was still wasted. So the third generation of OS was born. Third Generation (1965 – 1985): Multiprogramming OS: More than one program is loaded in memory but with the upper and lower address bounds of each program maintained by the OS. Thus if something goes wrong with one program, it will not roll over to damage the other programs. User programs were not allowed to use the HALT instructions anymore – only the system software. Also time-sharing evolved, where many users use terminals that were connected to a central computer. In time sharing, the loaded program would compete with the other loaded programs for the processor. Fourth Generation (1985 – Present): Network operating system – manages the resources of a single computer as well as handling the capabilities of telecommunications systems called LAN, WAN, etc. Another aspect of this generation is the real-time processing whereby computers were developed for special purposes and embedded into other objects (cars, microwave, oven, etc.) which enhance performance. The future (Fifth): The next generation systems which will not only provide interface with text and Graphics, but with sound, touch, photography, etc. Massively parallel and distributed processing systems will also become more popular especially for huge data processing. In the case of parallel processing, hundreds or thousands of processors may be connected to form a network on which data may reside and all of the processors may be used to compute/process the data thus increase the speed at which a result could be obtained. Here, the programmer and hence the user will have some clue as to which computer has the data. In the case of distributed systems, the same idea hold true but now the user don’t care which of the computer has the data, so long as the data is obtained to carry out the task. It is very similar to a manager telling his/her employee to do a task regardless as to how the input was obtained to carry out the task. 6