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
Textbook Question
Chapter 9, Problem 9.15HW
Determine the block sizes and header values that would result from the following sequence of malloc requests. Assumptions: (1) The allocator maintains double-word alignment and uses an implicit free list with the block format from Figure 9.35. (2) Block sizes are rounded up to the nearest multiple of 8 bytes.
Request | Block size (decimal bytes) | Block header (hex) |
malloc(3) | ______ | ______ |
malloc(11) | ______ | ______ |
malloc(20) | ______ | ______ |
malloc(21) | ______ | ______ |
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Given the following memory snapshot where START and AV_SP store the start
pointers of the linked list and the available space, respectively:
i) identify the linked list;
ii) show how the linked list and the available space list are affected when the
following operations are carried out:
a) insert 116 at the end of the list,
b) delete 243,
c) obtain the memory snapshot after the execution of operations listed in (a)
and (b).
1
2
3
4
5
6
7
8
9
10
DATA LINK
114
176
243
94
346
879
344
465
191
564
0
6
9
5
7
8
1
3
10
0
START:
2
AV_SP: 4
0.7000 7.
Matrix Addressing
To refer to the element in row and column of matrix x, y(row,coumn)
>> x=[16 13 19 19, 182 19/10; 3 6 3 16; 18 11 19 3]
>> x(3,3) ans €3
>> x(3,:) ans =36316
To create a submatrix using the colon operator:
>> y=x(2:end, Dend-1)
y= 18 2 19
363
18 11 19
>> z= y(1:22:3)
Z-2 19
63
رو میاد که یه وه
(13)
Memory Allocation (20 minutes)
Assume you have a buddy allocator that initially has a single 512 byte free block. You cannot allocate more memory.
The first allocation is for 200 bytes. Describe how the allocation occurs with the buddy algorithm. State what's in the free list after the allocation.
How many bytes are lost to internal fragmentation after this first allocation?
Next, we deallocate the 200 byte allocation. Describe what happens. State what the free list looks like now.
Now, we get 4 different 100 byte allocations. You don't have to describe the process. However, state the free list at the end of all 4 allocations.
How many bytes are lost due to internal fragmentation after the 4 allocations?
Describe an approach you could take to fit another 100 byte allocation within your original 512 bytes. You can assume you can use your approach to allocate all 5 100 byte allocations
from scratch.
Chapter 9 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Ch. 9.2 - Prob. 9.1PPCh. 9.3 - Prob. 9.2PPCh. 9.6 - Prob. 9.3PPCh. 9.6 - Prob. 9.4PPCh. 9.8 - Practice Problem 9.5 (solution page 882) Write a C...Ch. 9.9 - Prob. 9.6PPCh. 9.9 - Prob. 9.7PPCh. 9.9 - Prob. 9.8PPCh. 9.9 - Prob. 9.9PPCh. 9.9 - Prob. 9.10PP
Ch. 9 - Prob. 9.11HWCh. 9 - Repeat Problem 9.11 for the following address....Ch. 9 - Repeat Problem 9.11 for the following address....Ch. 9 - Given an input file hello.txt that consists of the...Ch. 9 - Determine the block sizes and header values that...Ch. 9 - Prob. 9.16HWCh. 9 - Prob. 9.17HWCh. 9 - Prob. 9.18HWCh. 9 - Prob. 9.19HWCh. 9 - Write your own version of malloc and free, and...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Create an object of class Student. You will notice that this time you are prompted not only for a name of the i...
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Explain the difference between redundancy and diversity.
Software Engineering (10th Edition)
It is considered good programming practice to store the declaration for a class, its function definitions, and ...
Starting Out with C++: Early Objects
Bug Collector The Bug Collector Problem A bug collector collects bugs every day for five days. Write a program ...
Starting Out with Python (3rd Edition)
When two operators share an operand, the operator with the highest _____ executes first.
Starting Out With Visual Basic (7th Edition)
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- How is an array stored in main memory? How is a linked list stored in main memory? What are their comparative advantages and disadvantages? Give examples of data that would be best stored as an array and as a linked list.arrow_forwardUsing C Language In this function, b has the address of a memory buffer that is num_bytes long. The function should repeatedly copy the 16 byte pattern that pattern16 points at into the memory buffer until num_bytes have been written. If num_bytes is not a multple of 16, the final write of the 16 byte pattern should be truncated to finish filling the buffer. void memset16(void *b, int num_bytes, void *pattern16) For example if the 16 bytes that pattern16 points at is 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff, then memset(b, 20, pattern16) should write to the buffer pointed at by p the 20 bytes 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 00 11 22 33. Use SSE instructions to improve efficiency. Here's pseudocode. x = SSE unaligned load from pattern16while (num_bytes >= 16) SSE unaligned store x to p advance p by 16 bytes decrement num_bytes by 16while (num_bytes > 0) store 1 byte from pattern16 to p advance p by 1 byte advance pattern16 by 1 byte…arrow_forwardtry to ans in 30 minarrow_forward
- Appendix A. BTB entries with PC and Target PC. Please include only entries with content.Entry PC Target0 423000 425E407 42E01C 42E0288 423020 4230A811 42E02C 42B30C14 423038 425E40: : :: : :1018 422FE8 4230A8arrow_forwardPart Two: Implementing a rainbow table You are to write a program, in C/C++, Java or Python, that should run using the following instruction: $ ./Rainbow Passwords.txt where the file Passwords.txt contains a list of possible passwords. The password file contains a password per line, as in the provided words file and consists of strings of printable characters. Any password used must be taken from this file, so the only stored hash information needs to relate to those entries in the file. The program is used to find pre-images for given hash values. Rainbow tables can be used to solve pre-image problems for hash functions. At the simplest level they can simply be a list of hash values and the corresponding pre-images, often from some dictionary. This can be expensive in terms of storage space however, and a more efficient way of identifying pre-images involves the use of the hash function and reduction functions. First step The process is as follows: 1. Read in the list of possible…arrow_forwardCourse Title : Operating SystemQuestion : Paging is a memory management scheme that eliminates the need for contiguous allocation of physical memory. This scheme permits the physical address space of a process to be non – contiguous. Given below is one of the page replacement algorithm program, you are to first identify which algorithm (FIFO, Optimal Page Replacement, Least frequently used) is implemented in given c-code. Please consider following reference string for this page replacement algorithm(1,2,3 5,1,3,4,5,6,1,5,3,2) with 4 page/frame size. There are some errors in this program, you have to correct it first, and then explain compiled output with each miss or hit condition. Note: Show complete procedure with detail steps/screenshots with your arid number(18-arid-2929) #include <stdio.h> void main() { intpos,c,m,maxi,i,k,nf,count,j=0,pf=0,np=0; printf("enter no. of pages"); scanf("%d",&np); int s[np]; printf("Enter pages sequence…arrow_forward
- 3a. Floating point struct Define a struct Single that describes the bit layout for a single precision floating point number. You should be able to compile this definition (using just the gcc -c step), but there is no code to run yet. You will need to use bit fields in the struct. Notice that you need to consider little endian vs. big endian. Your submission should answer the following questions about this program: • Why does endian matter here and not for part 2? 3b. Printing floating point parts Define a method void printSingle(float f) that will print the parts of the floating point number as distinct values. A typical output should look like: For value 3.5, sign=0 exp =128, fraction=11000000000000000000000 To place the float into the struct, use a pointer cast or a union. For example, using a pointer cast to interpret the bits of a floating point number as an integer, you could say int i; *(float *)&i = f; To print a floating point number in printf, you typically use %f. Your…arrow_forward4. Write a program to implement the address book using dynamic singly linked list, the node should contain name, address and phone#: (1) Write a function create to store three people's information into the singly linked list; (2) Write a function print to print these information to the standard output; (3) Write a function search to find the telephone number of a contact input by name. CA "C:\Documents and Settings\Administrator á Lab\2\Debug\final.2.exe" ******************* Input ******************* Input name: Zhang San Input address: XUPT Input phone: 123456 Input name: Li Si Input address: XJTU Input phone: 789012 Input name: Wang Wu Input address: Clemson Input phone: 345678 ******************* andano ******************** Name: Zhang San Address: XUPT Phone: 123456 Name : Li Si Address: XJTU Phone: 789012 Name: Wang Wu Address: Clemson Phone: 345678 Please input the name to search: Li Si Contact Li Si: phone number is 789012 Press any key to continue.arrow_forwardQ1arrow_forward
- Use C++ Programming Language. Objective Define a circular buffer data structure and test it. Problem Description: A circular buffer (also called a circular queue) is circular list of nodes where data items are added on one end of the buffer and removed from the other end. Because the nodes form a circular list, the list has no end or beginning: the tail node points to the head node, creating a ring of nodes. You may think of the nodes as containers or slots that are all initially empty but can be assigned a value in their data field info. Every time a new data item is inserted (inserting to a buffer is often referred as Writing), one slot is filled and the buffer has one less empty slot. Every time a data item is removed (referred to as Reading), the buffer has one more empty slot. Since the list has no beginning and no end, a pointer (writeIndex) is used to mark the next empty slot to write to and a second pointer (readIndex) is used to mark the next node to read from. The…arrow_forwardObjective Define a circular buffer data structure and test it. Problem Description: A circular buffer (also called a circular queue) is circular list of nodes where data items are added on one end of the buffer and removed from the other end. Because the nodes form a circular list, the list has no end or beginning: the tail node points to the head node, creating a ring of nodes. You may think of the nodes as containers or slots that are all initially empty but can be assigned a value in their data field info. Every time a new data item is inserted (inserting to a buffer is often referred as Writing), one slot is filled and the buffer has one less empty slot. Every time a data item is removed (referred to as Reading), the buffer has one more empty slot. Since the list has no beginning and no end, a pointer (writeIndex) is used to mark the next empty slot to write to and a second pointer (readIndex) is used to mark the next node to read from. The readIndex/writeIndex must be…arrow_forwardHW/ Assume that DS=4500, SS=2000n, BX =2100n, SI=1486, DI 8500, BP=7814, and AH=25. 1-Show the PA location where AH content is stored in each of the following. A) MOV AH, [BX] +20 B) MOV AH, [SI] +10 C) MOV AH, [DI][(BX]+4 D) MOV AH, [BP] +12arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage LearningC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Instruction Format (With reference to address); Author: ChiragBhalodia;https://www.youtube.com/watch?v=lNdy8HREvgo;License: Standard YouTube License, CC-BY