Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

CS354 EXAM 2 REVIEW QUESTIONS AND ANSWERS GRADED A+ 2026

Beoordeling
-
Verkocht
-
Pagina's
29
Cijfer
A+
Geüpload op
17-03-2026
Geschreven in
2025/2026

CS354 EXAM 2 REVIEW QUESTIONS AND ANSWERS GRADED A+ 2026

Instelling
CS 354
Vak
CS 354

Voorbeeld van de inhoud

CS354 EXAM 2 REVIEW QUESTIONS
AND ANSWERS GRADED A+ 2026




Heap definition - ANS a segment of a processes virtual address space used for dynamically
allocated memory


when is dynamically mem allocated? - ANS at runtime


dynamically allocated memory definition - ANS a collection of various sized mem blocks that
are managed by an allocator


block definition - ANS a continuous chunk of memory containing a payload and overhead


payload definition - ANS part of the block usable by the program requesting heap memory


overhead definition - ANS part of the block used by the allocator to manage the heaps
internal structure.


allocator - ANS code that allocs and frees heap blocks (as well as splits and merges them)


How allocator works: Java - ANS garbage collector, 'new' implicitly determines bytes needed




@COPYRIGHT 2026/2027 ALLRIGHTS RESERVED 1

,How allocators work: C - ANS malloc must be told how many bytes needed
free must explicitly be called


name of C's heap allocator - ANS stdlib.h
contains a collection of commonly used C functions


C's heap allocator has functions (4) - ANS malloc, calloc, realloc, and free


malloc function

void *malloc (size_t size) - ANS allocates and returns generic ptr to block of heap memory of
size bytes, or returns null is allocation fails


calloc function

void * calloc(size_t nItems, size_t size) - ANS allocates, clears to 0, returns a block of heap
memory of nItems * size bytes, or returns null upon failure


realloc function

void * realloc(void *ptr, size_t size) - ANS reallocates to size bytes a previously allocd block of
heap memory pointed to by ptr, or returns null if realloc fails


realloc example
realloc to size bytes a previously alloc'd block of heap mem pointed to by ptr, or return null if
failure occurs. - ANS if(ptr == null){
return malloc(size)
}
else if (size == 0){
free(ptr);
return null;
}


@COPYRIGHT 2026/2027 ALLRIGHTS RESERVED 2

, else // attempts to reallloc


see l8-4


posix definition - ANS portable os interface
standard for maintaining compatibility among unix operating systems


what is unistd.h? - ANS has functions to access posix API


brk definition - ANS program break
end point of program in VAS


brk usage

int brk(void *addr) - ANS int brk(void *addr)
sets top of heap to the specified address addr
returns 0 if successful, else returns -1 and sets errno


errno definition - ANS error number
set by OS function call (brk or sbrk)


Allocator design:

goals: throughput - ANS measure operations/second (how many mallocs you can do per
second)
higher throughput is better, more operations per second is better


Allocator design:

goals: memory utilization - ANS taking memory requested and divide it among the heap
that's been allocated


@COPYRIGHT 2026/2027 ALLRIGHTS RESERVED 3

Geschreven voor

Instelling
CS 354
Vak
CS 354

Documentinformatie

Geüpload op
17 maart 2026
Aantal pagina's
29
Geschreven in
2025/2026
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$13.99
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
Brightstars Havard School
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
237
Lid sinds
1 jaar
Aantal volgers
7
Documenten
13557
Laatst verkocht
1 week geleden
VERIFIED EXAMS AND STUDY GUIDES.

Here, you will find Study Notes, Exam answer packs 100% Guarenteed success.

3.2

34 beoordelingen

5
11
4
4
3
8
2
3
1
8

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen