Notes, summaries, assignments, exams, and problems for Computer science

LEGv8 Architecture and Assembly: Performance, Registers, Instructions and Branching

Computer scienceUpdated on 239.58 KB

Performance Metrics

  • Elapsed Time: Represents overall system performance. It is the total time taken to complete a task.
  • User CPU Time: Indicates CPU performance. It is the time the task actively runs on the CPU, excluding idle time.
  • CPU Time: The time the CPU spends executing instructions, either from the task or the operating system, excluding idle time.
  • Clock Speed: 1 MHz equals 1 million clock cycles per second. 1 GHz equals 1 billion clock cycles per second.
  • Response Time: Equivalent to execution time.
  • Throughput: Equivalent to bandwidth.
  • Performance Comparison: (PerfA) / (PerfB) = (ExecTimeB) / (ExecTimeA) = n

Impact of Processor Upgrades

  • Replacing a processor with a faster one decreases response time and increases throughput.
  • Adding an additional
...
Continue reading "LEGv8 Architecture and Assembly: Performance, Registers, Instructions and Branching" »

Shell script

Computer science2.47 KB

Ejercicio de descuentos:

#!/bin/bash

read -p "¿Desea el billete también de vuelta? (s/n): " idavuelta

until [ $idavuelta=="s" ] || [ $idavuelta=="n" ]; do

read -p "¿Desea el billete también de vuelta? (s/n): " idavuelta

done

read -p "¿Tiene carnet joven? (s/n): " carnetjoven

until [ $carnetjoven="s" ] || [ $carnetjoven="n" ]; do

read -p "¿Tiene carnet joven? (s/n): " carnetjoven

done

descuento=0 billete=20

if [ $idavuelta="s" ]; then

descuento=20

billete=" expr $billete \* 2'

fi

if [ $carnetjoven="s" ]j then

descuento=30

fi

costefinal=`expr $billete \* \( 100 - $descuento \) / 100`

echo "El precio final del billete es $costefinal"



Ejercicio de medias:

#!/bin/bash

acu=0

cont=0

read -p "Introduce un numero: " num

while [ $num -ne 0 ]; do

acu=`expr $acu + $num`

cont=...

Continue reading "Shell script" »

Refer to the exhibit. A network administrator has segmented the network into two VLANs and configured Router1 for inter-VLAN routing. A test of the network, however, shows that hosts on each VLAN can only access local resources and not resources on t

Computer science20.53 KB

  1.  A network technician is configuring port Security on a LAN switch interface. The security policy requires host MAC Addresses to be learned dynamically, stored in the address table, and Saved to the switch running configuration. Which command does the technician Need to add to the following configuration to implement this Policy? Switch(config)# interface fa0/1 
    Switch(config-if)# switchport mode access 
    Switch(config-if)# switchport port-security

·Switch(config-if)# switchport port-security mac-address sticky

  1. On which switch interface would an Administrator configure an IP address so that the switch can be managed Remotely?

·VLAN 1

  1. Refer to the exhibit. Match the packets with Their destination IP address to the exiting interface on the router.
...
Continue reading "Refer to the exhibit. A network administrator has segmented the network into two VLANs and configured Router1 for inter-VLAN routing. A test of the network, however, shows that hosts on each VLAN can only access local resources and not resources on t" »

OpenSSL Encryption and Decryption Techniques

Computer science109.42 KB

OpenSSL Encryption and Decryption Commands

RC4 Symmetric Encryption

To encrypt the file "fichero.txt" using the RC4 symmetric encryption algorithm:

OpenSSL> rc4 -in c:\cifrado\fichero.txt -out c:\cifrado\cifrado.rc4
enter rc4 encryption password:
Verifying - enter rc4 encryption password:

To decrypt the previously encrypted file:

OpenSSL> rc4 -d -in c:\cifrado\cifrado.rc4 -out c:\cifrado\descifrado.txt
enter rc4 decryption password:

DES Encryption

Encrypting a file:

OpenSSL> des -salt -in c:\csb.log -out c:\csb.bf.txt
enter des-cbc encryption password:
Verifying - enter des-cbc encryption password:

Decrypting a file:

OpenSSL> des -d -in c:\csb.bf.txt -out c:\csb.txt
enter des-cbc decryption password:

Triple DES (DES3) Algorithm

Encrypting...

Continue reading "OpenSSL Encryption and Decryption Techniques" »

The Complete HTTP Request Lifecycle Explained Step-by-Step

Computer science4.45 KB

1. Client Initiation and DNS Lookup

  • The user enters a URL or clicks a link in the browser. The browser parses the URL and extracts the domain (e.g., www.example.com).

  • A **DNS lookup** translates this domain into an IP address—acting like a digital phonebook entry.


2. Establishing the TCP Connection

