100% tevredenheidsgarantie Direct beschikbaar na betaling Zowel online als in PDF Je zit nergens aan vast
logo-home
Summary Computer Systems: A Programmer's Perspective Chapter 2 €2,99
In winkelwagen

Samenvatting

Summary Computer Systems: A Programmer's Perspective Chapter 2

 193 keer bekeken  6 keer verkocht

This is a summary of Computer Systems: A Programmer's Perspective Chapter 2 by Randal E. Bryant and David R. O’Hallaron.

Laatste update van het document: 4 jaar geleden

Voorbeeld 2 van de 9  pagina's

  • Nee
  • Hoofdstuk 2
  • 11 september 2020
  • 20 september 2020
  • 9
  • 2020/2021
  • Samenvatting
book image

Titel boek:

Auteur(s):

  • Uitgave:
  • ISBN:
  • Druk:
Alle documenten voor dit vak (1)
avatar-seller
cilevanmarken
Computer Systems: a Programmer’s
Perspective
Randal E. Bryant en David R. O’Hallaron


Chapter 2 – Representing and Manipulating
Information
In the real world, base-10 is used in decimal notation and is based on the ten fingers we have. Base-2
(binary, so 0 or 1) works better for machines that store and process information. In computer
systems there are three important representations of numbers:
 Unsigned encodings
are based on traditional binary notation and represents numbers greater than or equal to 0.
 Two-complement encodings
are the most common way to represent signed integer (numbers that may be either positive or
negative).
 Floating-point encodings
are a base-2 version of scientific notation for representing real numbers.

Computer representations use a limited number of bits to encode a number, which is why some
operations can overflow when results are too large to be represented. This is why some
computations won't return the expected result. With floating-point arithmetic, the product of
positive numbers will always be positive and numbers that are too large will yield the special value
+∞.
Integer representations can encode a comparatively small range of values, but do so precisely, while
floating-point representations can encode a wide range of values, but only approximately

2.1 - Information Storage
So, we've learned that machine-level programs views memory as a very large array of bytes, known
as the virtual memory. Every byte in the memory has a unique identifying number, called the
address. The set of all possible addresses is referred to as the virtual address space. This virtual space
is just a conceptual image: the actual implementation uses a combination of DRAM (see chapter 1),
flash memory, disk storage, special hardware and OS software to provide the program with a
monolithic byte array.

The compiler and run-time system divide this memory space into multiple parts to store the different
program objects, for instance program data, instructions and control information. There are multiple
mechanisms that allocate and manage the software for various parts of the program, all in the virtual
address space. A C compiler associates a data type program objects. However, the actual machine-
level program treats every program object as a block of bytes and the program itself as a sequence of
bites.

2.1.1 - Hexadecimal Notation
Hexadecimal numbers are written in base-16 and consist of the number 1 to 9 and the letters A to F.
A byte in hexadecimal notation can range from 00 16 to FF16. Hexadecimal number can be recognized
by the '0x' notation in front of them.




1

, 2.1.2 - Data Sizes
Every computer has a word size, that indicates the standard size of pointer data. This word size
determines the maximum size of the virtual address. A machine with a w-bit word size has a virtual
addresses that can range from 0 to 2w - 1. The program can access up to 2w bytes. Past years there
has been a shift from 32-bit word sizes to 64 bit word sizes, because the virtual address space is
larger with 64 bit word size (32: 4 GB, 64: 16 exabytes (EB)). Programs that are compiled for 32 bit
machines can also be run on most 64 bit machines by using 'gcc -m32 file.c'. 64 bit programs can only
be run on 64 bit machines.

There are multiple data formats with different lengths and different ways of encoding data, as seen
below.




Integer data can either be signed (able to present negative, zero and positive values) or unsigned
(only positive values and zero). Data type char represents a single byte can store a single character or
an integer. The data types short, int and long have different sizes and store integers. The data types
float and double have different sizes and store floating-point number. Most of the data types encode
signed values. Char is a bit weird in this: char can be both signed as unsigned, so pay attention to
that!

2.1.3 - Addressing and Byte Ordering
Programs that span multiple bytes have an address. The bytes of the program are stored in a specific
order. Mukti-byte objects are stored in a contiguous sequence of bytes, where the address of the
smallest byte is the address of the whole sequence. For example, int x is 4 bytes and has address
0x100. The 4 bytes of the whole int would be stored in locations 0x100, 0x101, 0x102 en 0x103. Every
location can store 1 byte.

There are two ways in which a multi-byte object can be stored:


2

Voordelen van het kopen van samenvattingen bij Stuvia op een rij:

Verzekerd van kwaliteit door reviews

Verzekerd van kwaliteit door reviews

Stuvia-klanten hebben meer dan 700.000 samenvattingen beoordeeld. Zo weet je zeker dat je de beste documenten koopt!

Snel en makkelijk kopen

Snel en makkelijk kopen

Je betaalt supersnel en eenmalig met iDeal, creditcard of Stuvia-tegoed voor de samenvatting. Zonder lidmaatschap.

Focus op de essentie

Focus op de essentie

Samenvattingen worden geschreven voor en door anderen. Daarom zijn de samenvattingen altijd betrouwbaar en actueel. Zo kom je snel tot de kern!

Veelgestelde vragen

Wat krijg ik als ik dit document koop?

Je krijgt een PDF, die direct beschikbaar is na je aankoop. Het gekochte document is altijd, overal en oneindig toegankelijk via je profiel.

Tevredenheidsgarantie: hoe werkt dat?

Onze tevredenheidsgarantie zorgt ervoor dat je altijd een studiedocument vindt dat goed bij je past. Je vult een formulier in en onze klantenservice regelt de rest.

Van wie koop ik deze samenvatting?

Stuvia is een marktplaats, je koop dit document dus niet van ons, maar van verkoper cilevanmarken. Stuvia faciliteert de betaling aan de verkoper.

Zit ik meteen vast aan een abonnement?

Nee, je koopt alleen deze samenvatting voor €2,99. Je zit daarna nergens aan vast.

Is Stuvia te vertrouwen?

4,6 sterren op Google & Trustpilot (+1000 reviews)

Afgelopen 30 dagen zijn er 53340 samenvattingen verkocht

Opgericht in 2010, al 14 jaar dé plek om samenvattingen te kopen

Start met verkopen
€2,99  6x  verkocht
  • (0)
In winkelwagen
Toegevoegd