1 / 96

UNIT-1 Introduction to System Programming

UNIT-1 Introduction to System Programming. Introduction: Components of System Software, Language Processing Activities, Fundamentals of Language Processing

jordank
Download Presentation

UNIT-1 Introduction to System Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. UNIT-1Introduction to System Programming Introduction: Components of System Software, Language Processing Activities, Fundamentals of Language Processing Assemblers: Elements of Assembly Language Programming, A simple Assembly Scheme, Pass structure of Assemblers, Design of Two Pass Assembler, Single pass assembler Macro Processor: Macro Definition and call, Macro Expansion, Nested Macro Calls and definition,Advanced Macro Facilities, Design of Macro Processor

  2. Unit-1 • Introduction: • Components of System Software, • Language Processing Activities, • Fundamentals of Language Processing

  3. Unit-1 Basic • Software • Types of software • Application software-Word, Excel etc. • System Software- Compiler, Assembler,O.S., Linker etc. Applicationsoftware Operatingandsystemssoftware Users Hardware Sytem Programming

  4. Unit-1 Application Software • Develop using Programming Lang. and Tools • Application software interact with systems software; • systems software then directs computer hardware to perform the necessary tasks Sytem Programming

  5. Unit-1 System Software • Needed for program development. • Controls operations of computer hardware • Definition: System Software Consist of a variety of program that support the operation of a computer. Sytem Programming

  6. Language processing Model Source Program C,C++,java etc Compiler Target Assembly Program Assembler Relocatable M/c Code Loader/Linkeditor Lib+ relocatableobj file Executable M/c Code

  7. Unit-1 Components of System Software, Example: • Assembler • Compiler • Macro processor • Loader • Linker • Interpreter • Operating System • Debugger • Text editor Sytem Programming

  8. Programming Languages: Terminology • Language translator • Systems software that converts a programmer’s source code into its equivalent in machine language • Source code • High-level program code written by the programmer • Object code • Another name for machine language code

  9. Unit-1 Assembler • A Translator • Assembler make two passes over the assembly file • First Pass: reads each line and records labels in a symbol table. • Second Pass : use info in symbol table to produce actual machine code for each line. Assembly Language Program Assembler Machine Language format or object file Fig.: Assembler

  10. Unit-1 Assembler… • Assembly lang. a symbolic representation of machine language. • uses a mnemonic to represent each low-level machine instruction or operation. • Assemblers with different syntax for a particular CPU or instruction set architecture. • Example:- An instruction to add memory data to a register x86-family processor: add eax,[ebx], whereas this would be written addl (%ebx),%eax in the AT&T syntax used by the GNU Assembler.

  11. Unit-1 Compiler • Once the target program is generated, the user can execute the program. Error Messages Program in Source Language Target code(Program in machine code) Compiler Fig.: A Compiler

  12. Unit-1 Compiler… • Early compilers were written in assembly language. • A compiler verifies code syntax, • generates efficient object code, • performs run-time organization, • and formats the output according to assembler • and linker conventions

  13. Unit-1 Macro Processor • It allows the programmer to write shorthand version of a program . • Macro allows a sequence of source language code to be defined once and then referred to by name each time it is to be referred. • Each time this name Occurs in a program, the sequence of codes is substituted at that point.

  14. Unit-1 Copy code -- Example Expanded source . . . STA DATA1 STB DATA2 STX DATA3 . STA DATA1 STB DATA2 STX DATA3 . Source STRG MACRO STA DATA1 STB DATA2 STX DATA3 MEND . STRG . STRG . . { {

  15. Unit-1 Loader and Linker • A program which accepts object program and prepares them for execution. • 4 main functions: • Allocationof space in main memory for the programs. • Linking of object modules with each other. • Adjust all address dependent locations. • Physically loading the machine instructions and data into the main memory.

  16. Unit-1 Interpreter • A Interpreter reads the source code oneinstruction or line at a this lineintomachine code or some intermediate form and executes it. Program statement Interpreter Machine language statement Statementexecution Fig.: Interpreter

  17. Unit-1 • Operating System- Interface between users and the hardware of a computer system. • Debugger- helps to detect error in the program. • Text editor- used to create and modify the program.

  18. Unit-1 Language Processing Activities • It Involvestranslation of a program written in a high level language into machine code • It can be divided into two groups: • Program generation activities • Program execution activities

  19. Unit-1 Language Processing Activities..

  20. Unit-1 1.Program generation activities • The program generator is a software which accepts the specification of program to be generated Andgenerates a program in target programming lang. Error Messages Program specification Program in target PL Program generator Sytem Programming Fig.: Program generator

  21. Unit-1 1.Program generation activities… Fig.: Specification and Execution gap • Execution gap is bridged by the compiler or interpreter. • The program generator bridges the gap between application domain & Programming lang. (PL)domain Sytem Programming

  22. Unit-1 1.Program generation activities… • Example- A Screen handling Program. • Employee name: • Address: • Married: • Age Sex Sytem Programming

  23. Unit-1 2.Program Execution activities • 2 Models for Program Execution: 1.Translation 2.Interpretion • A program must be translated before it can be executed. • The translated program may be saved in a file.The saved program may be executed repeatedly.

  24. Unit-1 1.Program Translation Fig.: Program Translation Model Sytem Programming

  25. Unit-1 Program Interpretation Sytem Programming

  26. Unit-1 Fundamental of Language Processing • Language Processing=Analysis of SP + Synthesis of TP Fig.: Phases of language of language processing Sp=source prog. TP=target program System Programming

  27. Unit-1 Analysis Phase • Three components: 1. Lexical rules -the formation of valid lexical units in the source language. Example:percent_profit = (profit * 100) / cost_price; identifies =, * and / operators, 100 as constant, and the remaining strings as identifiers. 2. Syntax rules the formation of valid statements in the source language. Example : percent_profit as the left hand side and (profit * 100) / cost_price as the expression on the right hand side. System Programming

  28. Unit-1 Analysis Phase… 3. Semantic rules -associate meaning with valid statements of the language. example: percent_profit = (profit * 100) / cost_price; Semantic analysis : assignment of profit X 100 / cost_price to percent_profit Sytem Programming

  29. Unit-1 Synthesis Phase • It performs two main activities: • Creation of data structures in the target program (memory allocation) • Generation of target code (code generation) Example MOVER AREG, PROFIT MULT AREG, 100 DIV AREG, COST_PRICE MOVEM AREG, PERCENT_PROFIT … PERCENT_PROFIT DW 1 PROFIT DW 1 COST_PRICE DW 1 Sytem Programming

  30. Unit-1 • Assemblers: • Elements of Assembly Language Programming, • A simple Assembly Scheme, • Pass structure of Assemblers, • Design of Two Pass Assembler, • Single pass assembler

  31. Unit-1 Assembler • A Translator • Assembler make two passes over the assembly file • First Pass: reads each line and records labels in a symbol table. • Second Pass : use info in symbol table to produce actual machine code for each line. Assembly Language Program Assembler Machine Language format or object file Fig.: Assembler

  32. Unit-1 Assembler… • The translated program contains 3 kinds of entities: • Relative entities- address of instructions and variables. • Absolute entities- operation code , numeric and string constant and fixed addresses. • The object program- addresses are relative symbols are defined externally Sytem Programming

  33. Unit-1 Assembler… • Assembly lang. a symbolic representation of machine language. • uses a mnemonic to represent each low-level machine instruction or operation. • Assemblers with different syntax for a particular CPU or instruction set architecture. • Example:- An instruction to add memory data to a register x86-family processor: add eax,[ebx], whereas this would be written addl (%ebx),%eax in the AT&T syntax used by the GNU Assembler.

  34. Unit-1 Assembler Elements of assembly language programs: • Basic features • Statement format • Operation code Sytem Programming

  35. Unit-1 A.Basic features • Assembly lang. Provides 3 basic features: • 1. Mnemonic Operation Codes(Opcodes) • Ex: MOVER or MOVEM • 2. Symbolic Operand: • Ex: DS – Declare as storage • DC – Declare as Constant • 3. Data Declaration: • Ex: X DC ‘-10.5’ Sytem Programming

  36. Unit-1 B.Statement Format Statement Format: [Label] <opcode> <operand1> [ <operand2>..] Label-Optional Opcode-it contain symbolic operation code Operand- Operand can also be a CPU register: AREG, BREG,CREG. Example- LOOP : MOVER AREG, ‘=5’

  37. Unit-1 Machine Instruction Format Fig.: Machine Instruction format for assembly lang. • Sign is not part of the instruction • Reg.operand: AREG, BREG,CREG,DREG. • Memory operand: Refers memory word using symbolic name Memory operand(3) Sytem Programming Sign Reg.operand(1) Opcode(2)

  38. Unit-1 Machine supports 11 Different Operations

  39. Unit-1 Machine supports 11 Different Operations First operand is always a CPU register Second operand is always a memory operand

  40. Unit-1 Assembly language statements 3 types of Statement in Assembly Language Imperative Declaration Assembler directives

  41. Unit-1 1.Imperative Statement Executable statement Indicates an action to be taken. translates into a machine instruction. class IS Ex.: MOVER BREG, X STOP READ X PRINT Y BC NE,L1

  42. Unit-1 2.Declaration statements Reserves memory for variables Initial value of a variable can also be specified. [label] DS <const specifying size of memory to be reserved> [label] DC <Initial value of variable> DS  declare storage, DC  declare constant Class-DL >

  43. Unit-1 2.Declaration statements… Reserve memory area of 1 word for variable X X DS 1 Y DS 5

  44. Unit-1 2.Declaration Statements… Reserve one word of memory for variable ONE Memory is initialized with ‘1’ ONE DC ‘1’

  45. Unit-1 MOT for declaration statements

  46. Unit-1 3.Assembler Directive • Instructs the assembler to perform certain actions during assembly of a program. • A directive is a direction for the assembler • A directive is also known as pseudo instruction • machine code is not generated for AD.

  47. Unit-1 3.Assembler Directive… START <Constant> It indicates that the first word of the m/c code should be placed in the memory word with the address <CONSTANT>

  48. Unit-1 3.Assembler Directive… END [<OPERAND SPECIFICATION>] Optional, indicates address of the instruction where the address of program should begin. By default, execution begins from the first instruction. It indicates the end of the source program. Class:AD

  49. Advanced Assembler Directives These directive include: ORIGIN Symbol LTORG

  50. ORIGIN Useful when m/c code is not stored in consecutive memory location. ORIGIN <address specification> Operand or constant or expression containing an operand and a constant. Sets LC to the address given by <address specification> LC processing in a relative rather than absolute manner

More Related