![EBK COMPUTER SYSTEMS](https://www.bartleby.com/isbn_cover_images/8220101459107/8220101459107_largeCoverImage.jpg)
Concept explainers
Explanation of Solution
Perform Next-fit search instead of First-fit search:
In the “Section 9.9.12 (mm.c)”, remove the lines that starts from “/* $begin mmfirstfit */” and ends with “return NULL; /* No fit */”.
Add the following highlighted code to the “Section 9.9.12 (mm.c)”. The modified “mm.c” file is as follows:
/* Global variables */
static char *heap_listp = 0; /* Pointer to first block */
// Rover for Next fit
static char *rover;
/* Function prototypes for internal helper routines */
static void *extend_heap(size_t words);
heap_listp += (2 * WSIZE);
/* $end mminit */
// Assign heap_listp to rover
rover = heap_listp;
/* $begin mminit */
/* Extend the empty heap with a free block of CHUNKSIZE bytes */
bp = PREV_BLKP(bp);
}
/* $end mmfree */
// If condition to check the rover is not representing the free block
if ((rover > (char *)bp) && (rover < NEXT_BLKP(bp)))
// Assign bp to rover
rover = bp;
/* $begin mmfree */
return bp;
}
{
/* Next fit search instead of first fit search*/
// Assign rover to the character pointer oldrover
char *oldrover = rover;
/* Finding next fit using for loop */
// For loop to search from rover to the end of the list
for (; GET_SIZE(HDRP(rover)) > 0; rover = NEXT_BLKP(rover))
// If condition to check allocation and size of rover
if (!GET_ALLOC(HDRP(rover)) && (asize <= GET_SIZE(HDRP(rover))))
// Return rover
return rover;
// For loop to search from start of list to old rover
for (rover = heap_listp; rover < oldrover; rover = NEXT_BLKP(rover))
// If condition to check allocation and size of rover
if (!GET_ALLOC(HDRP(rover)) && (asize <= GET_SIZE(HDRP(rover))))
// Return rover
return rover;
// Otherwise return null
return NULL;
}
/* $end mmfirstfit */
Filename: main.c
// Include libraries
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
// Include required header files
#include "csapp...
![Check Mark](/static/check-mark.png)
Want to see the full answer?
Check out a sample textbook solution![Blurred answer](/static/blurred-answer.jpg)
Chapter 9 Solutions
EBK COMPUTER SYSTEMS
- Problem 4 Number of needed subnets 750 Network Address 190.35.0.0 joy worl Subnetting Show your work for Problem Address class B Default subnet mask 255.255.0.0 Custom subnet mask 255.255.255.122 Total number of subnets 1024 Total number of host addresses Number of usable addresses Number of bits borrowed What is the 15th subnet range? What is the subnet number for the 13th subnet? What is the subnet broadcast address for the 10th subnet? What are the assignable addresses for the 6th subnet? 64 65,536 62 32,768 8 10 16,384 512 1,024 2,048 4,096 8,192 16,384 32,768 65,536 256 128 64 32 16 8,192 4,096 2048 1024 512 128 256. 32 16 8 4 2 1 0 0 o O O O O 4 91 8 32 64 +9 821 32 16 8 4 Number of Hosts Number of Subnets Binary values 190. 35 Solve with the right pictures 00 99999arrow_forward5. Task 5: Write a function that takes an array and its size as parameters and returns the sum of its elements(Homework)arrow_forward4.13 Extract a 3×3 array from the upper left-hand corner of the magic square you created in 4.11. Is this also a magic square?arrow_forward
- a If an M/M/1 queue in a server has task arrivals at a rate of 30 per second and serves at a rate of 50 per second, how many tasks are in the system (waiting and being served) on average? b In part (a), how many tasks are being served, on average? c What is the utilization of an M/M/1 queue in a server that has four tasks waiting on average?arrow_forwardEvaluate the average gate capacitance of, and power dissipated by, a processor with the following properties: • Gate oxide thickness = 1.4 nm• Gate length = 65 nm• Gate area = (65 nm)x(65 nm)• Permittivity of free space = 8.85 x 10e−12 Farads/m • Relative permittivity of SiO2 = 3.9 • Rail-to-rail voltage = 1.1 V• Clock frequency = 3.6 GHz• Switching probability = 1.0• Number of transistors per die = 1.3 x 10e9arrow_forwardCan you conver the following C code into ARM Assembly. Assume a is X0 and b is X1if ((a !=0) && (b == 0)) {a++} else {b++}arrow_forward
- Please help. Matlab for engineers 6th edition question.arrow_forwardA certain proram takes 26.67 seconds to run on 3 processors and 16 s to run on 7 processors. Find the execution time on one processor, the fraction of the program that can be parallelized, the theoretical execution time on an infinite number of processors, and P1/2arrow_forwardCan you write the following C code into ARM Assembly. Assume x is X0 and y is X1:switch ( x ) {case 0 : y++; break ;case 1 : y−−; break ;default : break ;}arrow_forward
- Can you write the following C code into ARM Assembly? Assume a is in X0 and b is in X1:while ( a < 10){b=b +10;a++;}arrow_forward# Instructions a. 1.00E+09 b. 1.00E+09 Compiler A Compiler B Execution time #Instructions Execution time 1s 1.20E+09 1.4 s 0.8 s 1.20E+09 0.7 s 1.6.1 [5] For the same program, two different compilers are used. The table above shows the execution time of the two different compiled programs. Find the average CPI for each program given that the processor has a clock cycle time of 1 nS. 1.6.2 15] Assume the average CPIs found in 1.6.1, but that the compiled programs run on two difference processors. If the execution times on the two processors are the same, how much faster is the clock of the processor running compiler A's coce versus the clock of the processor running compiler B's code? 1.6.3 [5] A new compiler is developed that uses only 600 million instruc- tions and has an average CPI of 1.1. What is the speed-up of using this new compiler versus using Compiler A or B on the original processor of 1.6.1? Consider two different implementations, P1 and P2, of the same instruction set.…arrow_forwardExercise 1.4 Consider two different implementations of the same instruction set architecture. There are four classes of instructions, A, B, C, and D. The clock rate and CPI of each implementation are given in the following table. CPI Class B CPI Class C CPI Class D Clock rate CPI Class A P1 1.5 GHz 1 2 3 P2 2 GHz 2 2 2 4 2 1.4.1 [10] Given a program with 10" instructions divided into classes as follows: 10% class A, 20% class B, 50% class C and 20% class D, which implemen- tation is faster? 1.4.2 [5] What is the global CPI for each implementation? 1.4.3 [5] Find the clock cycles required in both cases. The following table shows the number of instructions for a program. Arith 500 Store 50 Load 100 Branch 50 Total 700 1.4.4 [5] Assuming that arith instructions take I cycle, load and store 5 cycles and branch 2 cycles, what is the execution time of the program in a 2 GHz processor? 1.4.5 [5] Find the CPI for the program. 1.4.6 [10] If the number of load instructions can be reduced…arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY
![Text book image](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)