You are on page 1of 12

SYSTEM PROGRAMMING & SYSTEM ADMINISTRATION

04/08/2011

System programming: It is the activity of programming system software. System programming aims to produce software which provides services to the computer hardware (e.g. disk defragmenter). It requires a greater degree of hardware awareness. In system programming more specifically:

the programmer will make assumptions about the hardware and other properties of the system that the program runs on, and will often exploit those properties. usually a low-level programming language or programming language dialect is used that: o can operate in resource-constrained environments o is very efficient and has little runtime overhead o has a small runtime library, or none at all o allows for direct and "raw" control over memory access and control flow o lets the programmer write parts of the program directly in assembly language Running the program in a simulated environment can be used to reduce the debugging problems.

System Administration: It is the process of maintaining and operating a computer system and/or network. It generally includes to monitor how the software is being used and if there is any need of some technical support. System Administrators are appointed to do this. System administrators(Sysadmins) may be members of an information technology (IT) or Electronics and Communication Engineering department. Sysadmins are usually charged with installing, supporting, and maintaining servers or other computer systems, supervising or training computer operators, and planning for and responding to service outages and other problems.

EVOLUTION OF SYSTEM PROGRAMMING

05/08/2011

1. Linker : This software program basically performs two operations: i. Linking of the program with other programs needed for its execution, ii. Relocation of the program to execute from the specific memory area allocated to it. 2. Loader : This software program is responsible for the loading of program in the main memory for the purpose of execution.
Loads executable data Loading Prepare for execution

Secondary memory

Loader

Primary memory

Ready for execution

3. Assembler : This is a language processor that converts an Assembly Language code in machine code. Assembly Language uses Mnemonic operation codes and symbolic operands for working. These codes are thus converted into binary form by an assembler.

4. Macros : It is a unit of specification for program generation through expansion. It consists of a name, a set of formal parameters and a body of code. The use of a macro name with a set of actual parameters is replaced by some code generated from its body. This is called Macro Expansion. 5. Compiler : This is a language processor that translate HLL source program into object code. It bridges the semantic gap between a PL domain and an executable domain. Two main aspects of compilation are: i. Generate code to implement meaning of a source program in the executable domain, ii. Provide diagnostics for violations of PL semantics in a source program. 6. Formal Systems : These software programs provides the mathematical theories and expansions. It includes Alphabets, Axioms, Set Theory, Boolean Algebra, Normal Forms etc.

SOFTWARE TOOLS A software tool is a system programs which i. Interfaces a program with the entity generating its Input data, or ii. Interfaces the results of a program with the entity consuming them.
Raw program or data Transformed program or data

10/08/2011

Originator

Software tool

Consumer

Software tools for program development: 1. 2. 3. 4. 5. 6. Program design, coding & documentation Preparation of programs in machine readable form Program translation, linking and loading Program testing and debugging Performance tuning Reformatting the data and/or results of a program to suit other programs.

Program Entry & Editing: These tools are text editors or more sophisticated programs with text editors as front ends. The editor functions in two modes: command mode and data mode. There are various types of text editor: i. Line Editors: These are very simple editors and each line is designated positionally i.e. identified uniquely. The editing in these editors is limited to a line of text. ii. Stream Editors: It vies the entire text as a stream of characters. This permits edit operation to cross line boundaries. They supports character, line and context oriented commands based on the current editing context indicated by the position of a text pointer.

