System Programming & Operating Systems Notes
WEEK 1: Brief Review of Program Concepts
System Programming is the development of software that interacts directly with hardware or provides
services for application programs. Examples include operating systems, compilers, and assemblers.
Application Programming involves creating software that serves end-users, such as word processors and
media players.
Assembler: A software that converts assembly language into machine code.
Operating System: A system program that manages hardware and software resources, providing services for
application programs.
Differences between System and Application Programs:
- System programs manage hardware and system resources.
- Application programs provide services to users.
WEEK 2: 1-Pass and 2-Pass Assemblers
A 1-Pass Assembler scans the source code once, generating machine code directly but requiring forward
references.
A 2-Pass Assembler processes the source code twice: first to build the symbol table, and second to generate
machine code.
Operating System: Software that manages hardware resources and provides services to users and
applications.
WEEK 3: Assembly Functions
Basic Assembler Functions:
1. Translating mnemonic instructions into machine code.
2. Managing labels and addresses.
3. Handling assembler directives.
Assembler Directives: Commands to the assembler that provide control over the assembly process (e.g.,
defining constants).
Example of a SIC (Simplified Instructional Computer) assembler program:
```assembly
START 1000
LDA VALUE
ADD INCR
STA VALUE
END
```
WEEK 4: Types of Instructions
Assembly language programs follow a specific structure, including:
- Labels (optional identifiers for memory locations)
- Op-code (instruction to be executed)
- Operands (data or memory addresses)
Instruction cycle:
1. Fetch
2. Decode
3. Execute
4. Store
Registers: Small storage locations in the CPU that hold data temporarily.
WEEK 5: Symbol Table and Local Labels
Symbol Table: A data structure used by the assembler to keep track of identifiers and their addresses.
Local Labels: Labels used within a specific scope, helping manage branching in programs.
Example program:
```assembly
LOOP: LDA COUNT
ADD ONE
STA COUNT
JMP LOOP
```
WEEK 6: Assembler Functions
Assembler Modules:
1. Lexical Analysis: Tokenizes input code.
2. Syntax Analysis: Checks correctness.
3. Code Generation: Produces machine code.
Assembler Functions:
- Symbol resolution
- Address calculation
- Error detection
WEEK 7: Compilation Stages
Compilation involves:
1. Lexical Analysis
2. Syntax Analysis
3. Semantic Analysis
4. Code Optimization
5. Code Generation
Types of compilers:
- Just-In-Time (JIT) Compiler
- Cross-Compiler
- Native Compiler
WEEK 8: Front and Back End Compilation
Front End: Performs lexical, syntax, and semantic analysis.
Back End: Performs code optimization and generation.
WEEK 9: Error Checking and Libraries
Error Handling:
- Syntax errors
- Semantic errors
- Logical errors
Types of Libraries:
- Static Libraries (.lib, .a)
- Dynamic Libraries (.dll, .so)
WEEK 10: History of Operating Systems
Evolution:
- Batch Processing Systems
- Time-Sharing Systems
- Real-Time Systems
- Network and Distributed Systems
OS Commands:
- MS-DOS: `dir`, `cd`, `copy`
- UNIX: `ls`, `pwd`, `cp`
WEEK 11: OS Services
- Process Management
- Memory Management
- File System Management
- Security and Access Control
WEEK 12: I/O Buffering and Spooling
I/O Buffering: Temporarily storing data for smooth input/output operations.
Spooling: Storing output before sending it to the device, improving efficiency.
WEEK 13: Interrupts and Traps
Interrupts: Signals to the CPU to pause current execution and handle a high-priority task.
Traps: Software-generated interrupts, often due to errors.
WEEK 14: Multiprogramming, Multitasking, Multiprocessing
Multiprogramming: Running multiple programs at once.
Multitasking: Running multiple tasks simultaneously.
Multiprocessing: Using multiple processors to execute tasks.
WEEK 15: Revision and Comparison
Assembler vs Interpreter vs Compiler:
- Assembler: Translates assembly to machine code.
- Interpreter: Executes code line by line.
- Compiler: Translates entire source code into machine code before execution.
Features of MS-DOS vs Windows:
- MS-DOS: Command-line based.
- Windows: Graphical user interface.