CS代考 Systems and Networks

Systems and Networks
Dr School of Computing Science University of Glasgow

Copyright By PowCoder代写 加微信 powcoder

Basic Info
• Motivation. How computers and networks work: a broad overview, all the way from hardware architecture up to systems software
• Benefits. Understanding the basic concepts of systems will help you to use computers more effectively
• Course can mostly be studied “online anytime”.
– The times published on MyCampus are formally related to conventional delivery (face-to-face)
– There will normally be a single one-hour live tutorial every week (Check Moodle for links)
– Attendance at the live session is optional but you are recommended to join if you are having any problems.
– Email me if there is anything you would like discussed at the next live session.
– No formal labs. You can do all practical work on your own at times of your own choosing. Software for this will be provided and its use with examples will also be discussed at tutorials.
• Slides and lectures for the next week will be released by 9:00 Monday morning (check Moodle). You should watch all lectures within one week of release.
• No compulsory texts. All examinable materials will be available on Moodle and Microsoft Teams/Stream
• The slides will sometimes include questions for you to attempt. You should try these within one week of release and before solutions are published. They are unassessed. No hand-in is necessary. They will usually be discussed at the live session the following week.
• Assessed Coursework (20%): one exercise (programming) handed out in November. Examination (80%).
Systems and Networks Preliminaries 2

1. Introduction

To study how computer systems can be built from (very many) simple physical (hardware) components (such as wires and transistors) are capable of running programs (software) that implement applications and services, communicate with users and with other computers.
Computer systems hardware and software are both highly complex
More than 1010 transistors on one “chip” of silicon.
E.g. (see photo on the right) Intel “Skylake-X” Core i9-7980XE microprocessor (2017) has ~ 7 billion transistors on a ~450 mm2 die.
1 (2020) reportedly has ~16 billion transistors.
more than 107 lines of code in a modern OS
Systems and Networks Introduction 4

Levels of Abstraction
To help cope with the complexity, helpful to visualise computer systems as a series of layers of organisation, of increasing usefulness from lowest to highest.
At the bottom is the raw hardware (transistors, wires), then the low-level machine-code instructions, then an operating system to make it easy to use as a platform for the final layer of applications.
Application Software Operating System Instruction Set Digital Circuits
Spreadsheets, databases, your own programs …
Supports processes, protection, networks …
Machine’s own programming language (using instructions implemented by the hardware)
Hardware (designed to be controlled by simple but fast binary machine-code instructions)
Systems and Networks
Introduction 5

• A computer is a machine that executes sequences of instructions (programs) which direct it to operate on (process) data.
• Strength: generality.
• Program instructs hardware to process incoming data in any chosen way.
Systems and Networks Introduction 6

Different Kinds of Computer
• Personal computer
– Variety of formats to support users directly (usually just one user or one at a time): desktop, laptop, tablet, phone, “wearable”.
– Designed to run services handling requests from many networked clients simultaneously (e.g. web server, file server, email server, etc.)
• Embedded computer
– A component that adds functionality to a bigger machine.
– E.g. engine management unit in a car.
• High performance computer
– Use many processors that cooperate to solve large scale problems.
– May be a single machine with many processors (CPUs) or consist of many computers cooperating over a network.
Systems and Networks Introduction 7

Numbers and Data
• Humans model external reality using mental concepts.
• These concepts are abstract mental entities not physical things, although they may
represent physical things.
• Amongst the most useful of our concepts are numbers. Like all mathematical entities, numbers are abstract concepts: i.e. they do not represent physical things, the way more concrete concepts do (e.g. a computer, a desk etc.).
– Numerals, symbols representing numbers, are concrete but not numbers themselves.
• Numbers are especially useful because the mathematical operations which can be
performed on them (addition, sorting etc.) help us model and manipulate reality.
• These operations are also abstract and are themselves conceptual: they are initially conceived and performed in the mind. Adding, say, 2 + 3 is a mental process.
• Data (plural) arise from use of number in modelling reality. There are two mechanisms whereby this happens: labelling (which also implies counting) and measurement.
• While operating on data (aka processing) is not a physical activity (data are ultimately numbers and numbers are not physical) it can become too onerous for human abilities when data volumes are large: this is the motivation for seeking assistance from data processing machines. One of the earliest examples of such a device was the abacus.
Systems and Networks Introduction 8

