comp sci

FEATURES

  • Central Processing Unit (CPU/Processor)

  • Memory where both data and instructions can be stored

  • Input devices such as keyboards

  • Output devices such as monitors

  • Storage ,such as HDD and SSD

  • Processor able to access the memory directly

  • Computer memories that could store programs as well as data

  • Stored programs made up of instructions that could be executed in sequential order 


COMPONENTS OF CPU;

  1. Arithmetic & Logic Unit (ALU)

  • Performs mathematical and logical operations required while running a program

  • Has an “Accumulator” 

    • A temporary register used when carrying out ALU calculations. 


  1. Control Unit (CU)

  • Reads an instruction from memory and interprets it 

  • During this process, signals are generated and are sent on the control bus to tell the other components of the computer on what to do

  • Ensures synchronisation of data flow and program instructions throughout the computer 


  1. System Clock

  • produces timing signals which are sent on the control bus to ensure the synchronisation take place

  • Without it, computer would crash


  1. Immediate Access Store (IAS)

  • holds all the data and programs that the CPU needs to access

  • CPU takes data and programs held in backing store and puts them in IAS temporarily 

  • This is done because read/write operations using IAS is faster compared to the backing store

  • Referred to as random access memory

  1. Registers

  • temporary  storage in the CPU which can either be general  or specific in its use to hold data and instructions in the fetch and execute cycle


General Purpose Registers

  • holds data that is frequently used by the CPU

  • Ex: Accumulator


Register

Abbreviation

Function

Accumulator

AC

Holds processed data temporarily from ALU


Special Purpose Registers

  • specific function within the CPU and holds the program state

  • Ex: CIR, IX, MAR, MDR, PC, SR


Register

Abbreviation

Function

Current Instruction Register

CIR

Stores the current instruction being decoded and executed

Index Register

IX / IR

used when carrying out index addressing operations (assembly code)

Memory Address Register

MAR

stores the address of the memory location currently being read from or written to

Memory Data Register / Memory Buffer Register

MDR / MBR

stores data which has just been read from memory or data which is about to be written to memory

Program Counter

PC

stores the address where the next instruction to be read can be found

Status Register

SR

contains bits (flags) which can be set or cleared depending on the operations


Status Register

= used when an instruction requires some form of arithmetic or logic processing

  • Carry Flag (C) 

    • Set to 1 if there is CARRY in the following an addition operation

  • Negative Flag (N)

    • Set to 1 if the result of a calculation has a negative value

  • Overflow Flag (V)

    • Set to 1 if an arithmetic operation results in an overflow

  • Zero Flag (Z)

    • Set to 1 if the result of an arithmetic operation is ZERO

SYSTEM BUSES

  • used in computer as a parallel transmission component

  • Each wire in the bus transmit one bit of data

  1. Address Bus

  • caries data throughout the computer system (CPU and memory)

  • Unidirectional (travel in one direction only)

  • Prevents addresses being carried back to the CPU


  1. Data Bus

  • Bidirectional (allows data to be sent in both directions along the bus)

  • Data can be carried from CPU to memory and to/from input/output devices

  • Data can be an address, an instruction, or a numerical value

  • Carries word lengths the greater the width of the bus the larger the word length which improves the performance of the computer system

  • word is a group of bits regarded as a single unit e.g. 16-bit.


  1. Control Bus

  • bidirectional 

  • Carries signals from CPU to all other components

  • 8 bit wide and only carry control signals .i.e timing signals and interrupt signals


