System Programming OS Notes
System Programming OS Notes
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.
Operating System: A system program that manages hardware and software resources, providing services for
application programs.
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.
Assembler Directives: Commands to the assembler that provide control over the assembly process (e.g.,
defining constants).
Instruction cycle:
1. Fetch
2. Decode
3. Execute
4. Store
Registers: Small storage locations in the CPU that hold data temporarily.
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
```
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
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
Types of Libraries:
- Static Libraries (.lib, .a)
- Dynamic Libraries (.dll, .so)
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`
- Process Management
- Memory Management
- File System Management
- Security and Access Control
Interrupts: Signals to the CPU to pause current execution and handle a high-priority task.
Traps: Software-generated interrupts, often due to errors.