Unit 1: Introduction to System Programming

System Programming & Operating System (SPOS)

Home > SPOS > Unit 1

📖 Topics Covered

Topic 1: What is System Programming?

What is System?

A system is the collection of various components working together to achieve a goal.

Example: College is a system.

It consists of various components like departments, classrooms, faculties, and students.

What is Programming?

Programming is the art of designing and implementing programs to perform specific tasks.

In a college system, what is a program?

A lecture can be considered as a program because it has input and output.

Input: The information that the teacher is delivering.

Output: The knowledge that the student has received.

What is Software?

Software is a collection of many programs designed to perform specific tasks or operations.

Types of Software:

What is System Program?

System Programs are programs required for the effective execution of general user programs on a computer system.

So, system programming is the art of designing and implementing System Programs.

Topic 2: Need of System Programming

System programming is essential for the smooth functioning of any computer system. It creates a bridge between the hardware and application software.

Reasons Why System Programming is Needed:

Topic 4: Application vs System Software

Feature Application Software System Software
Definition Designed to perform specific tasks for the user (e.g., editing, playback). Designed to manage hardware and provide a platform for apps.
Purpose Helps users accomplish specific tasks. Operates hardware and supports apps.
User Interaction Directly used by end-users. Runs in the background.
Dependency Depends on system software. Can run independently; supports apps.
Examples MS Word, VLC Player. Windows OS, Compiler, Assembler.

Topic 5: Evolution of System Components

As computing needs evolved, various components were introduced to make systems more efficient and user-friendly.

1. Text Editors

Used to write and edit source code. Evolved from command-line (ed, vi) to modern IDEs (VS Code).

2. Assembler

Converts assembly language to machine code. Evolved from simple translators to complex ones supporting macros and optimization.

3. Macro Processor

Enables code reuse via macro definitions. Reduces redundancy and improves modularity.

4. Compiler

Translates high-level language (C, Java) to machine code. Modern compilers (GCC, Clang) are modular and optimizing.

5. Interpreter

Executes source code line-by-line (Python, JS). Good for rapid development/testing.

6. Loader

Loads compiled code into memory. Types include Absolute, Relocating, and Dynamic loaders.

7. Linker

Links multiple object files and libraries to form an executable.

8. Debugger

Helps identify and fix errors (Breakpoints, stepping). Evolved from CLI to GUI.

9. Device Drivers

Interface between hardware and OS. Essential for peripherals.

10. Operating System

Manages resources and provides services. Evolved from Batch -> Time-sharing -> Multitasking.

Topic 6: Elements of Assembly Language

Assembly is a low-level, machine-dependent language that uses mnemonics instead of binary.

Hypothetical Assembly Language (Dhamdhere)

This model is used for study purposes.

Registers

Instructions

Format: LABEL OPCODE REG, MEMORY

Topic 7: Assembly Language Statements

1. Imperative Statements

Generate machine code. Executable instructions.

Examples: ADD AREG, X, MOVER BREG, Y

2. Declarative Statements

Reserve memory or define constants. Do not generate machine instructions.

3. Assembler Directives

Instructions for the assembler, not the CPU.

Topic 9 & 10: Assembler Pass Structure

Assemblers typically use two passes.

Pass 1: Analysis Phase

Pass 2: Synthesis Phase

Topic 11-13: Processing Statements

Details on how specific statement types are handled:

Processing Declarations (Pass 1)

DS and DC populate the Symbol Table and update the Location Counter. DC also generates constants in the output.

Processing Directives (Pass 1)

START/ORIGIN set the LC. EQU adds symbols. LTORG/END trigger literal pool allocation.

Processing Imperatives (Pass 2)

Instructions like ADD, MOVER are translated to machine code using opcode tables and resolved addresses.

Topic 15: Pass I Example

Source Code

START 200
MOVER AREG, A
ADD BREG, ='5'
A DS 1
LTORG
B DC '2'
END
              

Intermediate Code Output

(AD, 01) (C, 200)     ; START 200
(IS, 04) (1) (S, 0)   ; MOVER AREG, A
(IS, 01) (2) (L, 0)   ; ADD BREG, ='5'
(DL, 01) (C, 1)       ; A DS 1
(DL, 02) (C, 2)       ; B DC '2'
(AD, 02)              ; END
              

Tables Generated

Symbol Table (SYMTAB)

Index Symbol Address
0 A 202
1 B 204

Literal Table (LITTAB)

Index Literal Address
0 ='5' 203

Topic 16 & 17: Intermediate Code & Pass II

Pass II takes the IC and tables from Pass I to generate the final machine code.

Source IC Machine Code
MOVER AREG, A (IS, 04) (RG, 01) (S, 0) 04 01 202
ADD BREG, ='5' (IS, 01) (RG, 02) (L, 0) 01 02 203

🎓 SPPU Exam Preparation: Unit 1

Q1. Define System Programming. State the need for System Programming. (5 Marks)

Answer: Define it as the art of designing system software. Mention hardware control, resource management, and providing a platform for apps.

Q2. Differentiate between Language Processor and Operating System. (5 Marks)

Answer: LP translates code (Assembler, Compiler), while OS manages resources (Task scheduling, Memory management).

Q3. Explain the pass structure of a Two-Pass Assembler. (8 Marks)

Answer: Explain Pass 1 (Analysis, Table construction, IC generation) and Pass 2 (Synthesis, Machine code generation).

Q4. What are Assembler Directives? Explain any four with examples. (8 Marks)

Answer: Define directives as instructions for the assembler. Explain START, END, ORIGIN, EQU, LTORG.

Q5. Compare Compiler and Interpreter. (5 Marks)

Answer: Compiler translates whole program at once (Faster execution), Interpreter translates line-by-line (Easier debugging).

10. Summary for Quick Revision

  • 🔹 System Programming: Developing software that manages hardware.
  • 🔹 Assembler: Translates Assembly mnemonic to Machine code.
  • 🔹 Pass 1: Builds SYMTAB, LITTAB, and generates IC.
  • 🔹 Pass 2: Uses SYMTAB/LITTAB to create final Machine code.
  • 🔹 Directives: START, END, EQU, ORIGIN, LTORG.
  • 🔹 Declarations: DS (Reserve), DC (Constant).
  • 🔹 Imperatives: ADD, SUB, MOVER, MOVEM, etc.
  • 🔹 Literals: Values like ='5' processed at LTORG/END.