Computer Architecture and System Programming Laboratory

Slides:



Advertisements
מצגות קשורות
אוגרים ומונים – Registers & Counters
Advertisements

אוגרים ומונים – Registers & Counters
Practical Session 11 File Systems, part 2
Biomolecular Computers
תוכנה 1 בשפת Java שיעור מספר 5: עצמים
קורס ניהול ידע מפגש 3 - פורטלים 2know.kmrom.com.
מבנה מחשבים ספרתיים זיכרון מטמון - המשך
תרגול מס' 1: מנהלות חזרה על ארכיטקטורת ה- MIPS
תגובות חמצון -חיזור ודוגמאות מחיי היום יום
מבוא לתכנות ב-JAVA מעבדה 1
Trends in Periodic Table Properties
על הסתיו ועוד, בגן ה"תמרים" בעכו שם הגננות: מירב קדוש אלה נאמן
תרגול 11 מלכודות בניית ה-Debugger
לולאות Department of Computer Science-BGU 19 יולי 19.
The Partnership tree in ECP- Austin עץ השותפות באוסטין
טקס פתיחת "גינת השותפות" בעכו
Isotopes and Atomic Mass
מומחי BI אומרים מציגה: מוריה לוי, מנכ"ל ROM Knowledgeware
OOO Execution of Memory Operations
Marina Kogan Sadetsky –
אלקטרושליליות ופולריות הקשר
2013 האמור במצגת זו כולל גם מידע צופה פני עתיד, כהגדרתו בחוק ניירות ערך, של תחזיות, מטרות, הערכות, אומדנים ומידע אחר המתייחסים לאירועים ו/או לעניינים.
Jump tables, review questions
מודל דחיית זוגות אלקטרונים של קליפת הערכיות
הפרויקט השנתי בהנדסת תוכנה Git and GitHub
Present Perfect Simple
Passover in “Tomer” kindergarten
תרכובות עם יונים פוליאטומים בחיי היום יום
יסודות מבני נתונים תרגול 13: עץ פורש מינימלי - Minimum Spanning Tree (MST)
חוק שימור החומר The Law of Conservation of Mass indicates that in an
Out Of Order Execution (Part 1)
The Dolphin Class International Forest of Support
DIPLOMACY AND INTERNATIONAL COMMUNICATION
חג פורים שמח ומבדח מגן פרפר....תפן שם הגננת: מאיה פלס
OOO Execution of Memory Operations
Akiba Academy of Dallas Presents
Short Documentation from “Yom Hatzmaut” activities in ECP – Austin TX תיעוד קצר מהפעילויות בגיל הרך בבית הספר היהודי באוסטין טקסס לקראת יום העצמאות.
ט"ו בשבט בגן " תומר" Tu Bishvat in “Tomer” kindergarten
האם אתם יודעים כיצד כותבים מגילה?
את כל מרכולתנו הבאנו לגן ותראו מה עשינו!!!!
מוטיבציה והשוואה בין מבני נתונים שלמדנו
“ The Borrowed Hanukkah Latkes” Dalmatian class-Austin
Direction of induced current
מבוסס על שקפים מאת יאן ציטרין
שם הגננת: עדנה סרי The teacher: Edna Seri
תורת הקומפילציה תרגול 9: תרגום לקוד ביניים
הכנה למבחן.
מבוא לתכנות למערכות מידע
בתרכובות יוניות יש קשרים יונים
תיעוד מפעילויות ראש השנה בגן "פרפר נחמד" –עכו-תש"ע
Branch Prediction בעריכת אורן קצנגולד Updated by Franck Sala.
Branch Prediction Oren Katzengold, Franck Sala, Elad Shtiegmann.
Elements and Symbols יסודות וסמלים מהם יסודות? gold carbon aluminum
Marina Kogan Sadetsky –
Emech at 1 + W = Emech at 2 mgh1 = mgh2
תוכנה 1 תשס"ח סמסטר ב' אוהד ברזילי ליאור שפירא
What is Chemistry? מהי כימיה? Chemistry is the study of matter and its
קומבינטוריקה למדעי-המחשב EULER GRAPHS גרפים אויילרים
הכנת שמן זית וארכיאולוגיה בגן "ארגמן" עכו Preparing olive oil and Archeology at “Argaman” kindergarten in Akko שם הגננת: נטלי גוריבודסקי שם הסייעת :
“Augustus and his smile” “"חיוכו של נסיך
מבוסס על שקפים מאת יאן ציטרין
Tutorial #10 MIPS commands
תרגול מס' 2: Data and Control Hazards
OOO Execution of Memory Operations
שם הגננת:אתי ברכפלד קיבוץ סער
עקרונות תכנות מונחה עצמים תרגול 9:C++ - תרגילים
יינון המים In the ionization of water,
Engineering Programming A
בגן" הדס" בעכו משלבת פרלה שטרית הגננת ,בין חנוכה לבין השמירה על איכות הסביבה. פרלה בקשה מהילדים להכין בביתם חנוכייה מחומרים ממוחזרים או מחומרים שאינם.
תמליל מצגת:

