660 likes | 752 Views
Invitation to Computer Science 6th Edition. Chapter 6 An Introduction to System Software and Virtual Machine s. Objectives. In this chapter, you will learn about: System software Assemblers and assembly language Operating systems. Introduction. Naked machine
E N D
Invitation to Computer Science 6thEdition Chapter 6 An Introduction to System Software and Virtual Machines
Objectives In this chapter, you will learn about: • System software • Assemblers and assembly language • Operating systems Invitation to Computer Science, 6th Edition
Introduction • Naked machine • Hardware bereft of any helpful user-oriented features • Data as well as instructions must be represented in binary • To make a Von Neumann computer usable: • Create an interface between the user and the hardware Invitation to Computer Science, 6th Edition 3
System Software • The virtual machine • System software:collection of computer programs that manage the resources of a computer and facilitate access to those resources • Software: sequences of instructions that solve a problem Invitation to Computer Science, 6th Edition 4
Figure 6.1 The Role of System Software Invitation to Computer Science, 6th Edition
Types of System Software • Operating system • Communicates with users • Determines what they want • Activates other system programs, applications packages, or user programs to carry out their request Invitation to Computer Science, 6th Edition
Types of System Software (continued) • User interface • Provides user with an intuitive visual overview • Language services (assemblers, compilers, and interpreters) • Allow you to write programs in a high level • Memory managers • Allocate memory space for programs and data • Information managers • Handle the organization, storage, and retrieval of information on mass storage devices Invitation to Computer Science, 6th Edition
Figure 6.2 Types of System Software Invitation to Computer Science, 6th Edition
Types of System Software (continued) • I/O systems • Allow you to easily and efficiently use the input and output devices that exist on a computer system • Scheduler • Keeps a list of programs ready to run on the processor and selects the one that will execute next • Utilities • Library routines that provide useful services either to a user or to other system routines Invitation to Computer Science, 6th Edition
Assemblers and Assembly Language • Problems with machine language • Uses binary • Allows only numeric memory addresses • Is difficult to change • Is difficult to create data Invitation to Computer Science, 6th Edition
Assemblers and Assembly Language • Assembly languages • Designed to overcome shortcomings of machine languages • Each symbolic assembly language instruction is translated into exactly one binary machine language instruction • Create a more productive, user-oriented environment • Earlier termed second-generation languages • Now viewed as low-level programming languages Invitation to Computer Science, 6th Edition
Assembly Language • High-level programming languages • User oriented • Not machine specific • Use both natural language and mathematical notation in their design Invitation to Computer Science, 6th Edition
Figure 6.3 The Continuum of Programming Languages Invitation to Computer Science, 6th Edition
Assembly Language(continued) • Source program • Program written in assembly language • Object program • Source program must be translated into a corresponding machine language program • Assembler • System software that carries out translation • Advantage of assembly language • Allows use of symbolic addresses Invitation to Computer Science, 6th Edition
Figure 6.4 The Translation/ Loading/Execution Process Invitation to Computer Science, 6th Edition
Figure 6.5 Typical Assembly Language Instruction Set Invitation to Computer Science, 6th Edition
Assembly Language(continued) • Advantages of symbolic labels • Use of symbolic operation codes rather than numeric (binary) ones • Use of symbolic memory addresses rather than numeric (binary) ones • Pseudo-operations that provide useful user-oriented services such as data generation • Pseudo-op • Invokes the service of the assembler • Provides program construction Invitation to Computer Science, 6th Edition
Figure 6.6 Structure of a Typical Assembly Language Program Invitation to Computer Science, 6th Edition
Typical Instruction of Assembly Language • (Label): (op code mnemonic) (address field) (comments) • Label: permanent identification for this instruction of data, like an address of command. • op code mnemonic: symbolic command name • Address field: symbolic address of the data • Comments: for reading Invitation to Computer Science, 6th Edition
How to declare data in assembly language? • Example: (pseudo-op) FIVE: .DATA 5 Address content 53 0000000000000101 NEGSEVEN: .DATA -7 Address content 54 1000000000000111 Invitation to Computer Science, 6th Edition
How to use data? • LOAD FIVE • ADD NEGSEVEN Invitation to Computer Science, 6th Edition
Examples of Assembly Language Code • Arithmetic expression A = B + C – 7 (Assume that B and C have already been assigned values) Invitation to Computer Science, 6th Edition
Examples of Assembly Language Code • Assembly language translation LOAD B --Put the value B into register R. ADD C --R now holds the sum (B + C). SUBTRACT SEVEN --R now holds the expression (B + C - 7). STORE A --Store the result into A. : --These data should be placed after the HALT. A: .DATA 0 B: .DATA 0 C: .DATA 0 SEVEN: .DATA 7 --The constant 7. Invitation to Computer Science, 6th Edition
Examples of Assembly Language Code • Conditional operation • Tests and compares value • Algorithmic problem-solving cycle • One of the central themes of computer science Invitation to Computer Science, 6th Edition
Examples of Assembly Language Code • Problem • Read in a sequence of non-negative numbers, one number at a time, and compute a running sum • When you encounter a negative number, print out the sum of the non-negative values and stop Invitation to Computer Science, 6th Edition
Figure 6.7 Algorithm to Compute the Sum of Numbers Invitation to Computer Science, 6th Edition
Figure 6.8 Assembly Language Program to Compute the Sum of Nonnegative Numbers Invitation to Computer Science, 6th Edition
Translation and Loading • Assembler • Translates a symbolic assembly language program into machine language • Tasks performed • Convert symbolic op codes to binary • Convert symbolic addresses to binary • Perform the assembler services requested by the pseudo-ops • Put the translated instructions into a file for future use Invitation to Computer Science, 6th Edition
Translation and Loading (continued) • Op code table • Alphabetized list of all legal assembly language op codes and their binary equivalents • In assembly language: • A symbol is defined when it appears in the label field of an instruction or data pseudo-op Invitation to Computer Science, 6th Edition
Figure 6.9 Structure of the Op Code Table Invitation to Computer Science, 6th Edition
Figure 6.10 Generation of the Symbol Table Invitation to Computer Science, 6th Edition
Translation and Loading (continued) • Pass • Process of examining and processing every assembly language instruction in the program, one instruction at a time • Assemblers make two pass of the source code to generate object program. • First pass: Handle memory address and bind physical address • Second pass: Handle data generation and translate source program into object program. Invitation to Computer Science, 6th Edition
Translation and Loading (continued) • First pass over source code • Assembler looks at every instruction • Binding • Process of associating a symbolic name with a physical memory address • Primary purposes of the first pass of an assembler • To bind all symbolic names to address values • To enter those bindings into the symbol table Invitation to Computer Science, 6th Edition
Translation and Loading (continued) • Location counter • Variable used to determine the address of a given instruction • Second pass • Assembler translates source program into machine language • After completion of pass 1 and pass 2 • Object file contains the translated machine language object program Invitation to Computer Science, 6th Edition
Figure 6.11 Outline of Pass 1 of the Assembler Invitation to Computer Science, 6th Edition
Figure 6.12 Outline of Pass 2 of the Assembler Invitation to Computer Science, 6th Edition
Figure 6.13 Example of an Object Program Invitation to Computer Science, 6th Edition
Operating Systems • Operating system • Waits for requests and activates other system programs to service these requests • System commands • Used to translate, load, and run programs Invitation to Computer Science, 6th Edition
Functions of an Operating System • The user interface • Operating system commands usually request access to hardware resources, software services, or information • To communicate with a user, a GUI supports visual aids and point-and-click operations Invitation to Computer Science, 6th Edition
Figure 6.14 Some Typical Operating System Commands Invitation to Computer Science, 6th Edition
Figure 6.15 User Interface Responsibility of the Operating System Invitation to Computer Science, 6th Edition
Figure 6.16 Example of a Graphical User Interface Invitation to Computer Science, 6th Edition
System Security and Protection • Operating system • Controls access to the computer and its resources • Safeguards password file • Sometimes uses encryption to provide security • Access control • Use of a legal user name and password Invitation to Computer Science, 6th Edition
Figure 6.17 Authorization List for the File GRADES Invitation to Computer Science, 6th Edition
Efficient Allocation of Resources • I/O controller • Frees the processor to do useful work while the I/O operation is being completed • To ensure that a processor does not sit idle if there is useful work to do: • Operating system keeps a queue of programs that are ready to run Invitation to Computer Science, 6th Edition
The Safe Use of Resources • Operating system • Prevents programs or users from attempting operations that cause the computer system to enter a “frozen” state • Deadlock • Each program is waiting for a resource to become available that will never become free Invitation to Computer Science, 6th Edition
The Safe Use of Resources (continued) • Deadlock prevention • Operating system uses resource allocation algorithms that prevent deadlock from occurring in the first place • Deadlock recovery algorithms • Detect and recover from deadlocks Invitation to Computer Science, 6th Edition
Summary of OS Responsibilities • Major responsibilities of operating systems • User interface management (a receptionist) • Control of access to system and files (a security guard) • Program scheduling and activation (a dispatcher) • Efficient resource allocation (an efficiency expert) • Deadlock detection and error detection (a traffic officer) Invitation to Computer Science, 6th Edition
Historical Overview of OperatingSystems Development • First-generationsystem software • Roughly 1945–1955 • No operating systems and very little software support • Second-generationsystem software • Called batch operating systems (1955–1965) • Command language • Commands specifying to the operating system what operations to perform on programs Invitation to Computer Science, 6th Edition
Figure 6.18 Operation of a Batch Computer System Invitation to Computer Science, 6th Edition