The browser’s operating system (OS) creates a socket and initiates the **TCP three-way handshake** with the server:

  1. SYN: Client sends a synchronization request to the server.
  2. SYN-ACK: Server acknowledges the request and sends its own synchronization.
  3. ACK: Client acknowledges the server's response.

Once this handshake is complete, a full-duplex TCP connection is open and ready for reliable data exchange.


3. Sending the HTTP Request Message

The client constructs...

Continue reading "The Complete HTTP Request Lifecycle Explained Step-by-Step" »

Processor and Memory Interface: CPU Datapath, Registers & ALU

Computer science967.85 KB

Processor & Memory Interface

Processor & Memory Interface: The maximum size of the memory that can be used in any computer is determined by the addressing scheme. For example, a computer that generates 16-bit addresses is capable of addressing up to 216 = 65,536 (≈ 64K) memory locations. Machines whose instructions generate 32-bit addresses can utilize a memory that contains up to 232 = 4,294,967,296 (≈ 4G) locations, whereas machines with 64-bit addresses can access up to 264 ≈ 1.84 × 1019 locations. The number of locations represents the size of the address space of the computer.

The connection between the processor and its memory consists of address, data, and control lines. The processor uses the address lines to specify the...

Continue reading "Processor and Memory Interface: CPU Datapath, Registers & ALU" »

Understanding Computer Architecture: System Bus, Address Bus, Data Bus, and Control Bus

Computer science38.71 KB

System Bus (Data, Address, and Control Bus)

This network of wires or electronic pathways is called the 'Bus'. A system bus is a single computer bus that connects the major components of a computer system.

It combines the functions of:

  • Data Bus: Carries information.
  • Address Bus: Determines where information should be sent.
  • Control Bus: Determines the operation to be performed.

This technique was developed to reduce costs and improve modularity.

Z

Figure: System Bus

Address Bus

The address bus is a group of wires or lines used to transfer the addresses of memory or I/O devices.

  • It is unidirectional.
  • The width of the address bus determines the maximum addressing capacity, representing the largest address within memory that the bus can handle.
  • Addresses are
...
Continue reading "Understanding Computer Architecture: System Bus, Address Bus, Data Bus, and Control Bus" »

Software Testing and Debugging

Computer science4.52 KB

SOFTWARE TESTING

Testing can only show the presence of errors, not their absence. The goal of testing is confidence.

  • Validation: Are we building the right product? What does the customer need?
  • Verification: Are we building the product right? Functional/Non-Functional requirements.

SOFTWARE INSPECTION VS. SOFTWARE TESTING

While inspection will go through the code without running the program, testing will run the program and look at the results. Incomplete programs can only be inspected, not tested. Inspections can control aspects of good software (maintainability…), not just the results.

TEST CASE:

  • Requirements
  • Data/Input
  • Actions
  • Expected Results

TEST CASE PRINCIPLES:

  • A test tries to find flaws in a program.
  • A good test case will show a possible defect
...
Continue reading "Software Testing and Debugging" »

Mastering Matrix Operations and Linear Equations in MATLAB

Computer science3.98 KB

Matrix Operations and Linear Equations in MATLAB

Format short, long format, format rat (format is the x / y), format short (as is 3 * 10-5 = 3e-5). A = [; ;]. To extract a positive one: A(2,2). Changing a number in one position: A(row, column) = number in that position.

Write a whole line: A(row,:). or A(row, 2:4) - the columns you want from that row. For columns it is the same but in reverse: A(:, 3:7). Extract a submatrix A(2:3, 2:3) - ever-growing range. Transpose: A.'. Conjugate matrix (star A*): A'. Matrix for blocks: [A | E] - like n-th row or [A; E] - so I place it under.

Matrix by number unit: 23 * ones(3). Identity: eye(x, y).

Systems of Linear Equations Ax = b:

  • Rank(A) = rank(A | b) = No incog. - SCD: x = A \ b
  • Rank(A) = rank(A | b)
...
Continue reading "Mastering Matrix Operations and Linear Equations in MATLAB" »

Computer Terminology Glossary

Computer science5.84 KB

A

  • ATTACHMENT: A file that is sent with an email.
  • BANDWIDTH: A measurement of the amount of information that a computer network can send or receive. High bandwidth allows images and websites to load quickly on the Internet.
  • BANNER: A rectangular graphic on a website that advertises a business.
  • CASE: An enclosure that holds the computer's components.
  • CODE: A set of words and symbols that give instructions to a computer.
  • CONTENT: The material on a web page, including text and graphics.
  • CROP: To cut off unwanted parts of an image.
  • DATABASE: A large group of data organized in a computer system. It allows you to search and find information easily.
  • DESKTOP: Everything that a user sees on a computer screen.
  • DESKTOP COMPUTER: A computer that is small enough to
...
Continue reading "Computer Terminology Glossary" »