Süleyman Demirel Üniversitesi / Mühendislik Fak. / Bilgisayar Mühendisliği Carnegie Mellon Bölümü Bilgisayar Sistemlerine Genel Bakış BIL-304: Bilgisayar Mimarisi Dersi veren öğretim üyesi: Yrd. Doç. Dr. Fatih Gökçe Ders kitabına ait sunum dosyalarından adapte edilmiştir: http://csapp.cs.cmu.edu/ Adapted from slides of the textbook: http://csapp.cs.cmu.edu/ Adapted from the slides of Bryant and O Hallaron, Computer Systems: A Programmer s Perspective book by Asst. Prof. Dr. Fatih Gökçe 1
Hello! #include <stdio.h> int main() { printf("hello, World!"); return 0; }
ASCII Table
printf.o hello.c Source program (text) Preprocessor (cpp) hello.i Modified source program (text) Compiler (cc1) hello.s Assembly program (text) Assembler (as) hello.o Relocatable object programs (binary) Linker (ld) hello Executable object program (binary)
CPU Register file PC ALU System bus Memory bus Bus interface I/O bridge Main memory USB Graphics adapter I/O bus Expansion slots for other devices such as network adapters Mouse Keyboard Display hello executable stored on disk
CPU Register file PC ALU System bus Memory bus Bus interface I/O bridge Main memory "hello" USB Graphics adapter I/O bus Expansion slots for other devices such as network adapters Mouse Keyboard Display User types "hello"
CPU Register file PC ALU System bus Memory bus Bus interface I/O bridge Main memory "hello,world\n" hello code USB Graphics adapter I/O bus Expansion slots for other devices such as network adapters Mouse Keyboard Display hello executable stored on disk
CPU Register file PC ALU System bus Memory bus Bus interface I/O bridge Main memory "hello,world\n" hello code USB Graphics adapter I/O bus Expansion slots for other devices such as network adapters Mouse Keyboard Display "hello,world\n" hello executable stored on disk
Ön Bellek CPU chip Register file Cache memories ALU System bus Memory bus Bus interface I/O bridge Main memory
Smaller, faster, and costlier (per byte) storage devices Larger, slower, and cheaper (per byte) storage devices Hafıza Hiyerarşisi L6: L5: L4: L3: L2: L1: L0: Regs L1 cache (SRAM) L2 cache (SRAM) L3 cache (SRAM) Main memory (DRAM) Local secondary storage (local disks) Remote secondary storage (distributed file systems, Web servers) CPU registers hold words retrieved from cache memory. L1 cache holds cache lines retrieved from the L2 cache. L2 cache holds cache lines retrieved from L3 cache L3 cache holds cache lines retrieved from memory. Main memory holds disk blocks retrieved from local disks. Local disks hold files retrieved from disks on remote network servers.
Donanım İşletim Sistemi Tarafından Yönetilir Application programs Operating system Processor Main memory I/O devices Software Hardware
Abstraction-Soyutlama Processes Virtual memory Files Processor Main memory I/O devices
Context Switch Process A Process B Time read User code Kernel code Context switch interrupt Return from read User code Kernel code User code Context switch Thread?
Process Virtual adress space Kernel virtual memory User stack (created at runtime) Memory invisible to user code Memory mapped region for shared libraries printf function Run-time heap (created by malloc) Program start 0 Read/write data Read-only code and data Loaded from the hello executable file
CPU chip Register file PC ALU System bus Memory bus Bus interface I/O bridge Main memory Expansion slots I/O bus USB Graphics adapter Network adapter Mouse Keyboard Monitor Network
1. User types "hello" at the keyboard 5. Client prints "hello, world\n" string on display Local telnet client 2. Client sends "hello" string to telnet server 4. Telnet server sends "hello, world\n" string to client Remote telnet server 3. Server sends "hello" string to the shell, which runs the hello program, and passes the output to the telnet server
Tek çekirdek-çok çekirdek All processors Multiprocessors Uniprocessors Multicore Hyperthreaded
Processor package Core 0 Regs Core 3 Regs L1 d-cache L1 i-cache L1 d-cache L1 i-cache L2 unified cache L2 unified cache L3 unified cache (shared by all cores) Main memory
Virtual machine Processes Instruction set architecture Virtual memory Files Operating system Processor Main memory I/O devices