Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Samenvatting hoofdstuk 6: Automatisch Geheugenbeheer

Rating
-
Sold
-
Pages
12
Uploaded on
27-07-2022
Written in
2019/2020

Dit is de samenvatting van het zesde hoofdstuk van het vak Interpretatie van Computerprogramma's I. In deze samenvatting werd zowel alle informatie uit de slides als bijkomende informatie uit eigen notities opgenomen. Aan het einde van de samenvatting werden ook de herhalingsvragen opgelost EINDRESULTAAT: 16/20

Show more Read less
Institution
Module

Content preview

Hoofdstuk 6: automatisch
geheugenbeheer
1 Motivatie
• Registermachines: beperkt aantal registers (= geheugen)
o Normaal: cons, lijsten … → passen niet in registers → bovenop registers ook een
blikje RAM gebruiken
▪ Eindig: efficiënt mee omspringen en dingen die de rest van het programma
niet meer kunnen beïnvloeden, opruimen
▪ Stukjes geheugen die niet meer nodig zijn vrijmaken
➢ Verschillende algoritmes voor: “Stop en copy”

2 Van lijst-gebaseerd naar fysiek geheugen




• Geheugenmodel van Scheme omvormen naar geheugenmodel computer = reeks individueel
adresseerbare cellen
• Pointer = variabele met als waarde het adres van een geheugencel
• The-cars en the-cdrs staan hier onder elkaar maar staan in het echt gewoon naast elkaar
• Getypeerde pointers want we gebruiken een aantal bits van de pointer om een type bij te
houden.

1

, 2.1 Waarden voorstellen als getypeerde pointers




(define BIAS 1000)
(define NMBR-prefix 1)
(define PAIR-prefix 2)
(define NULL-prefix 3)
(define MASK-prefix 4)

(define NMBR (* NMBR-prefix BIAS))
(define PAIR (* PAIR-prefix BIAS))
(define NULL (* NULL-prefix BIAS))
(define MASK (* MASK-prefix BIAS))

(define (PREFIX val)
(quotient (abs val) BIAS))

(define (VALUE val)
(remainder (abs val) BIAS))

(define (MAKE prefix val)
(+ prefix val))

(define (number? val)
(eq? (PREFIX val) NMBR-prefix))

(define (pair? val)
(eq? (PREFIX val) PAIR-prefix))

(define (null? val)
(eq? (PREFIX val) NULL-prefix))

(define (MASK? val)
(eq? (PREFIX val) MASK-prefix))

2.2 Fysieke voorstelling van paren
(define FREE 0)
Eerste vrije entry in de 2 vectoren met cars en cdrs
(define SIZE 9)

(define THE-CARS (make-vector SIZE NULL))
NULL = null-pointer
(define THE-CDRS (make-vector SIZE NULL))



2

Connected book

Written for

Institution
Study
Module

Document information

Summarized whole book?
No
Which chapters are summarized?
Hoofdstuk 5.3
Uploaded on
July 27, 2022
Number of pages
12
Written in
2019/2020
Type
SUMMARY

Subjects

$4.68
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF


Also available in package deal

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
lennyS Vrije Universiteit Brussel
Follow You need to be logged in order to follow users or courses
Sold
166
Member since
6 year
Number of followers
62
Documents
34
Last sold
1 month ago

4.5

6 reviews

5
4
4
1
3
1
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions