Please enable JavaScript.
Coggle requires JavaScript to display documents.
Comp Sci AS Mock - Coggle Diagram
Comp Sci AS Mock
COMP 2
-
-
2.2
Global variables have a scope spanning the whole program, can be unintentionally overwritten and are only deleted from memory when the program is terminated.
decomp - Process repeated until subprograms: functions, procedures, objects. one part focused on so whole problem
Abstraction is the process of removing unnecessary complexities to focus on the more important complexities
COMP 1 Pt1
1.1
1.1.1
1.1.1a
CU: Directs the operations of the CPU by using read/write cycles. It also governs the decoding of data and manages the flow of data.
Registers: Registers are small, fast, temporary data stores with a designated purpose.
- PC: Holds address of next instruction to be executed.
- MAR: Holds the address of the instruction that is to be fetched or written to memory.
- MDR: Temporarily stores the data that has been fetched from memory.
- CIR: Data from MDR is copied here. The CIR splits the current instruction into its opcode (instruction) and operand (data).
- ACC: Holds the result of any calculations.
-
A bus is a number of parallel wires. The width of a bus is proportional to the bit number (that can be transferred at one time).
Data bus:
- Carries the actual data being transmitted (to and from memory). [Bi-directional].
Address bus:
- Carries the memory addresses. [Uni-directional].
Control Bus:
- Carries command and control signals (as well as interrupt commands). [Uni-directional].
LMC
LMC uses assembly language. It uses mnemonics to represent instructions:
- INP - Input into ACC
- OUT - Output from ACC
- STA - Stores ACC contents in memory.
- LDA - Loads memory to ACC.
- ADD - Add to ACC.
- SUB - Subtract from ACC.
- BRA - Branch always.
- BRZ - Branch if the value in the accumulator is 0.
- BRP - Branch if 0 or positive.
- HLT - Halt.
1.1.1b
Fetch:
- PC is checked (holds the address of the next instruction to be executed).
- This address is copied into the MAR.
- Address bus is used to send address to memory. A control signal (read or write) is sent along the control bus to memory.
- Contents of address are sent along the data bus to the MDR.
- MDR contents copied to CIR.
- PC increments by one.
Decode:
- The CIR splits the instruction into its opcode and its operand.
- Decoded by the decode unit.
Execute:
- Opcode is performed on the operand.
- The cycle repeats.
1.1.1c
The clock speed is measured in Hz, it is the number of instructions that can be handled by the CPU per second.
The number of cores within a CPU aids in parallel processing. The more cores there are, the more instructions can be executed at one time (although many programs may not require multiple cores).
The cache size governs the amount of commonly used data that can be stored in the CPUs onboard memory. This saves time as instructions do not have to be retrieved from main memory (L1, L2, L3)(storage increases as memory cell speed decreases).
1.1.1d
Pipelining gives a CPU the ability to handle 3 instructions simultaneously. While the first is being executed, the next is being decoded and the next is being fetched.
-
1.1.1e
Contemporary processors typically use VNA when working with data and instructions in main memory but use Harvard when dividing the cache into instruction and data cache.
VNA:
- Shared memory for data and instructions as well as shared bus.
- Linear FDE cycle.
- Instructions and data in same format.
- Cheaper to develop.
- Programs can be optimised in size.
- Two clock cycles required to execute single instruction.
- Von Neumann bottleneck.
- Single CU.
Harvard:
- Instruction and data stored in separate memory units.
- Each memory unit has its own bus.
- Can read and write while fetching.
- Used in RISC processors.
- Quicker execution.
- Different sized memory units can make for more efficient use of space.
- Most expensive than VNA.
1.1.2
1.1.2a
CISC:
- Aims to complete task in as few lines of assembly as possible.
- Circuitry most be more complex.
- Can perform complex instructions (closer to high-level language).
- Instructions may take more than one clock cycle to execute.
CISC:
- More expensive to design.
- Gives off more heat.
- Consumes more power.
- Is physically larger.
- Uses many addressing modes.
- Low-level CISC programs will likely take up less memory than their RISC counterparts.
- Used most in embedded systems and microcontrollers.
RISC:
- Cheaper to design and produce (fewer transistors).
- Consumes less power.
- Compiler has to do more conversion work.
- More RAM needed to store machine code.
- Pipelining is possible.
- Lower energy requirements.
- Uses direct addressing (limited addressing modes).
1.1.2b
A co-processor is just an additional processor used for a specialised task. They...
- Execute concurrently alongside the CPU.
- May contain many cores (like GPUs) that can allow for many parallel streams of data to be processed at the same time.
CPUs excel at performing complex operations on small data sets. GPUs excel at performing simple tasks on large data sets.
-
1.1.2c
A multicore processor is a single chip containing two or more independent processing units. Performance of these processors can be improved through on-board cache and inter-core communication.
1.1.3
-
1.1.3b
Optical:
- Laser shone at media with reflection processed (scattered light not detected).
- Pits represent a 0 and lands represent a 1.
- Easily distributed, lightweight, portable.
- Slow access times, prone to scratching.
Magnetic:
- Uses magnet polarity to represent 1s and 0s, read-write head passes over the region.
- Large capacity, cheap.
- Slow access times, fragile.
Solid State:
- Electrons forces into floating gates between oxide layers. The charge of the gate then changes.
- Oxide layers deteriorate and so we have limited read-write cycles.
- Durable, fast access speeds.
- Expensive, limited r- cycles.
1.1.3c
ROM:
- Non volatile storage medium.
- Contents cannot be changed.
- The BIOS checks that the computer system and components are connected properly.
- The boot sequence will load the OS kernel into RAM.
- Firmware written by manufacturer.
RAM:
- Volatile.
- Read-write.
- Quicker to access than secondary storage.
1.1.3d
Virtual storage is the process of storing data remotely so that it can b accessed via the internet rather than from a local storage device.
Adv:
- Data can be accessed at any time from any device.
- Data is easily shared.
- Storage is considered limitless from the perspective of the user.
Ddv:
- May require subscription (expensive).
- Connectivity determines access speeds.
- Cannot access without internet connection.
Virtual storage may also refer to the abstraction of file stores (seemingly ordered store presented).
1.2
1.2.1
1.2.1a
Operating system software may provide the following:
- Memory management.
- File management.
- Managing external peripherals.
- Handling interrupts.
- Utility software.
- Security.
- User interface.
- Networking.
- Processor management/
-
-
1.2.1b
In paging:
- We split the memory into physical divisions of equal size.
- Programs are split up to fit into a given number of pages.
- These pages are swapped between the hard disk and main memory.
In segmentation:
- Memory is split into logical divisions of differing sizes.
In virtual memory:
- We use this when main memory is full.
- Stored on a section of the hard-drive.
- Paging is used to move sections of program in memory that are not being used to VM.
- Swapping pages between the main memory and hard disk can result in disk thrashing if done too often.
1.2.1c
Interrupts are a way of notifying the processor of a process that needs attention (a signal). Interrupts are stored in a priority queue within the interrupt register.
- At the end of each FDE cycle, the processor will check the contents of the interrupt register. If there is an interrupt of high priority, the contents of the registers are pushed onto a stack.
- The ISR is then loaded into RAM and a flag signals that the ISR has begun.
- Once the interrupt has been serviced, the flag resets, the interrupt queue is again checked. If there is no more interrupts of high priority, the contents of the stack is popped off into the original registers.
1.2.1d
Scheduling algorithms:
- Round Robin:
- Each job is given a set amount of processing time / fair time slice.
- Next job is serviced when the time slice is exceeded.
- All jobs eventually get attended to.
- Longer jobs will take a longer amount of time to be serviced.
- Does not take urgency / priority into account.
- First Come First Served:
- Jobs are processed chronologically based on when they arrived for servicing.
- Easy to implement.
- Does not take urgency into account.
- MLFQ:
- Multiple priority queues are formed (based on different levels of priority).
- Difficult to implement.
- Takes different job priorities into account.
- Shortest Job First:
- Organises queues based on the time needed for completion.
- Best suited to batch systems as waiting time is reduced greatly.
- Processor must calculate completion times.
- If a great number of short jobs are added to the queue, longer jobs may go un-serviced.
- Does not consider the urgency of jobs.
- Shortest Time Remaining:
- Jobs are organised based on how long they have left until completion.
- Throughput increased as shorter jobs are quickly executed.
- Again, an influx of short jobs may cause longer jobs to go un-serviced.
- Does not consider priority.
1.2.1e
Multitasking OS handle multiple applications that are open at the same time. Each program is allocated a slice of the processor's time (gives the illusion that several programs are running at once.
Multiuser OS manage users' access rights, preferences and permissions.
Distributed OS run across a number of devices, task are spread across the network (across several processors).
Embedded OS are made to perform very specific tasks (on a specific device). They are limited in functionality and power requirements.
Real-time OS are used in time-critical devices (auto-pilot, etc). Each process has to execute in a guaranteed time frame. Some redundancy is given to these systems, allowing them to handle sudden increases in input.
1.2.1f
The BIOS settings are stored in flash memory and can be configured to alter the order in which drives are booted
1.2.1g
Device drivers are programs that allow for the the OS to communicate with the hardware. They are specific to the computer architecture and the operating system.
1.2.1h
A virtual machine is a theoretical computer that has the same functionality as a physical computer. It provides an environment with a translator for intermediate code to run.
May be used by game developers (with emulators) to test a game before release (or testing programs on different operating systems).
Intermediate code is halfway between machine code and object code. This code is independent of processor architecture and so it can run across different machines.
-
1.2.2
1.2.2a
Application software is designed to be used by the end-user to complete a specific task. Application software requires the system software in order to run.
1.2.2b
Utilities are programs that help maintain the computer (with a single purpose). Examples include:
- Compression: Allows for files to be compressed and decompressed. Large files may be compressed so that they can be transmitted across the internet.
- Defragmentation: Read-write speeds slow as the hard disk becomes full. Defragmentation re-arranges the contents of the hard-drive so that it can be accessed faster (until files are contiguous).
- Anti-virus: Responsible for detecting potential threats and alerting the user.
- Automatic updating: Ensures that the OS is kept up-to-date with any updates installed automatically (adds level of security).
- Backup: Automatically created routine copy of specific files, the user may choose how often files are backed up. Files can be recovered if a malware attack is ensued.
- Firewall: Monitors incoming and outgoing network traffic.
1.2.2c
Open Source:
- Can be used by anyone (without a license needed) and is distributed with the source code.
- Adv:
- Can be modified and resold.
- Receives community support.
- Ddv:
- Online support may be insufficient as there are no user manuals.
- Lower security as may not be developed in a controlled environment.
Closed Source:
- User must hold a license. Users cannot access the source code as the creator owns the copyright.
- Adv:
- Regular, well-tested updates.
- Expert support and user manuals available.
- High levels of security as developed professionally (controlled environment).
- Ddv:
- Users cannot modify and improve software themselves.
- Price is likely to be greater.
1.2.2d
Compiler:
- Reads all of the source code at once. All errors are returned.
- If changes are made to the program, it must be recompiled.
- Executable is generated.
- Code is optimised.
- Once compiled, code is processor specific.
Interpreter:
- Translate and executes code line-by-line.
- Errors are reported line-by-line also.
- Slower than running compiled code as the program has to be translated every time it is run.
- Useful for testing section of code.
- Not processor specific.
Assembler:
- Low level language, platform specific (instructions dependent on instruction set used by computer).
- One line of assembly roughly corresponds to one line of machine code.
1.2.2e
- Lexical analysis: White space removed, code analysed for keywords and variable names which are replaced with token. Each token and info about it is stores in a symbol table.
- Syntax analysis: Tokens analysed against grammar and rules of the language (any that break the rules of the language are flagged as syntax errors. Syntax tree and semantic analysis carried out.
- Code generation: Machine code produced form tree.
- Optimisation: Code made to be more efficient.
1.2.3
1.2.3a
Waterfall lifecycle:
- Series of stages completed in order.
- Analysis contains a feasibility study.
- Changes necessitate re-visitation of all levels.
- Model is inflexible (unsuitable for projects with changing requirements).
- Users may have little input.
Agile:
- Caters to changing requirements.
- Makes use of prototypes with less focus on documentation (user satisfaction is prioritised).
Extreme:
- Pair of programmers and an end-user form the development team.
- Aim is to produce high-quality code through continuous communication with the team.
- Each iteration through cycle generates a "working version".
Spiral:
- Four key stages, focuses on managing risk-heavy projects effectively.
- Stages: Analysing system requirements, mitigating risk, development/testing, evaluating for next iteration.
-
RAD:
- Partial prototypes that are built upon. Uses user feedback for next iteration.
- Used when requirements are unclear.
- Code may be unoptimized as additions and changes are made.
1.3
1.3.1
1.3.1a
When a compressed file arrived at its destination, it must first be decompressed before it it read.
Lossy compression reduces file size by a great deal. The associated loss in quality is seen as an acceptable compromise as it is not typically noticeable.
Lossless compression does not sacrifice quality; instead, it uses logical reductions and repetition techniques.
1.3.1b
Run-length encoding and dictionary encoding are both methods of lossless compression. Dictionary coding is ideal for text-based documents. It builds an index with every data item recorded with an indexed reference. The file is reconstructed with this dictionary with the number of occurrences.
-
1.3.1c
Symmetric:
- Same key is used to encrypt and decrypt the message.
- Both parties need to know the key.
- Key can either be re-used or generated each time.
- If the production process is known, a key can be replicated maliciously (or intercepted).
Asymmetric
- Two different keys are used: one for encryption and one for decryption.
- Virtually impossible to obtain / derive one key from the other.
- Keys form "key pairs" (public key and private key).
- Decrypting with private key authenticates.
1.3.1d
Hashing is used to convert a string of characters into a fixed-length value. On average, hashing provides a constant O(1) complexity.
If identical hashes are produced for different pieces of original data, a second hash may be used.
1.3.2
1.3.2a
Databases provide an easier means of retrieving, adding, deleting, updating and modifying data. Data will be stored as an entity / file / table.
A table contains rows / tuples / records and fields / attributes / columns. A flat-file database contains a single table; beyond trivial applications, flat-file databases can become inefficient.
-
A primary key is a unique identifier for each record within a table. A foreign key links two tables together, it exists in one table as the foreign key. A secondary key allows for the primary key to be remembered more easily and the database searched more easily.
1.3.3
1.3.3a
Network Adv:
- File-sharing enabled.
- Can implement multi-user systems.
- Hardware / peripherals shared.
- Software deployed across multiple devices.
Network Ddv:
- Can be expensive to set up.
- May need to employ.
- Greater security risks.
Physical Bus:
- Adv:
- Relatively inexpensive to set up.
- Doesn't require additional hardware.
- Ddv:
- Backbone may fail.
- Performance decreases as traffic increases.
- All computers can see data transmission.
Physical Star:
- Adv:
- Performance is consistent (even with high traffic).
- If one table fails, only the one node is affected.
- Easy to add new nodes.
- Ddv:
- Expensive due to switch and cabling.
- Central switch may fail.
Physical Mesh:
- Adv:
- No central switch so speed is improved.
- Speed of network increases as node number increases.
- Ddv:
- Large quantity of cable used.
- Difficult to maintain.
Ring Network:
- Each connected to two other devices.
- Token ring can be used.
1.3.3b
TCP/IP:
- Application Layer:
- Transport Layer:
- Uses TCP to establish end-to-end communication between the source and recipient.
- Splits data into packets, labels them, adds port number requests re-transmission of any lost packets.
- Network Layer:
- Adds source and destination IP.
- Combines port number and IP to form socket address.
- Link Layer:
Packet Switching (uses packets sent along most efficient route in network):
- Adv:
- Checksums ensure that data arrives.
- Packets can be transferred globally.
- Multiple routes can be used between devices.
- Ddv:
- Time has to be spent deconstructing and reconstructing packets.
Circuit Switching (Direct link created between devices, different paths taken):
- Adv:
- Quicker reconstruction as data arrives in a logical order.
- Users are able to call over a network without sound delay.
- Ddv:
- Devices must transfer and receive data at the same rate.
- Bandwidth is wasted during periods of no data transmission.
A MAC address is in hex (6 parts, colons), IP is denary (four parts, periods)
COMP 1 Pt2
1.3
1.3.4
1.3.4a
We use a dot for a class in CSS and hashtag for an ID e.g.:
.textbox1{
color: Blue;
font-family: Ariel;
}
-
Example Javascript:
alert("Hello World");
age = prompt("Enter age");
document.getElementById("Print-space") = age;
document.write("This also works");
[Prints age onto HTML]
1.3.3
1.3.3c
Packets are segments of data. They have several elements:
- Header: Sender and recipient IP address, protocol used, order of packets, time to live (tells packet when to expire).
- Payload: Raw data.
- Trailer: Checksum or cyclic redundancy check (detect errors that may have occurred during transmission).
A firewall makes use of packet filters to monitor incoming and outgoing network traffic. When access is denied by a firewall, it can either be rejected (sends an alert) or dropped.
A proxy server acts as an intermediary for the sender. This allows users to remain anonymous, caches frequently used website data to make it faster to load, reduces overall network traffic.
The NIC is the card required to connect a device to a network. This assigns a unique MAC address to the device. This address is a 48-bit number expressed as a 12 digit hex number separated by colons.
A gateway is used when the protocols are not the same between networks. It translates between these protocols.
1.4
1.4.2b
Stacks are LIFO data structures, they have a stack pointer that indicates the first note (top). Pushing onto a full stack will cause a stack overflow error, popping off an empty stack will cause an underflow.
A queue is a linear data structure in which items are queued at the back of the queue and dequeued at the front of the queue. They are a FIFO structure. It has a back pointer and a front pointer.
Client Server:
- Contains one powerful, central computer. Clients request services from the server.
- Adv: Most secure as data is stored in one location, central backups are stored by the server. Data and resources can be shared between clients.
- Ddv: Expensive to set up, specialised staff may be needed.
-