Sei sulla pagina 1di 35

SYSTEM SOFTWARE

Course Objective
Going behind the scenes, gain a deep understanding of how computers actually work. Understanding the relationship between system software and machine architecture. Understanding how system software help program development (compilers, assemblers, linkers and loaders), and and program execution (OS, process management, file management, device management).

Text Book
System Software, An Introduction to Systems Programming, Leland L. Beck, Addison-Wesley ,1996 Windows System Programming, Johnson M. Hart, Third Edition, Addison-Wesley, 2005.

System Programming
Background Assemblers Loaders and Linkers Macro Processors Other System Software

Outline
Introduction System Software and Machine Architecture The Simplified Instructional Computer (SIC)
SIC Machine Architecture SIC/XE Machine Architecture SIC Programming Examples

Traditional (CISC) Machines RISC Machines

1.1 Introduction

System Software consists of a variety of programs that support the operation of a computer.

Software and its Types


Software : is a general term for the various kinds of programs or procedures or rules and associated documentation used to operate computers and related devices. devices Types of Software: 1. Application Software 2. Utility Software 3. System Software

APPLICATION SOFTWARE:
It is a set of program written in specific language for special purposes. E.g. Payroll system, accounting package.

Utility Software
A program that performs a very specific task, usually related to managing system resources. Operating systems contain a number of utilities for managing disk drives, printers, and other devices. Utilities

System Software Definition


System software consists of a variety of programs that support the operation of a computer . e.g. of system software Text editor, assembler, compiler, loader or linker, debugger, macro processors, operating system, database management systems, software engineering tools,

Examples in order are:

Text editors Compilers Loaders Linker Debugger Assembler Operating system System Software
S/w to create Program Development Environment
yText Editor

S/w to create Run-Time Environment

yCompiler yAssembler yStatic Linker

y Loader yLibraries yDynamic Linker yDebugger yOperating system

Systems Software: Program Development Environment




Text editor:

