ITIC:Computers and hardware

From Juneday education
Revision as of 12:07, 6 September 2019 by Henrik Sandklef (Talk | contribs) (CPU)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Reading instructions

Before this module, you should read Part I - Hardware (pages 7-21) in Kernigan, D is for Digital and the Chapter Dator from the Swedish compendium (pages 5-9).

Computers

A computer, be it your laptop or your mobile phone, is physical in the sense that you can hold it in your hand or at least touch one with your hand. Computers come in many different sizes - from small credit card sized computers like Raspberry PI to Supercomputers that typically fits in a big hall. Contrast a computer to the apps or programs you've installed on your computer or mobile phone - it's hard to grab a hold of them. All the computer's physical components, such as the screen, make up the computer's hardware. We will look a bit closer at some of these hardware components.

Software, such as apps or programs, will be dealt with in chapter ITIC:Software and programming introduction.

Let's look at two common types of computers, a laptop and a mobile phone.

Laptop

A normal laptop (the one on the picture is kind of old) typically looks like this.

Laptop.jpg

If we open it up a bit we can find a keyboard and a mousepad. On the mousepad module you can actually see the cable that is used to connect it to the other modules:

Laptop-kbd.jpg Laptop-pointer.jpg

Underneath the mousepad and keyboard we find the RAM and some cables used to attach the keyboard and pointer as well some electrical components. If we flip this module we can see the hard disk, DVD reader (not found in laptops anymore).

Laptop-inner-I.jpg Laptop-inner-II.jpg

Mobile phone

The first picture shows a mobile phone. Let's open it up. On the second picture we can see the screen with a built in mouse/pointer plastic film, a battery, a button and a board with CPU, RAM etc which is zoomed in on the third picture.

Mobile.jpg Mobile-parts.jpg Mobile-inner-I.jpg

Hardware

CPU

Imagine someone asking you to add 200 and 317. Assuming you don't actually know the result without counting then some part of your brain performs the calculation and comes up with the answer 517 . The part of a computer that performs the corresponding calculation is called the CPU (central processing unit). You can think of the CPU as the computer's brain. The instructions of the CPU are limited but this is compensated by the speed of the CPU. This page's author has a CPU which can go up to 4GHz. This means that the CPU can perform 4 000 million instructions per second (or 4 000 000 000 if you prefer). In Kernighan's book we can read that a heart beats around 100 000 per day.

CPUs come in many different architectures and versions but let's not dive to deep into this. A CPU is responsible for performing instructions such as adding, subtracting, logical operations (AND, OR..), Input/Output (screen, keyboard, ..). The instructions to perform these tasks differ a lot between the different architectures of CPUs.

Memory / RAM

Image someone asking you for your name. Directly from memory you'd say your name out loud. Perhaps, every now and then, it may take a while bit it's still quick we hope. The computer has a similar fast memory, called RAM (Random Access Memory). The instructions, along with associated data, a computer shall execute are stored in RAM when executed - think of it as you storing the instructions of a recipe for bread in your memory while baking. When the power goes off the computer loses all the data/information in RAM, so the RAM is volatile. By loading different set of instructions to the RAM we can tell the CPU to do different computations. Later on, in the chapter ITIC:Software and programming introduction, we will learn that such set of instructions, along with the associated data, is called a program.

On a laptop or a desktop today there is usually 8 GB of RAM. 8 GB is 8 000 million or 8 000 000 000 bytes if you prefer it written that way.

On the computer's CPU there are hardware components we could call memory as well, but we will skip this and focus on the stuff that gets us going in this course.

The laptop we showed earlier has a RAM module. Here's a closer look at it:

Laptop-ram.jpg

Disk

Let's go back to the recipe for the bread above. You've probably experienced not remembering things and having to look them up. This happens because you, in some way, prioritized to instead remember some other things, most likely due to a limit in the amount of things you can store in your brain. Same with your computer's memory, RAM (Random Access Memory) which also has a limit. The RAM is quick but you can not store every piece of information there. Humans have traditionally solved this by using pen and paper, ledgers, note books or similar tools and looked things up using these tools. The same goes with a computer but the pen and paper is replaced by a hard disk. A hard disk is a device used for storing data just as RAM with the difference in how much data that can be stored given a certain amount of money. There are tons of different kinds of hard disks out there but for us in this course we will use the general term hard disk and be happy knowing that a hard disk can store data.

If you write a document, shoot a movie or take a picture with a digital camera you can store these on the hard disk. It is obvious that information stored on a paper somewhere will take longer time for you to look up than if you'd store it in your memory. Same goes with hard disks - it takes more time to retrieve information on a hard disk than from RAM. A good thing with the hard disk is that can store a lot more information than RAM and still be cheap. Another good thing is that the data/information stored on the hard disk is stored even if the power goes off.

When installing an operating system (more on this later on), such as Ubuntu or Fedora, you will need 37 GB of disk. This will not fit in most computers' RAM so you will need a disk for that reason alone. Furthermore you'll probably do not want to reinstall the operating system each time you turn your computer on and off so a disk is also useful since it keeps the memory (e g is not volatile). If we compare a disk compared to RAM this is a list of the most obvious differences:

  • disk is cheaper than RAM
  • disk is slower than RAM
  • disk stores memory permanently (as opposed to RAM)

A disk in a normal laptop or computer is typically somewhere between 500GB and 1000 GB (1TB). Compare this to the usual size of RAM on a laptop or desktop which is 8 GB.

