Title: BIM 201 System Software
1BIM 201 System Software
- Time Wednesday 9-12
- Location B1
- Instructor Cuneyt Akinlar
- TA Cihan Kaleli
- Grading
- 2 Midterms 10 each
- Final 20
- Projects 60
- Books
- Any C book
2Whats this course about
- System software components and how they work
together in converting your C program into a form
that is understood by the machine - Preprocessor
- Compiler
- Assembler
- Linker
- Loader OS
3Goals of the course
- To improve your C/C programming skills by
having you implement a lot of code - To have you learn the basics of system software
components - Preprocessor, Compiler, Assembler, Linker, Loader
OS - To have you learn the basics of Computer
Architecture - CPU, ALU, registers, instruction sets
4System Software Components
- Preprocessor (cpp)
- Removes comments, expands macros
- Compiler (gcc)
- Converts your programs implemented in high-level
language to assembly language, which are mnemonic
codes that correspond one-to-one with machine
language - Assembler (gas)
- Converts programs implemented in assembly
language to machine language, which are binary
number codes understood by a specific CPU - Linker (ld)
- Combines several object files together into a
executable - Loader Operating System (execv Linux)
- Loads your program into memory for execution
5ExampleThrough the Preprocessor
define MACRO1 30 / Here is a comment. This
will be removed / main() int i i
MACRO1 / Set i to 30 / printf("i d,
MACRO1 d\n", i, MACRO1) / end-main /
Preprocessor (cpp)
main() int i i 30 printf("i d,
MACRO1 d\n", i, 30)
6Through the Compiler
main() int i i 30 printf("i d,
MACRO1 d\n", i, 30)
.rodata .LC0 .string "i d, MACRO1
d\n" .text main pushl ebp
movl esp, ebp subl 24,
esp andl -16, esp movl
0, eax addl 15, eax addl
15, eax shrl 4, eax sall
4, eax subl eax, esp
movl 30, -4(ebp) subl 4, esp
pushl 30 pushl -4(ebp)
pushl .LC0 call printf addl
16, esp leave ret
Compiler (gcc)
7Through the Assembler Linker
.rodata .LC0 .string "i d, MACRO1
d\n" .text main pushl ebp
movl esp, ebp subl 24,
esp andl -16, esp movl
0, eax addl 15, eax addl
15, eax shrl 4, eax sall
4, eax subl eax, esp
movl 30, -4(ebp) subl 4, esp
pushl 30 pushl -4(ebp)
pushl .LC0 call printf addl
16, esp leave ret
prinf
Object Code
Executable Code
Linker (ld)
Assembler (gas)
8Finally Operating System
- Is a layer of software that exports an easy to
use interface to program the hardware
User Programs
P1
P2
Pn
System call API
Operating System (Windows, Linux, Solaris, )
Hardware API
Hardware
- User programs make use of the hardware through
the services provided by the OS - Thus OS makes life easier for user programs
9Projects 60 total
- P1 - C project to dust of your C skills 5
- P2 - Preprocessor 7.5
- P3 Emulator 7.5
- P4 Disassembler 5
- P5 Assembler 10
- P6 Compiler1 7.5
- Simple expressions
- P7 Compiler2 7.5
- If/then/else, while loops
- P8 Compiler3 10
- Function calls parameter passing
10Projects - Warnings
- You can do your projects in groups of 2 people
- If you work in groups, submit a single project,
and write the name of both group members at the
top of main.cpp - If you forget to write your group members, we
will assume that only ONE person has worked on
the project. No excuses will be accepted after
the project delivery. So be responsible! - Cheaters will FAIL the class!
- We have automated tools to check for cheating.
So, do not even think about it.