iii. Screen Editors: A line or stream editor does not show the text in the manner it would appear if printed. A screen editor uses the what-you-see-is-what-you-get(WYSIWYG) principle. The user can move cursor over the screen thus it is very useful while formatting the text to produce printed documents. iv. Word Processors: These are basically document editors with additional features to produce well formatted hard copy output. These provides features like header & footer, page numbers, spell check, merging, macros, layouts etc. WordStar is a popular word processor. v. Structure Editors: These incorporates an awareness of the structure of a document and helpful in browsing through a document. Editing requirements are specified using the structure. Syntax Directed Editors used in programming environment are the example. Program Testing & Debugging: This tool is used for the localization & removal of errors. The complete process is basically done using four components: i. Test data generators: They help users in selecting the test data for the program. They ensure that the program is thoroughly tested. They determine the conditions which must be satisfied by the programs inputs for control to flow along a specific execution path. ii. Automate test drivers: They help in Regression Testing in which a programs correctness is tested is verified by subjecting It to a standard set of tests after every modification. In this process, many sets of test data are prepared for a program and given as input to the test driver which organizes its execution. There are two problems in this concept: one concerns wastage of testing effort on infeasible paths and second concerns testing of complex loop structures. Thus both aspects are left to manual testing. iii. Debug Monitors: They help in obtaining information for localization of errors. iv. Source code control systems: They help to keep track of modifications in the source program. Producing debug information: The process of producing debug information can be done in two ways either statically by analyzing the source program or dynamically during the program execution. Statically produced debug information takes form of cross reference listings, lists of undefined variables and unreachable statements etc., i.e., program malfunction. Dynamically produced debug information takes the form of value dumps and execution traces produced during the execution of a program. It determines the execution path and also improves the effectiveness of debugging. Enhancement of Program Performance: It depends on two factors: the efficiency of the algorithm and the efficiency of the code. An optimized compiler can only improve efficiency of the code. Only a program designer can improve efficiency of the algorithm by re-writing it. It is

better to focus on those sections which takes a considerable execution time. It is fact that less than 3% of program code generally accounts for more than 50% of program execution time. A Profile Monitor us a software tool that collects information regarding the execution behavior of a program and presents it in the form of execution profile. It helps in detecting those sections consuming more execution time and those can be improved by either code optimization or algorithm improvement. 17/08/2011 Program Design, Coding & Documentation: This tool is used to generate programs, their environments and provide documentation to those. i. Program Generators: They generates a program which performs a set of functions described in its specification.
ERRORS

PROGRAM SPECIFICATION

PROGRAM GENERATOR

PROOGRAM IN TARGET PL

The designer expresses the ideas in the terms related to the application domain of the software. To implement these ideas, their description has to be interpreted in terms related to the execution domain. The term semantics is used to represent the rules of meaning of a domain, and the term semantics gap to represent the difference between the semantics of two domains. The semantic gap has many issues like large development time & efforts and poor quality of software. These issues are overcome by Software Engineering; which aimed at the use of a PL(programming Language) can be grouped into: Specification, design and coding steps PL implementation steps It uses a new domain PL domain. The semantics gap is divided into two parts: specificationand-design-gap(Specification Gap) and Execution Gap. Specification Gap is the semantic gap between two specifications of the same task. Execution Gap is the gap between the semantics of programs(that perform the same task) written in different PL. Each domain has a Specification Language(SL).

SEMANTIC GAP

APPLICATION DOMAIN

EXECUTION DOMAIN

SPECIFICATION GAP

EXECUTION GAP

APPLICATION DOMAIN

PL DOMAIN

EXECUTION DOMAIN

ii. Programming Environments: They support program coding by incorporating awareness of the programming language syntax and semantics in the language editor. It is a software system that provides integrated facilities for program creation, editing, execution, testing and debugging. It consists of the following components: A syntax directed editor(structure editor) A language processor(compiler, interpreter or both) A debug monitor A dialog monitor All components are accessed through the dialog monitor. The syntax directed editor incorporates a front end for the programming language. As a user keys in his program, the editor performs syntax analysis and converts it into an intermediate representation(IR), typically an abstract syntax tree. The compiler(or interpreter) and debug monitor share the IR. The compiler works incrementally to generate code for the statement. At any time during execution, the programmer can interrupt program execution and enter the debug mode or return to the editor. The main specification for the user is the easy accessibility of all functions through the dialog monitor. The system may provide other program development and testing functions.