Computer Architecture and System Programming Laboratory TA Session 11 Memory Access Performance

Memory access הנחות יסוד: קריאה וכתיבה לזיכרון מתבצעות ביחידות של 4 בתים החל מכתובת המתחלקת ב-4 immediate נשמר או בבית 1, או ב 2 בתים , או ב 4 בתים instruction length = opcode length + immediate arguments length 0x00000000 0x00000004 0x00000008 0x0000000C … RAM: גישות לזיכרון: Fetch – קריאת קוד הפקודה Read – קריאת אופרנדים לחישוב Write – כתיבת תוצאת החישוב

שאלה 1 בסה"כ 4 גישות לזיכרון. פתרון: כמה גישות לזיכרון, במקרה הגרוע, דרושות לביצוע הפקודה: MOV EAX, [0x87654321] אם ידוע כי אורך ה-op-code הוא בית אחד? פתרון: Fetch – בתוך ה-op-code מצוין כל המידע הדרוש, פרט לכתובת. לכן, אורך הפקודה כולה 5 בתים (4 בתים נדרשים לקידוד הכתובת). במקרה הגרוע, קריאה של 5 בתים מהזיכרון דורשת 2 גישות לזכרון. RAM (.text): 0x87 0x65 0x43 0x21 opcode or 0x87 0x65 0x43 0x21 opcode or 0x87 0x65 0x43 0x21 opcode or 0x87 0x65 0x43 0x21 opcode Read – יש לקרוא 4 בתים (התוכן הנמצא בכתובת הנתונה) ובמקרה הנתון פעולה זו דורשת 2 גישות לזיכרון. 0x87654321 RAM: Write – הכתיבה היא לתוך אוגר (אין גישה לזיכרון). בסה"כ 4 גישות לזיכרון.

שאלה 2 בסה"כ 6 גישות לזיכרון. פתרון: כמה גישות לזיכרון, במקרה הגרוע, דרושות לביצוע הפקודה: push word [ECX] אם ידוע כי אורך ה-op-code הוא 3 בתים ? פתרון: Fetch – בתוך ה-op-code מצוין כל המידע הדרוש. במקרה הגרוע, קריאה של 3 בתים מהזיכרון דורשת 2 גישות לזיכרון. RAM (.text): opcode or opcode Read – יש לקרוא 2 בתים (מילה, החל מהכתובת ב-ECX) ובמקרה הגרוע פעולה זו דורשת 2 גישות לזיכרון. ECX RAM (.text): Write – הכתיבה היא למחסנית (זיכרון), ובמקרה הגרוע בו ESP מצביע לכתובת אי-זוגית, גם כאן נדרשות 2 גישות לזיכרון. ESP RAM (stack): בסה"כ 6 גישות לזיכרון.

Read – יש לקרוא 4 בתים החל מהכתובת 0x01020304 --> גישה אחת לזיכרון שאלה 3 נתונה פקודה בשפת אסמבלי ואותה פקודה לאחר הקימפול בשפת מכונה: ADD EBX, dword [label] 0x031D04030201 כמה גישות לזיכרון, במקרה הגרוע, דרושות לביצוע הפקודה? פתרון: Fetch – אורך הקוד הבינארי 6 בתים. קריאתם מהזיכרון דורשת 3 גישות לזיכרון לכל היותר Read – יש לקרוא 4 בתים החל מהכתובת 0x01020304 --> גישה אחת לזיכרון Write – הכתיבה היא לרגיסטר בסה"כ 4 גישות לזיכרון