FACTORS THAT AFFECTS THE PERFORMANCE OF CONTROL SYSTEM

  1. Width of a bus 

  • wider it is, the more memory locations which can be directly addressed at any given time

           Larger word length.

  • can improve computer’s overall performance.




  1. Clock speed

  • The number of pulses the clock gives out per unit time

  • The increase in clock speed reduces execution time and the increase in number of fetch execute cycle per unit time

  • increasing speed by accessing the Basic Input/Output System (BIOS), processing speed also increase

  • Can lead to unsynchronized operations (unable to complete on time)

  • Overheating the CPU = unreliable performance


  1. Number of cores

  • Each core can independently carry out a process at the same time so more instructions are executed improving performance of computer system

  • dual core (CPU made up of 2 cores)

    • Has one channel and needs the CPU to communicate with both the cores, not really affect performance

  • Quad core (CPU made up of 4 cores)

    • Has 6 channels and need the CPU to communicate with all 4 cores, reducing a lot of performance 


  1. Cache Memory

  • using cache can improve performance

  • Cache have faster access time

  • Stores frequent instructions that is used by CPU

  • Contents lost when power is turned off similar to R.A.M


COMPUTER PORTS

UNIVERSAL SERIAL BUS (USB)

= an asynchronous serial data transmission method

How does a USB port transfer data

  *It transfers data one bit at a time

   * in an asynchronous way

  • 4-wire shielded cable

  • 2 wires for power and the earth

  • 2 wires for data transmission

  • Computers automatically detects that devices is present (due to small change in voltage level on the data signal wires in the cable)

  • Appropriate device driver is loaded up so that comp and device can communicate effectively 

  • If new device is detected, the comp will look for the device driver which matches thee device

  • If not available, user is promoted to download the appropriate software

  • automatically detected and device driver are automatically loaded up

  • Connectors can only fit one way, prevents incorrect connections

  • USB is a standard adopted by many manufacturers = all comps will be equipped with USB ports

  • Fast data transfer = useful when transferring large files such a s video files

  • Allows power to be drawn to charge devices

  • transmission rate is limited to less than 500 megabits per second

  • Cable length is max 5 metres 






HIGH-DEFINITION MULTIMEDIA INTERFACE (HDMI)

= allow output from a computer to an HDMI-enabled device

HDMI increases bandwidth  making it possible to supply high quality sound and visual effects

  • the current standard for modern tv and monitors

  • Allows for a very fast data transfer rate

  • Improved security (help prevents piracy) since it uses high bandwidth digital copy protection (HDCP)

  • Support modern digital systems

  • not a very robust connection (easy to break connection by moving device)

  • Limited cable length to retain good signal

  • Only 5 cable standards


VIDEO GRAPHIC ARRAY (VGA)

= older version of HDMI

  • simpler technology

  • Only 1 standard available

  • Easy to split the signal and connect a number of devices from one source

  • Connection is very secure

  • old out-dated analogue tech

  • Easy to bend the pins when making connections

  • Cables must be a very high grade to ensure good undistorted signals




















FETCH EXECUTE CYCLE

*Double Brackets = data stored at the address shown in MAR is copied to MDR


INTERRUPTS

= a signal sent from a device or  software to the processor

  • this will cause the processor to temporarily stop what it is doing and service the interrupt.

  • Allow a computer to carry out many tasks 

  •  allow it to open many windows at the same time

Caused By:

  • timing signal

  • Input/output processes e.g. disk drive ready to receive data

  • User interaction e.g. user presses a key such as <ALT> or <BREAK>

  • Hardware fault e.g. paper jams

  • Software error e.g. dividing by zero and an exe.file not being found to run a program

  • Check for interrupt 

  • Interrupt flag is set

  • Once interrupt signal is received, The processor either carries on with what is was doing or stops to service the device that generated the interrupt

  • Computer need to identify the interrupt type and establish the level of interrupt priority. 

  • Once serviced, stops current tasks and saves the contents of registers in a stack.

  • Interrupt Service Routine (ISR) is loaded to program counter.

  • Once fully serviced, the register is reset and contents of registers are restored.


ASSEMBLY LANGUAGE


ASSEMBLY LANGUAGE 

= a low level machine specific programming language that uses mnemonics


MACHINE CODE

= the programming language that the CPU uses

  • binary

  • Sometimes displayed on a screen as hexadecimal so user can understand machine code instruction more easily

  • Very time consuming and error problem

Each instruction of assembly language and machine code have:

  • Opcode = identifies the operation to be carried out by the CPU

  • Operand = identifies the data to be used by opcode