iii. Documentation: Automatic documentation tools are motivated by the desire to avoid the lack of up-to-date documentation. These tools work on the source program to produce different forms of documentations e.g. flow charts, IO specifications etc. Debug Monitors: It provide the following facilities for dynamic debugging: Setting breakpoints in the program Initiating a debug conversation when control reaches a breakpoint Displaying values of variables Assigning new values to variables Testing user defined assertions and predicates involving program variables. The debug monitor functions can be easily implemented in an interpreter. How ever interpretation incurs considerably execution time penalties. These therefore rely on instrumentation of a compiled program to implement its functions. To enable the use of a debug monitor, the user must compile the program under the DEBUG operation. The steps involved in dynamic debugging are: The user compiles the program under the DEBUG operation. The compile produces two file:the compiled code and the debug information file. The user activates the debug monitor and indicates the name of the program to be debugged. The debug monitor opens the compiled code and debug information files for the program. The user specifies his debug requirements-a list of breakpoints and actions to be performed at breakpoints. The debug monitor instruments the program and builds a debug table containing the pairs(statement number, debug action). The instrumented program gets control and executes up to a breakpoint. A software interrupt is generated when the <SI_instrn> is executed, Control is given to the debug monitor which consults the debug table and performs the debug actions specified for the breakpoint. A debug conversation is now opened during which the user may issue some debug commands or modify breakpoints and associated debug actions. Control now returns to instrumental program. Step 4 and 5 are repeated until the end of the debug session.

PHASES OF COMPILATION PROCESS

19/08/2011

Phase: It is a logically cohesive operation that takes as input one presentation of source program and produce an output in another representation. Lexical Analyzer: This is interface of compiler to outside world. Its task is to scan the input source program and identify the valid words in it. It separates the character of the source language into the groups called tokens. The output of this is a stream of tokens utilized by syntax analyzer.

Syntax Analyzer: This phase will check the syntactic correctness of the input program. This involves grouping of source programs into grammatical phases used by compiler to synthesize the output. Semantic Analyzer: The semantics of a program depends on the language. It also provides type checking. Intermediate Code Generation: This phase generates the intermediate code for the compilation means the temporary calculations based code which is raw machine code without optimization and editing. Code Optimizer: Since the stages of the compilation are often automated, it generates a lot of redundant codes that can be possibly eliminated. For this purpose, the optimization is required. The code optimization attempts to improve the intermediate code. Code Generation: In this phase, optimized code is generated in the target PL thus we can say that the final target code is generated which is the result of whole compilation process. Symbol Table Management: Its a data structure holding information about all symbols defined in source programs. Error Handling & Recovery: It judges the quality of compiler by providing some selective and efficient error handling and recovery techniques.
SOURCE PROGRAM

LEXICAL ANALYZER

SYNTAX ANALYZER

SYMBOL TABLE MANAGEMENT

SEMANATICS ANALYZER

ERROR HANDLING & RECOVERY

INTERMEDIATE CODE GENERATOR

CODE OPTIMIZER

CODE GENERATOR

Incremental Compiler: In this type of compiler, once a module from some another file is opened and updated then compilation will be done only for that module not for the complete program.
START

COMPILE REQUEST ENTERED

OPEN .MDT FILE

COMPILE .OBJ FILE

GENERATE .EXE FILE

END

24/08/2011 When the program was compiled, all this information was available in some compiler tables. However, this information would cease to exit at the end of compilation. Even if provision is made to retain this information, a second difficulty faced by the compiler regarding the placement of code generated for a modified statement. When the original program was compiled, code for all statements were generated in their textual order to form the target program when a statement is modified, it will be necessary that code for new program should replace the original code. If new code is smaller than the original code, gaps will be created in the target program, on the other hand if new code is larger, it will not fir in available area. The same situation will arise when a new statement is inserted in the program. An Incremental Compiler has the capability to compile arbitrary sections of same program in increments of one or more statements in such a manner that the program comprising these program sections can execute properly. It overcomes the difficulties of a conventional compiler in this regard as follows: Provision is made to save & recall all compilation tables at the end and start of any compilation activity. The compilation & execution environment is designed in separate storage places. This compiler along with its routines, forms the compiler space source program which