The storage size and speed goes and the physical size of disk is getting smaller. We can show this by presenting some disks we've found in our drawers. The upper left disk 15GB hard disk. Below it you can find a physically smaller disk that can store more than ten times more data, 160GB. The bottom right thing is a floppy disk that can store up to 1.44MB of data. Compare this floppy disk to the SD (Secure Disk) card above that can store 16GB (you can find SD card that can store up to 512GB!).

Storage-media.jpg

Let's look at some more storage modules typically used outside the computer (external) attached via some reading device. The leftmost floppy disk can store roughly 0.7MB, followed by the floppy we've already seen that can store 1.44MB and then the SD card again that can store 16GB.

Disks.jpg

How much data now and then

A mobile phone today typically comes with 128GB or 256GB of storage that you can use. If we were to store that much data, let's say 128GB, on 1.44MB floppy disks, how high would the pile of floppy disks be? Let's calculate. 128GB is 128000MB. Dividing 128000MB with 1.44MB gives us 88889 floppy disks. Each floppy disk is roughly 3mm high, so all 88889 disks would be 266667 mm, or 266 meters, high. Compare this to the tower Turning Torso in Malmö (Sweden) which is 190 meter high. The floppy disk pile would be as 1.5 times as high as the tower.


Network

When you fetch information, be it a movie, picture or something else, over the internet you're getting data from someone else's computer. Your computer is (most likely) connected to the other computer over internet using network cards, typically wireless, ethernet or bluetooth. This is hardware designed to transfer information over a network of computers. We have a separate chapter on network in this course material, see ITIC:Networks_and_protocols and ITIC:Network_tools_and_commands. If you would like to read even more you can look into web.

Misc

Screen/Keyboard/Mouse

If we look at a typical laptop of today we can quickly identify a couple of hardware components:

  • screen
  • keyboard (well, some computers come with only a "virtual" keyboard)
  • touchpad/mouse

These are used for communication between the computer and the user. Typically you type a command or click a button which is your way of sending commands to the computer. The computer and programs executing on your computer, on the other hand, give feedback to you using the screen, loudspeaker/phone jacket or some other hardware.

Here's a picture of the inside of a keyboard.

Keyboard-inner.jpg

Operating System

Most of you are used to an existing piece of software. Perhaps without being aware of its existence. WE're talking about the operating systems. Examples of such are Android, Windows, iOS, MacOS and Linux. These are software providing abstractions, management of hardware and provide services for other software. Let's give some examples:

  • abstraction - the operating system provides an abstract view of the information stored on disk. Read more below
  • hardware management - the operating system controls all your hardware components, such as RAM, disk, mouse and keyboard
  • services - many programs on your computer uses internet. These program can access internet via the same piece of code provided by the operating system

We will look into a few of concepts that are important to understand the computer and provide a foundation for understanding the rest of the material in this course material.

File and File System

Imagine if a library stored all the books in no order on the floor. We bet you'd rather have the books sorted in alphabetical order and in different bookshelves depending on the type of book (e g history, geography and computer science). Same thing with information stored in a computer - it's easier if we structure the information in some way. To achieve such a structure in a computer we use some abstractions of the disk. Let us introduce file and directory.

  • file - A file is a named memory space in the disk. Instead of remembering where on the disk the information is kept you can give a piece of information a name. As an example we can store our CV in a file called cv. You can think of this as a book - a book has a name and content. Well a book also has an author, revision, year etc - but we hope you get the point.
  • directory - A directory is a name place where you can put file or other directories. As an example you can have directory called photo where you store all your photos. In case you would like to go for even more structure can can possibly add directories in the photo directory, e g travel and family.

With files and directories we can structure all the information on our computer. Files and directories are abstractions, the disk does not have any concept of file and directory. These abstractions, called file systems, are provided by the operating system. There are different way to create such file systems, e g ext, HPFS, VFAT, FAT32 and many many more.

There are more similar things (e g soft links and hard links) but for now files and directories as provided by a filesystem will do fine.

Multitasking - Sharing the CPU

Imagine starting a browser (e g Firefox) to surf the web, but also having to close and exit the word processor (e g LibreOffice or Word) before. And then if you would like to start the word processor again you will need to close the browser. Not that fun. Instead of only being able to run program at a time the operating system provides means to share the CPU between various program. In short, the operating system cuts up the CPU time in small pieces and hands out these time frames to the running programs. As an example the CPU runs Firefox for a fraction of a second, Libre Office the next fraction, your mail program the next fraction and finally VLC. Then the CPU goes back to letting Firefox run again and so on. This gives the user the impression that all programs are running at the same time - but they're not.

If you wonder how the operating system does all this we refer to your teacher or the following Wikipedia articles: Computer multitasking and Context Switch.

Networking

A network card, which provides the hardware connection to other networks and ultimately perhaps the internet, is shared between the various programs on your computer. Your browser and your mail client can both access internet using the same software and at the same time. We have to make a remark here, just as with the time sharing f the CPU (see above) the network card is shared between the various programs. We will look more into networking in Networks and protocols. If you want a deeper understanding of network we suggest reading Introduction to web

Links

Summary lecture slides

  • We will not use slides during the in-classroom lecture

Video lecture slides and video

Further reading

Navigation

The next page is Computers_and_hardware_-_Exercises.

« PreviousBook TOCNext »