Software that permits the creation and editing of text (i.e. application programs). Compiler: Translates programs written in a high level language to machine level language (i.e from source code to object code ) (i.e Assembler: Translates programs written in assembly language to machine level language. (i.e from opcode to object (i.e code) Static Linker: Combines and resolves references between object programs and creates the executable code. (Links object programs) Debugger : It is used to debug executable programs and their (low-level) (lowrelated object code and source program.

Systems Software: Run-Time Environment


Loader: Loads an executable code and starts its execution. (i.e. loads object code from Secondary memory to Main memory) Libraries: Precompiled programs that creates a set of functions for use by other programs Dynamic Linker: Loads and links shared libraries at run-time Operating system: An event driven program that make an abstraction of the computer system. The O.S handles all resources efficiently, creates an environment for application programs to run, and creates a friendly interface between the user and the computer system.

Compile time Compiler/ assembler

Source Program

Object Module
Other Object Modules Link Editor (Linker)

Load time

Executable File

System Library

Loader
Dynamically Loaded System Library

Execution time

Running Program

Computer hardware + OS

System Software vs. Machine Architecture

One characteristic in which most system software differs from application software is machine dependency.

Machine dependency of system software


The aspects of system software that directly depend upon the type of computing system are known as Machine dependent features of system software. Machine architecture differs in:  Machine code  Instruction formats  Addressing mode  Registers e.g. assembler translate mnemonic instructions into machine code e.g. compilers must generate machine language code
Machine independency of system software There are aspects of system software that do not directly depend upon the type of computing system. General design and logic is basically the same and their examples are: Code optimization techniques Subprogram linking general design and logic of an assembler

System Software
- Some are

Some are Machine Dependent


Depends upon the type of computing system being supported. eg C compiler Machine dependent features

Some are Machine Independent


Does not directly depend upon the type of computing system being used. eg Java complier Machine Independent features

Machine code Instruction formats Addressing mode Registers

Code optimization techniques Subprogram linking General design and logic of an assembler

General Machine Architecture

SIC (Simplified Instructional Computer)

CISC (Complex Instruction Set Computer)

RISC ( Reduced Instruction Set Computer)

SIC std Arch

SIC / XE Arch

VAX Arch

Pentium Pro Arch

Ultra SPARC Arch

Power PC Arch

Cray T3 Arch

The Simplified Instructional Computer (SIC)


SIC is a hypothetical computer that includes the hardware features most often found on real machines Two versions of SIC standard model - SIC extension version - SIC /XE SIC Architecture SIC Standard Model It contains most common hardware features & avoids unusual or exceptional complexities SIC / XE Model SIC Extra Equipment or Extra Expensive

SIC Machine Architecture (1/5)


Memory
215 bytes in the computer memory 3 consecutive bytes form a word 8-bit bytes

Registers
Mnemonic Number Special use 0 A Accumulator; used for arithmetic operations X L PC SW 1 2 8 9

Index register; used for addressing Linkage register; JSUB Program counter Status word, including CC

Data Formats

No floating-point hardware on the standard version of SIC Integers are stored as 24-bit binary number 2 s complement representation for negative values Characters are stored using 8-bit ASCII codes +3=00000011 -3 =11111100+1=11111101
8 1 15

Instruction Formats
op od


dd

Addressing Modes

There are two addressing modes available Indicated by x bit in the instruction (X) represents the contents of Index Register X
Op od
od Direct Indexed d x=0 x=1

dd
on Target address calculation TA=address TA=address+(X)

Instruction Set
Format 3 load and store: LDA, LDX, STA, STX, etc. integer arithmetic operations: ADD, SUB, MUL, DIV, etc.
All arithmetic operations involve register A and a word in memory, with the result being left in the register

Compare instruction : COMP


COMP compares the value in register A with a word in memory, this instruction sets a condition code CC to indicate the result

conditional jump instructions: JLT, JEQ, JGT


these instructions test the setting of CC and jump accordingly

subroutine linkage: JSUB, RSUB


JSUB jumps to the subroutine, placing the return address in register L RSUB returns by jumping to the address contained in register L

Input and Output Input and output are performed by transferring 1 byte at a time to or from the rightmost 8 bits of register A Each device is assigned a unique 8-bit code. The Test Device (TD) instruction tests whether the addressed device is ready to send or receive a byte of data Read Data (RD) from Input Device Write Data (WD) to Output Device

SIC/XE Machine Architecture


Memory : 220 bytes. 1 megabytes (1024 KB) in memory Maximum memory available on a SIC/XE system is 1 megabyte (220 bytes) 4 additional registers, 24 bits in length registers B3 Base register; used for addressing S4 General working register T5 General working register F6 Floating-point accumulator (48 bits) Data format 24-bit binary number for integer, 2 s complement for negative values 48-bit floating-point data type The exponent is between 0 and 2047

11

36 fraction

s exponent

f*2(e-1024)

SIC/XE Machine Architecture (continue)


Varied instruction formats
Format 1 (1 byte)
8 op

Format 2 (2 bytes)
8 op 4 r1 4 r2

Format 3 (3 bytes)
6 op 1 1 1 1 1 1 n i x b p e 12 disp

Format 4 (4 bytes)
6 op 1 1 1 1 1 1 n i x b p e 20 address

Flag bits n,i,x,b,p indicate addressing modes

SIC/XE Machine Architecture (continue)


Additional instruction set

Load and store new registers (LDB, STB, etc.) Floating-point arithmetic operations (ADDF, SUBF, MULF, DIVF) Register move (RMO) Register-to-register arithmetic operations (ADDR, SUBR, MULR, DIVR) Special supervisor call instruction (SVC) generating interrupt to communicate with the OS

Additional input and output feature


Provide I/O channels, overlapping computing with I/O Instructions SIO, TOP, and HIO are used to start, test, and halt the operation of I/O channels

SIC/XE Machine Architecture (continue)


Addressing Flag values mode Direct Relative i = 1, n = 1 TA = disp; format 3 = address; format 4

Base relative b = 1, p = 0 = (B) + disp = (PC) + disp PC relative b = 0, p = 1 Only with format 3 i = 1, n = o i = o, n = 1 TA = operand value = (disp); format 3 = (address); format 4

Immediate indirect simple

i = 0, n = 0; b,p,e are part = disp[15bits]; Upward of the address field compatible with SIC

SIC/XE Machine Architecture (continue)


Addressing mode Direct (format 3) Direct (format 4) PC Relative Base Relative Indexed Simple (3) Indexed Simple (4) Indexed PC Relative Indexed Base Relative Flags nixbpe Operand

1 1 0 0 0 0 (disp [12bits] ) 1 1 0 0 0 1 (address [20bits] ) 1 1 0 0 1 0 ( (PC) + disp) 1 1 0 1 0 0 ( (B) + disp) 1 1 1 0 0 0 (disp + (X) ) 1 1 1 0 0 1 (address + (X) ) 1 1 1 0 1 0 (disp + (PC) + (X) ) 1 1 1 1 0 0 (disp + (B) + (X) )

( ) contents of a register or a memory location

Example of SIC/XE instructions and addressing modes

SIC/XE Machine Architecture (continue)


Addressing mode Simple SIC Simple SIC Indexed Indirect (format 3) Indirect (format 4) Indirect PC relative Indirect B relative Immediate (forma 3) Immediate (format 4) Immediate Base Rel. n i x b p e Operand 0 0 0 - - - (disp [15 bits] ) 0 0 1 - - - (disp [15 bits] + (X) ) 1 0 0 0 0 0 ( (disp) ) 1 0 0 0 0 1 ( (address) ) 1 0 0 0 1 0 ( (disp + (PC) ) ) 1 0 0 1 0 0 ( (address) + (X) ) ) 0 1 0 0 0 0 disp 0 1 0 0 0 1 address 0 1 0 1 0 0 disp + (B)

Immediate PC Relative 0 1 0 0 1 0 disp + (PC)

Mnemonic opcode

SIC Programming Examples (1) Data Movement comments operands

SIC
Assembler directives for defining storage

Address labels

SIC/XE
Immediate addressing makes program faster due to fewer memory reference

SIC Programming Examples (2) Arithmetic

SIC

BETA (ALPHA + INCR - 1) DELTA (GAMMA + INCR - 1)

1.3.3 SIC Programming Examples

SIC Programming Examples (3) Looping and Indexing: part I

SIC

Copy one 11-byte string to another

Potrebbero piacerti anche