LANGUAGE TRANSLATORS

Why?

  • shorten development time for writing computer programs

  • Instructions to be easier to learn and understand


Before a program written in assembly language (source code) can be executed, it needs to be translated to machine code. This is performed by an Assembler

  • Translates each assembly language instructions into machine code instruction

  • Checks syntax of the assembly language program to ensure that only  the appropriate machine code instruction set are used

  • This speeds up the development time as some errors are identified during translation before the program is executed




TYPES OF ASSEMBLER

  1. One Pass

  • Removes white lines.

  • read the assembly language program one line at a time

  • Ignore anything not required: comments

  • Allocate a memory address for the line of code

  • Check the opcode is in the instruction set

  • Add any new labels to the symbol table with the address, if known

  • Place address of labeled instruction in the symbol table

  1. Two Pass

  • read the assembly language program one line at a time

  • Generate object code, including opcode and operand, from the symbol table generated in one pass

  • Save or execute the program


ASSEMBLY LANGUAGE INSTRUCTIONS


  1. Data Movement Instructions

  1. Input and Output of Data Instructions


  1. Arithmetic Operation Instructions


  1. Unconditional and Conditional Instructions

  1. Compare Instructions



ADDRESSING MODES


ABSOLUTE ADDRESSING

the contents of the memory location in the operand are used

DIRECT ADDRESSING

the contents of the memory location in the operand are used

INDIRECT ADDRESSING

the contents of the contents of the memory location in the operand are used

INDEXED ADDRESSING

the contents of the memory location found by adding the contents of the IR to the address of the memory location in the operand are used

IMMEDIATE ADDRESSING 

the value of the operand only is used 

RELATIVE ADDRESSING

the memory address used is the current memory address added to the operand

SYMBOLIC ADDRESSING

used in assembly language programming, where a label is used instead of a value











BIT MANIPULATION

BINARY SHIFT

= moving the bits stored in a register a given number of places with the registers


TYPE OF SHIFTS:

LOGICAL SHIFTS

bits shifted out of the registers replaced with 0

10101111

Shifted left 3 places

01111000

ARITHMETIC SHIFTS

the sign of the number is preserved

10101111

Shifted right 3 places

11110101

CYCLIC SHIFTS

no bits are lost, bits shifted out of one end of the register are introduced at the other end of the register

10101111

Shifted left 3 places

01111101

LEFT SHIFTS

bits are shifted to the left

10101111

Shifted left 3 places

01111000

RIGHT SHIFTS

bits are shifted to the right

10101111

Shifted right 3 places

11110101


In monitoring and control, each bit in a memory location can be used as a flag and would need to be tested, set, or cleared separately

CH5 - SYSTEM SOFTWARE


OPERATING SYSTEM

= software that provides an environment in which applications can run and provides an interface between hardware and human operators


TASKS

  1. Memory Management

  • Memory optimization = determine how comp memory is allocated and de allocated when a number of applications are running simultaneously 

    • To maintain optimization, swap data to and from the HDD or SSD

  • Memory organization = determines how much memory is allocated to an application, and how the memory can be split up in the most appropriate and efficient way

    • Partitioned allocation =. Memory is split up into contiguous blocks and memory management then allocates a block into an applications 

  • Memory protection = ensures that two competing applications cannot use the same memory locations at the same time

    • If not done, data could be lost, security issues, computer can crash


  1. Security Management

  • to ensure integrity, confidentiality, and availability of data

    • Carry out OS updates when they’re available 

    • Ensure that anti-virus software is up to date

    • Maintaining access rights for all users

    • Offering recovery of data (in case of lost or corrupted)


  1. Process Management

  • allocating resources and permit the sharing and exchange of data, thus allowing all processes to be synchronized 



  1. Hardware Management

  • Controlled by queues and buffers

  • Communicating with all input and output devices using device drivers

  • Translating data from a file into a format that the input/output device can understand using device drivers

  • Ensuring each hardware resource has a priority so that it can be used and released as required


  1. File Management

  • Defining the file naming convention which can be used (.exe, .xls, etc.)

  • Performing specific tasks (copy, open, create)

  • Maintaining the directory structures