Data: Labelling and Measurement.
• Labelling. Take a set of items and map these onto whole numbers (0, 1, 2…etc) by assigning a different whole number to each one. If the elements have names, numbers can then be used interchangeably with the names.
– E.g. Days of the week, with: Sunday = 0, Monday =1, …, Saturday = 6.
– Such a mapping from names to numbers is called a code. Two days are never given the same number.
– Other codes for same set are equally good. E.g. Sunday = 1,…, Saturday = 7.
• Measurement. Measuring some physical quantity with a measuring instrument.
– These result in numbers with fractional (decimal) parts, often called real numbers.
– In theory, a measurement can take any value between (usually obvious) limits but, in practice, this is restricted by accuracy of instrument so, in fact, the set of outcomes is finite.
– E.g. measuring a length with a ruler is usually accurate to about .001m.
• Results of labeling and measurements are data items. Data are just sequences of data items.
• A set of data items under discussion at a given time forms a data set.
• Some data sets are clearly finite (e.g the days of the week), others may look infinite at first sight but, in reality, are finite too (e.g. possible values for temperature of the room using a particular thermometer).
Systems and Networks Introduction 9

Representations
• Despite the name, data-processing machines do not process data because machines are physical and data (being numbers) are not.
• Data representation involves finding suitable physical quantities to represent numbers.
– need representations that can be stored (memory) in physical devices, communicated between
devices and manipulated so as to mimic abstract data operations (like addition).
• In current technology electrical voltages are most commonly used.
– Easily stored and transmitted over wires.
– Other technologies are possible (e.g. optical).
• Computation involves designing devices to manipulate these physical representations in ways that map onto useful operations.
• Machines work with representations not with data.
– so machines do not add numbers, they manipulate physical representations of numbers to mimic addition.
– E.g in an abacus, groups of beads on a wire represent whole numbers and the process of moving the beads mimics addition.
• Many representations are possible for the same data.
• Two distinct approaches:
– Analogue representations use continuous phenomena (measured to arbitrary accuracy)
– Digital representations use discrete phenomena (finite number of allowed measurable values)
Systems and Networks Introduction 10

Analogue Representations
• Analogue representations assign real numbers to continuous physical quantities
– assumed measurable to arbitrary accuracy.
– E.g. a real number x, could be represented by x metres or x volts.
• In reality physical measurement has limited accuracy and this limits the accuracy of the representation.
• Also, noise (fluctuations that add errors to the measurement) in the environment introduces errors which are hard to control.
• Analogue computers, once popular, have largely fallen out of use.
• E.g. : a slide rule uses length as the measurable quantity.
Systems and Networks Introduction 11

Digital Representations
Digital representations use discrete physical quantities.
Current technology favours binary representations with two values of voltage,
– sometimes called low and high or false and true
Often the values are labelled 0 and 1 and are called bits (BInary digiITS).
Only need to be able to tell 2 values apart so superior resistance to noise errors.
– Only two values are valid and everything else a receiver sees is rounded to the nearest of these.
– E.g. a low needs a substantial upward spike of noise to be seen as a high.
– The further apart the low and high are the more resistance to noise there is.
High level
Low/high threshold
Can represent as many data items as required using sequences of bits called code words.
With 2 bits there are 4 possibilities (00, 01, 10, 11); with 3 bits 8 possibilities and so on.
Systems and Networks Introduction 12

Binary Codes
• A mapping from a data set to binary code words is called a binary code.
• Many codes can be defined on the same data set.
• Can represent any finite data set fully by using enough bits
• Can even represent real numbers to any desired degree of accuracy (by using long enough code words).
• If all the code words have same number of bits, code is fixed length. Systems and Networks Introduction 13

• Computers are general artificial data processing machines that can perform sequences of operations under control of a pre-prepared program.
• A program is a set of instructions detailing how input data should be processed to achieve a desired result (output data).
• Instructions can be numbered so a program can also be numerically represented.
• Programs may themselves be treated as data by other programs (e.g. a compiler).
• Programs can be represented in hardware in the same way as data.
• Needs a machine able to interpret and execute the instructions in the program.
Systems and Networks Introduction 14

