Computer Science Theory Revision
Computer Science Theory Revision
• Sender calculates the checksum value from the actual data bits to be sent.
• The checksum value is attached to the actual data bits at the end and sent along.
• The receiver calculates the checksum value again from the received data bits.
• Two checksum values are compared.
• If the same, no error occurs. If not, data is corrupted during the transmission.
Echo check
AND gate
OR gate
NOR gate
XOR gate
• It moves data around the computer and also send out control signals to make sure
everything is properly synchronised.
• Address bus
§ Carries signals relating to addresses between the processor and the memory
§ Unidirectional
• Data bus
§ Sends data between the processor, the memory unit and the input/ output
devices
§ Bi-directional
• Control bus
§ Carries signals relating to the control and coordination of all activities within
the computer
§ Uni-directional (Can be bi-directional too?)
• Contains ALU
• Allows arithmetic (add, subtract) and logic (AND, OR, NOT) operations
Control Unit
• Controls the operation of the memory, processor and input/ output devices
• Contains CIR and PC
§ CIR contains the current instruction during processing.
§ PC contains the address of the next instruction to be executed.
• Reads and interprets the instructions from the memory
• Generate signals along the control bus to synchronise all computer components
• PC contains the address of the memory location of the next instruction which has to
be fetched.
• This address is copied from the PC to the MAR; this is done using the address bus.
• The contents (instruction) at the memory location (address) contained in MAR are
copied temporarily into the MDR.
• The contents (instruction) of the MDR are then copied and placed into the CIR.
• The value in PC is incremented by 1 so it points to the next instruction to be fetched.
• The instruction is finally decoded and executed by sending out signals (via the
control bus) to the various components of the computer system.
5 Input and output devices
Input devices
• Hold up to 30 digits
• Read by a red laser or red LED
• Reflect light back off the barcode
§ Dark areas reflect little or no light.
§ White areas reflect more
• The reflected light is read by sensors (photoelectric cells)
• A pattern is generated which is converted into digital data.
Stock Control System at POS
• Has database which contains data about products, prices and stocks
• Each product has its own unique barcode number
• Barcode number is scanned at the checkout or POS
• The product is looked up in the database using barcode number
• The stock level in the database is reduced by one each time the barcode is scanned.
• The stock level is updated.
• The stock level is compared to the re-order or minimum stock level.
• Primary memory
§ RAM
• Volatile memory
• Store part of the operating system, data files that are currently in use
• Data can be written to and read from
• Greater capacity and faster operation speed than ROM
• Dynamic RAM (DRAM)
§ Uses millions of transistors and capacitors
§ Capacitors hold bits of information (0 or 1)
§ Transistors allows the chip control circuitry to read the capacitor or change
the capacitor’s value.
§ Need to be constantly refreshed every 15 microseconds
§ Otherwise, data is lost
• Static RAM (SRAM)
§ Uses flips flops to hold each bit of memory
§ No need to be refreshed
§ Faster data access than DRAM
DRAM over SRAM
• Non-volatile memory
• Only allow read operation but not write operation
• Store stat-up instructions and BIOS files
Hard Disk Drives (HDD)
• Non-volatile memory
• Have magnetic platters which spin and read-write heads which can access all of the
surfaces in the disk drive
• Store data on the surface in sectors and tracks
• Non-volatile memory
• FLASH technology
• Store data by controlling the movement of electrons within NAND chips
• Store data as 0s and 1s in millions of tiny transistors within the chip
• Electronically Erasable Programmable Read-Only Memory (EEPROM) technology
• Use NOR chips instead of NAND chips
• Less longevity than HDD
SSD over HDD
• More reliable
• Lighter and thinner
• Less noisy
• Lower power consumption
• Faster data access time
• Run much cooler
Writing data to optical storage media
• Compiler
Syntax errors
A syntax error is where a program statement doesn’t obey the rules of the programming
language. A problem cannot be translated if it contains syntax errors.
Logic errors
A logic error is where the program doesn’t do what the programmer wanted it to do. Logic
errors are found when a program is being run.
8 Security and ethics
Hacking
• Editing of program source code so that it can be exploited or changed for a specific
purpose
• Often done for malicious purposes, e.g., modifying legitimate software to do
something like redirect a user to a fake website
• Difficult to guard against
Virus
• Software or hardware
• Software – part of the operating system
• Hardware – sits between the external network and the internal network
• Monitors all incoming and outgoing traffic from the network
• Criteria can be set
• Checks whether incoming or outgoing traffic meets the criteria
• If not, blocks the traffic and issues a warning
• Logs all incoming and outgoing traffic
• Blacklist/ whitelist can be set
• Can block requests from certain IP addresses and access to certain web sites
Proxy server
• Software
• A protocol (a set of rules used by computers to communicate with each other across
a network)
• The browser request secure connection with the web server.
• It requests the web server to identify itself.
• The web server responds by sending a copy of its SSL digital certificate to the
browser.
• The browser authenticates the digital certificate.
• Encryption method is agreed between the browser and the server.
• SSL-encrypted two-way data transfer begins.
Transport Layer Security (TLS)
• Similar to SSL
• Record protocol layer (contains data being transferred over the internet)
• Handshake protocol layer (permits website and client to authenticate each other and
make use of encryption algorithms)
• Only recent web browsers support TLS
• Use session caching
Encryption
It is scrambling of data to make it meaningless, protecting the data from the hacker in case
it has been hacked. It uses encryption key to encrypt the data and decryption key to decrypt
the data.
Symmetric encryption
• Uses secret key to encrypt the plain (original) text or data into cypher (encrypted)
text or data by using encryption algorithm.
• The recipient needs a key to then decrypt the message back into the plain text.
• Both sender and recipient need the same key.
• It could be hacked or intercepted allowing a third party to decrypt the sent
encrypted message.
• This is Key Distribution Problem.
Asymmetric encryption
• Public key (available to everybody) and private key (only known by the computer
user)
• User A applies a symmetric key to encrypt the message.
• The symmetric key is encrypted using the public key known to both A and B.