Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 5.6, Problem 5.4PP
A.
Program Plan Intro
Memory aliasing:
- It denotes a case where two pointers might designate to memory location that is same.
- The compiler should assume that unlike pointers might be aliased for safe optimizations.
- The program aspects that could limit chances for a compiler in generating optimized code denote optimization blockers.
- If a compiler is unable to determine whether two pointers might be aliased, it should adopt that either case would be possible.
- The possible optimization set is been limited in this case.
B.
Program Plan Intro
Memory aliasing:
- It denotes a case where two pointers might designate to memory location that is same.
- The compiler should assume that unlike pointers might be aliased for safe optimizations.
- The program aspects that could limit chances for a compiler in generating optimized code denote optimization blockers.
- If a compiler is unable to determine whether two pointers might be aliased, it should adopt that either case would be possible.
- The possible optimization set is been limited in this case.
C.
Program Plan Intro
Memory aliasing:
- It denotes a case where two pointers might designate to memory location that is same.
- The compiler should assume that unlike pointers might be aliased for safe optimizations.
- The program aspects that could limit chances for a compiler in generating optimized code denote optimization blockers.
- If a compiler is unable to determine whether two pointers might be aliased, it should adopt that either case would be possible.
- The possible optimization set is been limited in this case.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
5.14
Write a version of the inner product procedure described in Problem 5.13 that
uses 6 x 1 loop unrolling. For x86-64, our measurements of the unrolled version
give a CPE of 1.07 for integer data but still 3.01 for both floating-point data.
A. Explain why any (scalar) version of an inner product procedure running on
an Intel Core i7 Haswell processor cannot achieve a CPE less than 1.00.
B. Explain why the performance for floating-point data did not improve with
loop unrolling.
Q2: Besides the while-loop in Q1, I want to implement a 2nd while-loop running in parallel with the first
while:
while(1) {
wt(1);
XX);
}
However, on an MCU there is no parallelism. (For ex., on Arduino I can define only one loop() function.)
Write a single while that does the job of both whiles.
(a) Write it in a procedural style.
(b) Write it the super-loop style (state-machine with fixed heartbeat).
Please provide running time functions, order of growth rates in Big-O, Omega and Theta Notations for the following code fragments. Please show your work.
Chapter 5 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Knowledge Booster
Similar questions
- 1.Code so on for_A pure full Implement c/c++ to evaluate round robin algorithm. You must use the job list given here: Job (1) arrive at CPU cycle1 Job (2) arrive at CPU cycle2 Job (3) arrive at CPU cycle36 I/O (32) CPU (54) I/O (45) CPU (20) I/O (40) CPU (48) CPU (39) CPU (48) I/O (55) Your job list must contain CPU bust and I/O bust as above. Quantum time = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60] The evaluation of the most suitable quantum time needs to consider the followingperformance metrics, but not limited to:(i) Turnaround time of the jobs;(ii) Waiting time of the jobs; and(iii) Number of interrupts incurred The code must able to read csv file format of the job list as input file. The code must able for user to input time quantum.. ..arrow_forwardProb 7. We have learned in the class that using the barrel shifter, we can implement multiplication/division of a number for some special cases with addition, subtraction, and reversed subtraction instructions as well as shift instructions. For each of the following calculations, write a single-line assembly code to perform it using this approach assuming signed integers A and B are saved in r0 and ri respectively: (a) A = 7 * B / 8 (b) A 7 B/8 5arrow_forwardWrite the following C code in MIPS assembly, assume that all of result, in1 and in2 arrays are of double type, also assume var is a double type constant. for( i=0, i<100, i++) result[i] = in1[i]*in2[i] + var; %3D Also explain it well . Thank you!!arrow_forward
- The read() system call needs to be run in a loop to deal safely with edge cases that can appear on some system configurations. Some libraries provide a function for this (for example the C library [fread), but it is not too hard to code yourself. Consider the following snippet of code, with two parts replaced by XXX and YYY ssize_t do_read(int fd, void buffer, size_t len) { ssize_t res; do { res read(fd, buf, len); while (res XXX @ && errno YYY); return res; } Enter the values for XXX and YYY to make this code run correctly, respecting the following rules. The correct value for XXX is a single operator. Enter it without any spaces. The correct value for YYY is a clause to do a comparison with the errno value. Enter the value with no leading or trailing spaces, and exactly one space in any places inside the string where spaces are required. Enter the values here: ● XXX: • YYY:arrow_forwardDownvote incorrectly done. _A pure full Implement c/c++ to evaluate round robin algorithm. You must use the job list given here: Job (1) arrive at CPU cycle1 Job (2) arrive at CPU cycle2 Job (3) arrive at CPU cycle36 I/O (32) CPU (54) I/O (45) CPU (20) I/O (40) CPU (48) CPU (39) CPU (48) I/O (55) Your job list must contain CPU bust and I/O bust as above. Quantum time = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60] The evaluation of the most suitable quantum time needs to consider the followingperformance metrics, but not limited to:(i) Turnaround time of the jobs;(ii) Waiting time of the jobs; and(iii) Number of interrupts incurred The code must able to read csv file format of the job list as input file. The code must able for user to input time quantum.. .arrow_forwardPlease refer to this textbook: “A. Silberschatz, P. B. Galvin and G. Gagne, “Operating System Principles,”7th Edition, John Wiley & Sons Inc., 2006.” And answer the following questions: Question:The Ricart& Argwala mutual exclusion algorithm: (a) Does not depend on time stamps in messages while Lamport's does. (b) Cannot handle the case where two or more processes request the same resource at the same time. (c) Does not require a process to send messages to the entire group while Lamport's does. (d) Requires fewer messages than Lamport's algorithm.arrow_forward
- Question 4 Convert the following C code into ARM assembly code. // pointer to v in X1, n in X2, return prod in X0 double arraytimes(double *v, int n) { int i; double prod for(i=0; iarrow_forwardfor (i=0; i<1000; i++){ y[i] = w * x[i] + b[i]; } Above C-code has a for loop which will repeat 1000 times of the operation. This code will be running on very simple machine. Change the code to reduce the number of branch instructions. You can have up to 5 lines (statements) within the for loop. What is the number of branch operations before and after?arrow_forwardplease give an amswer that's not copy and pasted please, I see the same answer and it is not the solution. Q1. Extension of Assembler and Simulator for the MULT instructionThe original MARIE used only 15 instructions. Now we would like to add a new multiplication instruction.Opcode number: 15 (0x1111)Instruction: MULT XRTNMAR <- XMBR <- M[MAR]AC <- AC * MBRHere X is a memory parameter based on direct addressing.Extend Assembler.java to support MULT instructions.Extend MarieSim.java to support MULT instructions.Test code:Load XMULT YOutputHALTX, Dec 2Y, Dec 3(You should see 6 in decimal)• Submit Assembler.java• Screenshot of the final execution states of assembly for test code• Submit MarieSim.java• Screenshot of the final execution states of simulator for test codearrow_forwardWhat does each techniques below help reduce: data hazard stalls, control stalls, or/and CPI? - dynamic scheduling - branch prediction - multiple issue - speculation - loop unrolling - compiler pipeline schedulingarrow_forward3. Job Scheduling: Consider the problem of scheduling n jobs of known durations t1, t2, ..., tn, for execution by a single processor. The jobs can be executed in any order, one job at a time. You want to find a schedule that minimizes the total time spent by all the jobs in the system. (The time spent by one job in the system is the sum of the time spent by this job in waiting plus the time spent on its execution.) Design a greedy algorithm for this problem. Does the greedy algorithm always yield an optimal solution?arrow_forwardPROBLEM 1 For sorting a set of items, we can employ one of these famous algorithms, merge- sort, heapsort, quicksort, and shell-sort. We can program in both Java and Python, and we have the choice of using three different computers with different instruction set architectures: x86, ARM, and MIPS. Regarding microarchitecture, for x86 we have two choices, and for ARM and MIPS we have three choices for each of them. How many choices we have to run a sort algorithm? (Draw diagram).arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education