UTILITY SOFTWARE

  1. Hard Disk Formatter

  • OS need to know how to store files and where the files will be stored on the hard disk

  • Will organise storage space by assigning it to data blocks

  • Disk surface may have a number of partitions 

  • Note that partitions are contagious blocks of data

  • Once partition created, they must be formatted

  • Done by writing files which hold directory data and tables of contents at the beginning of each partition

  • Allows OS to recognise a file and know where to find it on the disk surface

  • Also have a checking tool for each sector

    • If bad = sector will be flagged as ‘bad’ and the file tracking records will be reorganised 

      • Replacing bad sectors with new unused sectors


  1. Virus Checker

  • check software or files before they are run or loaded on a computer

  • Compare possible viruses against a database of known viruses

  • Carry out heuristic checking

    • Checking software for types of behaviour that could indicate a possible virus

  • Put files or programs which may be infected into quarantine

    • Automatically delete the virus

    • Allow user to decide whether to delete the file


  1. Defragmentation Software

  • When HDD become full, blocks used for files will become scattered all over the disk surface

  • Happens when files are, extended, etc

  • Cause slower data access time

    • HDD read-write head requires several movements just to find and retrieve the data making up the required file

  • Better if files could be stored in contiguous sectors, hence reducing HDD head movement


  1. Disk Content Analysis/Repair Software

  • used to check disk drivers for empty space and disk usage by reviewing files and file folders

  • Can led to optimal use of disk space by removal of unwanted files and downloads


  1. Disk Compression and File Compression

  • File Compression = to save storage space and make it quicker to download/upload files and quicker to send files via email

  • Disk Compression = compresses data before writing it to hard disk and decompressed again when reading 

    • High priority and will override all other OS routines

    • Do not uninstall — will make any previously saved data to be unreadable


  1. Back-Up Software

  • allow a schedule for backup files to be made

  • Only carry out a back-up procedure if there have been any changes made to a file


PROGRAM LIBRARIES

  • when software is under development and programmer can utilize pre-written subroutines in their own programs (save development time)

  • Help software developer who wishes to use Dynamic Link Library (DLL) subroutines in their own program


When software routines are written, they are saved in a program library (Library Program) for future use by other programmers

*Library Routines = described routines which could be used in another piece of software under development


Benefits of Developing Software this way:

  • Removes the need to rewrite the many routines every single time (save time and money)

  • Leads to modular programming = several programmers can be working on the same piece of software at the same time

  • Allows continuity with other games that may form part of a whole range

  • Allows to maintain eye of a ‘corporate image’ in all the software being developed by a company

  • Saves development time Ching to test each routine since the routines are all fully tested in other software and should be error free


TYPES:

  1. Static Library

  • software being developed is linked to executable code in the library at the time of compilation

  • Library routines would be embedded directly into the new program code

  1. Dynamic Link Library Files (DLL)

= software being developed is not linked to the library routines until actual run time

  • Executable code of the main program is smaller since DLL files are only loaded into memory at run time

  • Possible to make changes to DLL files independently and won’t be necessary to recompile the main program

  • Save memory and execution time

  • executable code is not self-contained, therefore all DLL files need to be available at run time otherwise error or crash

  • Any DLL linking software in the main program needs to be available at run time to allow links with DLL files to be made

  • Risk of DLL having a malware which can be a risk to the main program when linking 

What is DLL?


LANGUAGE TRANSLATORS

Instructions in a program can only be executed in machine code, hence need to be translated


ASSEMBLER

COMPILER

INTERPRETER

Source program translated to...

assembly language - machine code

high level language to machine code

high level language to machine code

Machine dependent

yes

yes

no

Object Program is stored on...

disk or in main memory

disk or in main memory

every line of program are interpreted then executed each time the program runs and its under the control of interpreter

Each line of the source program generates...

one machine code instruction (one to one translation)

many machine code instructions, instruction explosion

many machine code instructions, instruction explosion

robot