Read – יש לקרוא 4 בתים החל מהכתובת --> 2 גישות לזיכרון לכל היותר שאלה 4 כמה גישות לזיכרון, במקרה הגרוע, דרושות לביצוע הפקודה ADD dword [x], 0x10001 אם ידוע כי אורך ה-op-code הוא 2 בתים ? פתרון: Fetch – אורך הקוד הבינארי 10 בתים – 2 עבור opcode, 4 עבור הכתובת x, ועוד 4 עבור מהספר המיידי. קריאתם מהזיכרון דורשת 4 גישות לזיכרון לכל היותר Read – יש לקרוא 4 בתים החל מהכתובת --> 2 גישות לזיכרון לכל היותר Write – יש לכתוב 4 בתים , וזה דורש 2 גישות לזכרון במקרה הגרוע. בסה"כ 8 גישות לזיכרון

Performance source book slides Clock cycle: time between 2 consequent (machine) clock ticks. Instead of reporting execution time in seconds, we often use cycles. Clock rate: cycles per second 1 Hz = 1 cycle/sec 1Mhz = 106 Hz Example: Machine X has 200 Mhz clock rate => X’s clock rate is 200 * 106 Hz => X produces 2*108 clock cycles per second => X’s cycle (time) is 1/ 2*108 = 5 nanoseconds (nanosecond = 10-9 seconds) CPI (cycles per instruction) - quantity of clock cycles needed to execute an instruction Speedup: = old execution time / improved execution time Performance of a program A on machine X: Px(A) = 1 / execution timex Machine X is n time faster than machine Y  Px / Py = n different machine instructions take different amount of clock cycles

Question 1 Some program runs in 10 seconds on computer A, which has a 400 Mhz clock. We built a new machine B, which runs in 600 Mhz, but this machine requires each instruction 1.2 times as many clock cycles as machine A. How much time would it take machine B to execute the same program? Solution: 400 Mhz = 4*108 Hz => machine A provides 4*108 cycles per second program runs 10 seconds on machine A => program execution takes 4*109 cycles = > on machine B it would take 1.2 * 4*109 = 4.8 *109 cycles 600 Mhz = 6*108 Hz => machine B provides 6*108 cycles per second = > on machine B it would take 4.8 *109 / 6 *108 Hz = 8 seconds

Question 2 There are two different classes of instructions: A and B . - machine A has a clock cycle time of 10 ns. (nanoseconds) and a CPI (cycles per instruction) of 2 for class A instruction, CPI of 3 for class B instructions. - machine B has a clock cycle time of 20 ns. and a CPI of 1.25 for both instructions classes. A given program consists of 50% class A instructions and 50% class B instructions. Which machine runs this program faster? Solution: machine A: spends 2 * 10 = 20 ns per A class instruction machine A: spends 3 * 10 = 30 ns per B class instruction machine B: spends 1.25 * 20 = 25 ns per both A and B classes instruction Time per instruction on machine A: (20 + 30)/2 = 25 ns Time per instruction on machine B: 25 ns => the machines have same performance for the given program

Question 3 There are three different classes of instructions: class A, B and C. They require 1, 3 and 5 cycles respectively. There are two code sequences: - first code sequence: 1 instructions of class A, 2 of B, and 1 of C. - second code sequence: 6 instructions of class A, 1 of B, and 1 of C. Which sequence will be faster? By how much? What is the average CPI (cycles per instruction) for each sequence? Solution: first code: 1*1+2*3+1*5 = 12 cycles => CPI = 12 / (1+2+1) = 3 second code: 6*1+1*3+1*5 = 14 cycles => CPI = 14 / (6+1+1) = 1.75 first code is faster by 14/12 (speedup) CPI = 3 for first code, CPI = 1.75 for second code

Question 4 A program runs in 100 seconds, with multiply (instructions) responsible for 80 seconds of its time. How much do we have to improve the speed of multiplication if we want the program to run 4 times faster? How about making it 5 times faster? Solution: 100 sec total time – 80 sec multiplications = 20 sec rest instructions 4 times faster => 100 / 4 = 25 sec => 25-20=5 sec for multiplications => 80 / 5 = 16 times multiplication instruction speed needed 5 times faster => 100 / 5 = 20 sec => 20-20=0 sec for multiplications => impossible 

Question 5 Given a code runs for 20 sec. A code consists of 70% floating-point instructions. We improved floating-point instructions run 7 times faster, but caused rest of the instructions run double the time. What will the speedup be? Solution: 70% of 20 seconds = 14 seconds for floating point instructions => 6 sec for rest instructions execution time after improvement = 6*2 sec+ 14 sec / 7 = 12+2 = 14 sec => speedup = 20 / 14