CPSC 110-08: Computing on Mobile Phones
Spring 2012

Blown to Bits, Chapter 1
The Digital Explosion: Why is it happening and what is at stake?

CS Principles

This activity introduces the concept that abstractions built upon binary sequences can be used to represent all digital data . It also introduces the idea the computing has global impacts. It focuses, in part, on the following learning objectives:

Bits as the Natural Unit of Information

Moore's Law

It's All Just Bits

A Little Bit About Bits

A byte is an 8-bit sequence. Historially an 8-bit byte was used to represent a single character in computer memory.

The length of a binary sequence -- a sequence of 0s and 1s -- determines the number of different sequences that can be generated and therefore the number of different things that can be represented by such a sequence.

For example, with 1 bit, you can have two different sequences, 0 or 1, which can stand for two different colors, say, 0 stands for white and 1 for black. With 2 bits, you can have four different sequences, 00, 01, 10, or 11, which can represent four different colors, white, black, red, green. And so on.

In general, an n-bit sequence can represent 2n different things. Here's how:

Number of bitsNumber of thingsRepresentations
12 (i.e., 21)0, 1
24 (i.e., 22)00, 01, 10, 11
38 (i.e., 23)000, 001, 010, 011, 100, 101, 110, 111
416 (i.e., 24)0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111
532 (i.e., 25)  
664 (i.e., 26)  
7128 (i.e., 27)  
8256 (i.e., 28)  

Data Abstraction: How Colors Are Represented in Bits

  • If there are 256 (28) possible values for each of R,G,B, the triplet can represent 256 × 256 × 256 = 16,777,216 different colors, which corresponds well to the number of colors the human eye can distinguish.

      (R, G, B)
      (65,65,65) = Grey
      (255,0,0) = Red
      (0,255,0) = Green
      (0,0,255) = Blue
      (65,0,0) = Brown

  • Try to mix your own colors: Colorschemer.com

    Perfection is Normal

    Example: Parity Bit Error Detection

    Suppose you are sending a stream of data to a server. By adding a parity bit, you enable to the server to detect some basic transmission errors. For example, if the server expects that every byte will contain an even number of 1s and it detects a byte such as 0001 0101 with an odd number of 1s, it can tell that an error occured. Perhaps the user meant to send 0000 0101 but one of the bits was flipped from 0 to 1 during transmission.

    A parity bit is a bit that is added as the leftmost bit of a bit string to ensure that the number of bits that are 1 in the bit string are even or odd.

    To see how this works, suppose our data are stored in strings containing 7 bits.

    In an even parity scheme the eighth bit, the parity bit, is set to 1 if the number of 1s in the 7 data bits is odd, thereby making the number of 1s in the 8-bit byte an even number. It is set to 0 if the number of 1s in the data is even.

    In an odd parity scheme the eighth bit, the parity bit, is set to 1 if the number of 1s in the 7 data bits is even, thereby making the number of 1s in the 8-bit byte an odd number. It is set to 0 if the number of 1s in the data is odd.

    The following table summarize this approach.

    Data Bits (7)Add a parity bit to get 8 bits
    Even Parity
    Total number 1s is even
    Odd Parity
    Total number of 1s is odd
    000 0000 (0 1s)0000 00001000 0000
    011 0010 (3 1s)1011 00100011 0010
    011 0011 (4 1s)0011 00111011 0011
    011 0111 (5 1s)1011 01110011 0111


    Question: What would happen in this scheme if 2 bits were switched from 1 to 0 or 0 to 1?

    Want in the Midst of Plenty

    Nothing Goes Away

    Bits Move Faster Than Thought

    Discussion: Technology is Neither Good nor Bad?

    Self-study

    The material in this chapter and this lecture will be on Friday's quiz. See Friday's schedule for some self-study exercises on this material.