The computer environment

Environment – Session 1

  • What is a computer?
  • The operating system
  • The terminal
  • Recap of the session

What is a computer?

Machines to help people do calculations

Abacus (2700 and 2300 BC)

Antikythera mechanism (2nd century BC)

Pascaline (1642)

Charles Babbage's analytical engine (1834)

Curta mechanical calculator (1948 - 1954)

What is a computer?

Modern definition

A computer is an electronic device that can be programmed to automatically carry out sequences of arithmetic or logical operations (computation)

The principle of the modern computer was coined by Alan Turing in 1936

Universal Turing machine:

  • Read & write symbols on an infinite tape according to a set of rules defined by its transition function
  • It moves its read/write head left or right and changes its state based on the current symbol and state

A physical Turing machine

A LEGO Turing machine (ENS Lyon)

A Turing machine in Minecraft

What is a computer?

Computer architecture

Turing machines describe an abstract machine

How can we go from this idealized model to a real computer?


Describing computer systems or architectures

  • The von Neumann architecture (or Princeton architecture)
  • The Harvard architecture
  • The modified Harvard architecture

What is a computer?

The von Neumann architecture (1945)

What is a computer?

Running a program on the von Neumann architecture

Sum A + B

  1. Fetch instruction
  2. Program Counter (PC) increment
  3. Decode instruction
  4. Fetch operands (A & B)
  5. Execution phase
  6. Store phase
  7. PC update

What is a computer?

The Harvard architecture

What is a computer?

Running a program on the Harvard architecture

Sum A + B

  1. Fetch instruction
  2. Program Counter (PC) increment
  3. Decode instruction
  4. Fetch operands (A & B)
  5. Execution phase
  6. Store phase
  7. PC update

What is a computer?

Architectures comparison

von Neumann

  • A CPU with both control unit (CU) and arithmetic logic unit (ALU)

  • Memory stores both data and instructions:

    • A program can easily modify its instructions (loops)
    • Bottleneck
    • Security issues

Harvard

  • Separated CU and ALU

  • Separate memory and instruction pathways:

    • Faster and more efficient data processing
    • Higher cost and less programming flexibility

What is a computer?

Can we get the best of both worlds?

Modified Harvard architecture

  • Used in modern computers and microcontrollers

  • Separate mdata and instruction caches

  • Unified memory addressing (but separate pathways or caches)

  • Flexibility

  • Performance optimization

What is a computer?

Hardware components in a “modern” computer

  • A CPU (usually with multiple cores)
  • Random access memory (RAM)
  • Storage devices:

    • Hard disk drives (HDD)
    • Solid state drives (SSD)

What is a computer?

Hardware components in a “modern” computer

Motherboard

  • CPU socket
  • Chipset
  • RAM slots (DIMM slots)
  • Storage connectors
  • Expansion slots

What is a computer?

Hardware components in a “modern” computer

A lot more input/output peripherals

Operating systems

What is an OS?

Sending binary instructions to a computer is possible though not practical

$\rightarrow$ Use a primary software called the operating system (OS) to act as an intermediary between users and the computer hardware

Operating systems

A bit of history

Another trip down memory lane

  • Early computers (1940s – 1950s):

    • Manual operations, batch processing
  • Mainframe era (1960s):

    • Transition from single-user, single-task systems to multi-user, multitasking environments
  • Unix and early minicomputers (1970s):

    • Portability, Hierarchical file-system, security and permissions
  • Personal computers (1980s):

    • Simpler, more intuitive, and capable of running on less powerful hardware
    • Introduction of the Graphical User Interface (GUI) by Apple

Operating systems

A bit of history

Rise of modern operating systems

  • Microsoft Windows:

    • 3.0 to 95 pivotal in establishing Microsoft as the dominant desktop operating system
    • Windows NT/2000/XP and beyond provided stability and usability
  • GNU/Linux – the open-source revolution:

    • 1991: first version of the Linux Kernel
    • By the 2000s, Linux dominate in the server market and more
  • MacOS:

    • Unix based core
    • Strong link to Apple hardware

Operating systems

Components & features

Rise of modern operating systems

  • Hardware resource management is under the responsibility of the kernel

  • Keys functions of the kernel are:

    • Process management
    • Memory management
    • Device management
    • File system management
    • Inter process communication
    • Security and access control

Operating systems

How to interact with operating systems?

Command-line shells

  • Historical way to interact with the OS
  • Command-line shells require users to input textual commands to perform tasks such as file management, process control, etc.
  • Examples: sh, bash, zsh, cmd.exe, Powershell

Graphical shells

  • Allows the access to the functions of an operating system without having to type-in commands
  • Often built on top of what is called a windowing system
  • Examples: Gnome Shell, Windows shell, Aqua

Operating systems

Other OS components and features

The Init program

  • The first program to run after the kernel is loaded

Daemons and services

  • Background tasks that performs specific functions (awaiting connections, monitoring the computer)

Users

  • Human users – Regular or administrator/root
  • Service accounts – used by the OS to run specific tasks (e.g., www-data)

The terminal

Interacting with the OS using a terminal

Historically, the only way to interact with your system

Nowadays, the terminal is usually a pre-installed application, e.g.,

  • Windowscmd.exe (Batch), PowerShell
  • Linux – Gnome Terminal (Bash),
  • MacOS – Terminal.app (Zsh)

The terminal

Writing a command

The standard format of a command

<prompt> <command> <param_1> <param_2> <param_3> ... <param_N>
  • <prompt> – Generated by the program to provide context for the user (it usually ends with one of the characters $, %, #, :, > or _)

  • <command> – Provided by the user. It can be:

    • Internal or built-in commands
    • External commands to run executables
  • <param_1> ... <param_N> – Parameters provided by the user, if needed

The terminal

A small example

  • $ – The prompt

  • ls – The internal command to list files in a directory

  • -l – The parameter to present the results of ls using a long listing format

  • -a – The parameter to display all files, including the ones starting with . that are hidden by default

Recap of the session

Main elements to remember

A computer is an electronic device that can be programmed to automatically carry out sequences of arithmetic or logical operations (computation)


  • Computer consists in multiple hardware components such as the CPU, RAM modules, Storage devices connected through a Motherboard

  • To use a computer the user needs an operating system

  • Terminals are still very much present on modern computers and a quick and simple way to interact with the computer

Recap of the session

What’s next?

Practical activity (~1h15)

Discover your computer

  • What’s inside your computer?
  • Familiarize with the terminal

After the session

  • Review the articles of the session
  • Check your understanding with the quiz
  • Complete the practical activity
  • Check next session’s “Before the class” section