may be retained that a listing can be produced, form the program problem space. Since the generated code is not in their textual order, a table called PST(Program Structure Table) in which we providing the sequence of program. Pointer Statement Labels Next
GENERATED CODE

100

#3

Here, 100 is the label for 1st statement; #3 is the label to be followed next; Pointer contains the address of area where code is stored corresponding to 2nd label. Cross Compiler: This compiler is capable of creating an executable code for a platform other than the one on which the compiler is running. Its tools are used to generate executable codes for embedded systems or multiple platforms. Assembler: This language processor converts an ALP(Assembly Language Program) into machine code. General Design Procedure: 1. Specify the problem 2. Specify data structure 3. Define format of data structure 4. Specify Algorithm 5. Look for modularity 6. Repeat step 1 to 5 on modules Design of Assembler: 1. Statement of Problem: i. START instruction is a pseudo-op instn giving JOH N as the name of the program. ii. USING is a pseudo-op that tells the assembler that register 15 is the base register and at execution time will contain the address of the first instn of the program. iii. L is the Load instn. iv. A is the Add instn. v. ST is the Store instn. vi. DC instn is a pseudo-op directing us to define some data

vii.

DS is a pseudo-op instn to create data space for TEMP. Source Program Relative Address First Pass Mnemonic instn Second Pass Mnemonic instn

Relative Address

JOHN

FOUR FIVE TEMP

START USING L A ST DC DC DS END

0 *, 15 1, FIVE 1, FOUR 1, TEMP F4 F5 1F

0 4 8 12 16 20

L A ST 4 5 -

1,-(0,15) 0 1,-(0,15) 4 1,-(0,15) 8 12 16 20

L A ST 4 5 -

1,16(0,15) 1,12(0,15) 1,20(0,15)

Assembler Functions: I. Generate Instn a) Evaluate the mnemonic in the operation field to produce its machine code. b) Evaluate the sub-fields find the value of each symbol, process literals and assign addresses. II. Process Pseudo-ops Pass 1: Purpose define literals & symbols i. Determine length of machine instn(MOTGET1) ii. Keep track of location counter(LC) iii. Remember values of symbols until pass 2(STSTO) iv. Process some pseudo ops, e.g., EQU, DS(POTGET1) v. Remember literals(LITSTO) Pass 2: Purpose generate object program i. Look up values of symbols(STGET) ii. Generate instn(MOTGET2) iii. Generate data(for DS, DC and literals) iv. Process pseudo ops(POTGET2) 2. Specify Data Structure : It means to establish the databases that we have to work with. Pass 1: databases: i. Input source program. ii. A location counter(LC), used to keep track of each instn location. iii. A table, the machine operation table(MOT) that indicates the symbolic mnemonic for each instn and its length in bytes.

iv. v. vi. vii.

A table, pseudo operation table(POT) that indicates the symbolic mnemonic and action to be taken for each pseudo-op in pass1. A table, the symbol table(ST) that is used to store each label and its corresponding value. A table, the literal table(LT) that is used to store each literal encountered and its corresponding assigned location. A copy of input to be used later by pass2. This may be stored in a secondary storage device.

Pass 2: databases: i. Copy of source program input to pass1. ii. location counter(LC). iii. A table, the machine operation table(MOT) that indicates for each instn: (a) symbolic mnemonic; (b)length; (c)binary machine op-code; (d)format iv. A table, pseudo operation table(POT) that indicates the symbolic mnemonic and action to be taken for each pseudo-op in pass1. v. A table, the symbol table(ST) prepared by pass1, containing each label and its corresponding value. vi. A table, base table(BT) that indicates which registers are currently specified as base registers by USING pseudo-op and what are their contents. vii. A work-place, INST, that is used to hold each instn as its various parts are being assembled together. viii. A work-place, PRINT LINE used to produce a printed listing. ix. A workplace, PUNCH CARD, used prior to actual outputting for converting the assembled instn into the format needed by the loader. x. An output deck of assembled instn in the format needed by the loader.

You might also like