There is a basic digital circuit that can
– Take a data bit and store it
– Remember the value indefinitely
– Read out the stored value
Computer Storage
The computer’s memory consists of a large number of these basic circuits
Think of a bit storage circuit as a box that
– contains one bit
– can read out its contents
– can store a new bit value
This hardware behaves much like a variable in a high level language (HLL) like Java or C.
Systems and Networks Introduction 15

A byte is a string of 8 bits, e.g. 01101001
A byte is represented in the computer by 8 copies of the basic bit storage circuit.
There are exactly 28 = 256 different values that can be represented in a byte (see right).
Many different ways to utilise the information capacity of a byte.
Systems and Networks Introduction 16

A word is a larger amount of information. One common convention:
Short word Word Long word
16 bits 32 bits 64 bits
2 bytes 4 bytes 8 bytes
The term “32 bit architecture” means that the internal hardware uses 32-bit words A word containing k bits is called a k-bit word, and can represent 2k distinct values.
Number of Values
216 = 65,536
232 = 4,294,967,296
264 = 18,446,744,073,709,551,616
Each CPU will have a characteristic word size which it can store and manipulate in a single instruction. Early machines used 8-bits; today the norm is 64-bits.
Systems and Networks Introduction 17

Transmitting binary: wires
• To manipulate binary representations in real devices need to connect components.
– In electronic devices this is done by conducting wires.
– Each wire can represent one bit at a time (as a high or low voltage between wire & ground).
• A bit (H or L) is forced onto one end of wire by a line driver (output) in the sending component…
Place H or L on wire
• …and detected by a line receiver (input) in the receiving component Detect H or L
• Multiple bits can be sent in sequence over the same wire, but one at a time:
– A bit must be kept steady on the wire for a minimum bit time to be properly detected be receiver.
– bit time varies according to the technology.
• To carry n-bits, can use one wire (serial transmission) taking n bit times, or n wires running in parallel (parallel transmission) taking 1 bit time. This arrangement is called an n-bit bus.
is often denoted
Computer Systems Binary Codes

Basic Components
• A 1-bit memory (build into n-bit registers to store binary code words)
8-bit register:
needs output wires to read current content and input wires to enter new content when needed.
• Note: register is the hardware: byte/word is the content.
• In addition to storage, we need physical devices to perform useful operations on bits and on
code words. Examples:
– Inverter (or NOT gate)
• One wire in, one wire out, flips input bit (H →L, L → H) – n-bit adder (see later)
• E.g. n = 4. Takes in two 4-bit codewords, treating them as numbers and generates 4- bit codeword of the sum.
• Say, “adding” 2 + 5
4-bit codeword for 2
4-bit codeword for 5
4-bit codeword for 7
Computer Systems
Binary Codes

A Final Note on Codewords
• An binary digital computer memory contains only physical quantities that we can think of as 1s and 0s, organised into binary codewords that represent data or programs.
• But just looking at the codewords stored in a computer cannot tell you what code is being used.
– E.g. 1001 may represent any one of: a number (e.g. 9 in one code), a different number in another code (e.g. -7); a letter (e.g. “q”), a month (e.g. September), an instruction (e.g. MULTIPLY), or many other things.
– Which one it is, is determined by the context.
– This information must be supplied by the person who designed the hardware or the software, typically an engineer or a programmer.
Systems and Networks Introduction 20

Some Questions
1. What data sets are involved in the following Java data types: boolean, byte, short, char?
2. Design an 8-bit code for unsigned numbers. Now design one for signed numbers.
3. Explain why digital representations have more resistance to noise than analogue.
4. An 8-bit adder is a device that takes in two 8-bit code words representing numbers and generates the 8-bit code word representation of the sum of the numbers. Such a device will sometimes fail to give the right answer. Explain why.
5. Bit times are just as important on buses as on single wires. Why?
6. A register will need some inputs and outputs other than for the data stored or read. Why?
Systems and Networks Introduction 21

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com