Unformatted text preview:

M1 a Remember that overflow is defined as the result of the operation making no sense which in 2 s complement representa tion is equivalent to the mathematical result not fitting in the format 10 11 10 01 if any of the operands is zero there is no overflow if one of the operands is positive and the other is negative there can be no overflow if the two operands have the same sign we have the following cases 2 10 2 00 0 4 1 10 2 01 1 3 2 11 1 01 1 3 1 01 1 10 2 2 So there are 4 cases from the total 16 1 1 1 1 case case case case M1b The easiest solution is to represent all possible values An 8 bit exponent covers 0 255 which with 127 bias means 127 128 Nibble for a float SEEM Exponent bias 1 thus 00 01 10 11 0 1 2 3 Expo n e n t Sign i f i c a n d Ob j e c t 0 0 0 0 non z e r o Deno rm 1 25 4 any t h i n g f l p t 255 0 255 non z e r o NaN 1 00 0 0 1 00 1 denorm 0 1 x 2 0 0 1 1 2 1 01 0 1 0 x 2 0 1 1 01 1 1 1 x 2 0 1 5 1 10 0 1 0 x 2 1 10 2 1 10 1 1 1 x 2 1 10 3 1 11 0 reserved for 1 11 1 reserved for NaN similarly for positive numbers Ans MostNeg 3 0b1 101 0xD SmallestPos 1 2 0b0 001 0x1 NextSmallestPos 1 0b0 010 0x2 1 0 1 2 M2 a Static 0 no globals Stack 4 1 pointer Heap 48 2 8 2 ints 4 4 chars 8 2 ptrs 4 1 ptr 2 24 48 M2b Adv a n t a g e Sa v e s a ma l l o c c a l l co u l d t a k e a l o n g t i m e t o sea r c h f r e e l i s t A l e x l e s s i n t e r n a l f r a g m e n t a t i o n f r e e i n g on l y r e q u i r e s o n e c a l l l e s s p r o g r a mm e r e f f o r t D i s a d v a n t a g e M i g h t n o t s u c c e e d whe r e t h e o t h e r wou l d ha v e i f memo r y f r a g m e n t e d no t on e l a r g e c h u n k bu t t w o sma l l e r c h u n k s we h a v e t o wa i t u n t i l bo t h a r e un u s e d be f o r e we c a n f r e e M2 c T F We d i s c u s s e d 3 s c h em e s K R s l a b a l l o c a t o r an d t h e bu d d y s y s t e m I t s p o s s i b l e t o w r i t e c o d e t o mak e an y o f t h e s e t h e be s t an d an y o f t h e s e t h e wo r s t pe r f o r m e r i e on e w i l l ne v e r a l w a y s dom i n a t e an o t h e r pe r f o r m a n c e w i s e One o f T F Th a t s T t h e t r u i s m s ab o u t t h e s e i s no s i n g l e be s t on e Ma r k an d sw e e p ga r b a g e wo r k f o r c i r c u l a r da t a r e f e r e n c e coun t i n g my f r i e n d F Cop y i n g s c h em e s i s tha t the r e c o l l e c t i o n do e s no t st ru c t u r e s t o wh i c h y o u r e re f e r r i n g I f y o u w r o t e c o d e t h a t ha d no c a l l s t o free an d we on l y ga r b a g e c o l l e c t whe n we ha v e t o r e f e r e n c e cou n t i n g w i l l s t a r t co l l e c t i n g be f o r e c o p y i n g wou l d s t a r t c o l l e c t i n g be f o r e RC be c a u s e i t HAS t o GC whe n t h e memo r y i s ha l f f u l l RC c a n wa i t un t i l it s vi r t ua l l y al l fu l l M3 a NO Po i n t e r t y p e s t o f l o a t an d t o po i n t e r t o d l i s t ha v e t h e s am e s i z e Onc e t h i s h a s be e n s a i d t h e au t h o r o f l i n e a s h o u l d b e t u r n e d i n t o s h a r k b a i t b NO Po i n t e …


View Full Document

Berkeley COMPSCI 61C - Final Exam Answers

Documents in this Course
SIMD II

SIMD II

8 pages

Midterm

Midterm

7 pages

Lecture 7

Lecture 7

31 pages

Caches

Caches

7 pages

Lecture 9

Lecture 9

24 pages

Lecture 1

Lecture 1

28 pages

Lecture 2

Lecture 2

25 pages

VM II

VM II

4 pages

Midterm

Midterm

10 pages

Load more
Loading Unlocking...
Login

Join to view Final Exam Answers and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Final Exam Answers and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?