%run -i python/common.py
%run -i python/ln_preamble.py

CS210 Computer Systems#

Intro and the Big Picture#

Highlight – “Programmable” and “Device”

COMPUTER SYSTEM

A rich and beautifully tapestry of Interacting
Hardware + Software components that are the substrate to our modern digital world

This Class

Understand the “Anatomy” of Software and how it interacts with the hardware.

  • Expose you to a deeper view of the digital world and around you

  • Give you the skills and knowledge to understand and manipulate (program) more of the computing

  • Generally make you better programmers and more informed decision makers

GENERAL ANATOMY OF COMPUTING

Computing is composed of many parts — roughly organized into layers

  • HARDWARE: Foundation on which everything is built

  • SOFTWARE: Complex layers of interacting software components


GENERAL ANATOMY OF COMPUTING

Computing is composed of many parts — roughly organized into layers

  • HARDWARE: Foundation on which everything is built

  • SOFTWARE: Complex layers of interacting software components

Despite all the kinds of computers in our lives …



Client Computers

Server Computers

A Programmers View


The two pillars of computer science


Theory and Systems

Lets turn back the clock

Before there was computer science and there was only imagination of what could be

  1. Turing and the Turing machine

  2. Von Neumman and the Von Neumman Architecture

  3. Rear Admiral Grace Hopper and the compiler

May you live in interesting times…




Knowledge is power…




It's up to YOU … as to what comes next





WHO ARE WE?



Welcome to CS210#

  • Course Goals and Objectives

  • “Under the Covers : The Secret life of Software”

  • Rest of course infrastructure

  • Staff

  • Syllabus

    • calendar

    • grade break down

      • assignments

      • midterms

      • exam

      • attendance and participation

  • Lectures, Discussions and Office hours

  • General Advice

Course Goals#

  1. Understand the layers of computer systems

  2. Understand software / hardware interaction

  3. Learn foundational concepts, skills and tools for working with computers

#FileCodeBox("src/hello_bb.c", "C", "<b>CODE: C - Hello World")
display(Markdown(FileCodeBox(
    file="src/hello_bb.c", 
    lang="C", 
    title='<b>CODE: C - Hello World')))

CODE: C - Hello World

#include <stdio.h>
  
int main()        
{                          
  printf("hello world\n"); 
  return 0;                
}
showET()

Edit

showBT()

Build

showDT()

Debug

showET()

Edit

#MkCodeBox("src/popcnt_bb.S", "gas", "<b>CODE: asm - Our First assembly program - Playing with popcnt", "200%", "640px")
#FileCodeBox("src/hello_bb.c", "C", "<b>CODE: C - Hello World")
display(Markdown(FileCodeBox(
    file="src/popcnt_bb.S", 
    lang="gas", 
    title="<b>CODE: asm - Our First assembly program - Playing with popcnt",
    h="600px", 
    w="640px"
)))

CODE: asm - Our First assembly program - Playing with popcnt

	.intel_syntax noprefix
	
	.text
        
	.global _start 	
_start:
	popcnt rax, rbx   // same as  .byte 0xF3, 0x48, 0x0F, 0xB8, 0xD8  
showBT()

Build

display(Markdown(FileCodeBox(
    file="assembly/popcnt_build.sh", 
    lang="shell", 
    title="<b>NOTES: on building popcnt", 
    h="15em", 
    w="100%")))

NOTES: on building popcnt

#To assemble and link the code we will use the following command:
as -g popcnt.s -o popcnt.o
ld -g popcnt.o -o popcnt

# We can automate this using a makefile so that all we would need to do is:
make popcnt
showDT()

Debug

display(Markdown(FileCodeBox(
    file="assembly/popcnt_gdb.txt", 
    lang="shell", 
    title="<b>NOTES: using gdb with popcnt", 
    h="100%", 
    w="640px")))

NOTES: using gdb with popcnt

# To get the debugger going:
  gdb -tui popcnt
# Now we want use gdb command to poke around popcnt
# To setup the assembly syntax to intel: 
  set disassembly-flavor intel
# Configure a layout that is more friendly to assembly code:
  tui new-layout mylayout regs 3 {src 1 asm 1} 2 cmd 1 status 0
# Switch to the new layout:   
  layout mylayout
# force small command window to be sure lots of room for regs
  winh cmd 4
# make command window in focus so that arrows work as history  
  focus cmd
  
# Set a breakpoint at the start symbol so exection will stop their: 
  break _start
# Start the program running:
  run
# play around with popcnt

set $rbx = 0b11
set $rbx = 0xFFFE