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

Data Storage Peripherals: Magnetic, Optical, and Flash Systems

Computer science4.94 KB

Magnetic Storage Peripherals

Magnetic storage uses a ferromagnetic layer material (disks or hard drives).

Floppy Disk Drives

Floppy disks read and record information. Key parts include:

  • Engine torque mechanism
  • Shaft reading heads
  • Ejecting mechanism and floppy connector

Hard Disk Drives (HDDs)

HDDs use tough aluminum platters that spin at high speed. The drive writes or reads data tracks.

Methods for Storing Information

  • CHS (Cylinder, Head, Sector): Information is located by knowing the face, track, and sector.
  • LBA (Logical Block Addressing): Data is accessed by calling a logical block number and searching for it.

HDD Physical Structure

The physical structure consists of:

  • Platters (disks)
  • Heads
  • Spindle motor (engine torque)
  • Head displacement mechanism (DLS heads)
...
Continue reading "Data Storage Peripherals: Magnetic, Optical, and Flash Systems" »

Essential Computer Hardware and Software Terminology

Computer science2.91 KB

Core Computing Terminology

  • CBT: Computer-Based Training
  • GUI: Graphical User Interface (icons and mouse)
  • PDA: Personal Digital Assistant (portable computer)
  • CPU: Central Processing Unit (measured in Gigahertz)
  • RAM: Random Access Memory
  • ROM: Read-Only Memory
  • ALU: Arithmetic Logic Unit
  • VDU: Visual Display Unit

Hardware Components

  • Input Devices: Mouse, keyboard, trackball, scanner, barcode readers, touchpad.
  • Output Devices: Monitor, printer, plotter, speakers, VDU.

Note: Adding more RAM improves computer performance. It is the main working memory of the computer and functions as read/write memory.

Information Technology and Communications

  • IT: A term used to describe hardware, software, and communications technologies.
  • PSTN: Public Switched Telephone Network (
...
Continue reading "Essential Computer Hardware and Software Terminology" »

OS Concepts: RTOS, Critical Section, Memory & Deadlocks

Computer science5.51 KB

Real-Time Operating System (RTOS)

A Real-Time Operating System (RTOS) is an operating system that provides a response within a specified time limit. It is used in applications where timing is critical.

Types of RTOS

  • Hard Real-Time OS: The deadline must be met. Missing a deadline may lead to system failure.
  • Soft Real-Time OS: Occasional delays are acceptable, but performance may be affected.

Applications of RTOS

  • Medical Equipment
  • Robotics
  • Air Traffic Control Systems
  • Industrial Automation
  • Automobile Control Systems

Advantages of RTOS

  • Fast response
  • High reliability
  • Predictable performance

Critical Section

A Critical Section is the part of a program where a process accesses or modifies shared data or resources. Only one process should execute its critical section...

Continue reading "OS Concepts: RTOS, Critical Section, Memory & Deadlocks" »

Statistics and Python Programming Fundamentals

Computer science8.01 KB

Understanding Quartiles, Deciles, and Percentiles

Quartiles divide ordered data into four equal parts. There are three quartiles: Q1, Q2, and Q3.

  • Q1 (First Quartile): Tells about the point below which the first 25% of observations lie.
  • Q2 (Second Quartile/Median): The middle value or median.
  • Q3 (Third Quartile): Tells us about the point below which 75% of observations lie.

Deciles and Percentiles

Deciles divide an ordered dataset into 10 equal parts. They are represented by D1 through D9.

  • D1: 10% position
  • D5: 50% position
  • D9: 90% position

Percentiles divide data into 100 equal parts, represented by P1 to P99.

Measures of Dispersion in Statistics

Dispersion refers to how much the data values are spread or scattered around a central value, such as the mean....

Continue reading "Statistics and Python Programming Fundamentals" »

Graph Neural Networks and Distributed Data Pipelines

Computer science25.85 KB

Graph Neural Networks (GNN)

GNN Challenges and Representations

Working with graphs introduces unique computational challenges:

  • Graph size is dynamic.
  • Each node can have a variable number of edges.
  • Standard methods used for images and texts are not suitable for graphs.
  • Adjacency matrix representation can be very inefficient.
  • There can be multiple adjacency matrices to represent the same graph.
  • Standard convolution applied to images does not work (though adaptations have been tried).

Potential tasks: Link prediction, node classification, community detection, and ranking.

Representation: Adjacency matrix, edge list, and adjacency list.

Spectral GNN Architectures

Como funciona: Utiliza a Transformada Discreta de Fourier (DFT) sobre a matriz de adjacência...

Continue reading "Graph Neural Networks and Distributed Data Pipelines" »

Essential IT Project Management Frameworks and Practices

Computer science8.73 KB

Waterfall Model Phases and Deliverables

The Waterfall model follows a sequential process where each phase must be completed before the next begins. Deliverables serve as proof of completion:

  • Requirements: Requirements Specification document
  • Design: System/architecture design document
  • Implementation: Working source code
  • Testing: Test report
  • Deployment: Live released system
  • Maintenance: Bug-fix and update log

Scrum Sprint Plan (2-Week Sprint)

Sprint Goal: Deliver a working login and registration feature.

User Stories:

  1. As a user, I can register with email and password.
  2. As a user, I can log in.
  3. As a user, I can reset my password.

Daily Standup: Every day at 10:00 AM for 15 minutes. The sprint concludes with a review and retrospective.

Kanban Board Structure

Columns:

...
Continue reading "Essential IT Project Management Frameworks and Practices" »

Software Testing Levels: Integration, Functional, and System

Computer science7.41 KB

Integration Testing Essentials

Integration Testing is the second level of software testing, performed immediately after Unit Testing. In this phase, individual software modules or units that have already been tested in isolation are combined and tested as a group.

While unit testing answers the question, "Does this single component work?" integration testing answers, "Do these components work together smoothly when combined?"

Why is Integration Testing Needed?

Even if every individual function or module passes its unit tests with 100% accuracy, they can still fail when put together. Integration testing is crucial because:

  • Data Incompatibility: One module might output data in a format or structure that the receiving module does not expect.
  • Interface
...
Continue reading "Software Testing Levels: Integration, Functional, and System" »

Essential Data Structures and Algorithms Reference

Computer science131.13 KB

Arrays and ArrayLists

Definition: A contiguous block of memory holding same-type elements, accessed by index.

  • Fixed-size array vs. dynamic ArrayList: ArrayLists auto-resize.
  • Operations: Access O(1), search O(n), insert/delete at end O(1) amortized, insert/delete at middle O(n) due to shifting.
  • When to use: Known size, frequent random access reads.
  • When NOT to use: Frequent insertions/deletions in the middle.
  • Worked example: ArrayList ops add("A"), add(1,"B"), add("C") → Array state: ["A"] → ["A", "B"] → ["A", "B", "C"].

Linked Lists

Definition: Nodes containing a value and a pointer to the next node (and previous for doubly linked).

  • Operations: Access O(n), insert at head O(1), insert at tail O(1) if tail pointer is kept, search O(n).
  • Why insert
...
Continue reading "Essential Data Structures and Algorithms Reference" »

Deadlock Prevention and Banker's Algorithm in C

Computer science2.93 KB

Dining Philosophers Deadlock Prevention

The following implementation addresses the Dining Philosophers problem using POSIX threads and semaphores. To prevent deadlock, the logic ensures that the last philosopher picks up the forks in a different order than the others.

#include <stdio.h>
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
#include <stdlib.h>

#define N 5

sem_t forkS[N];

void *philosopher(void *n)
{
    int id = *(int *)n;
    int left = id;
    int right = (id + 1) % N;

    while (1)
    {
        printf("P%d Thinking\n", id);

        fflush(stdout); // Force print immediately
        sleep(1);

        // Deadlock prevention: last philosopher picks right fork first
        if (id ==
...
Continue reading "Deadlock Prevention and Banker's Algorithm in C" »

Operating Systems Memory Management and Bash Scripting

Computer science4.74 KB

Memory Allocation Strategies

🔹 First Fit

👉 Take the first block that fits.

Example:

Blocks: 120, 450, 300, 700, 200
Processes: 250, 100, 500, 180

Step by step:

  • 250 → goes into 450 → left: 200
  • 100 → goes into 120 → left: 20
  • 500 → goes into 700 → left: 200
  • 180 → goes into 300 → left: 120

Final memory:
20, 200, 120, 200, 200


🔹 Best Fit

👉 Use the smallest block that fits.

Same example:

  • 250 → 300 → left 50
  • 100 → 120 → left 20
  • 500 → 700 → left 200
  • 180 → 200 → left 20

Final:
20, 450, 50, 200, 20

👉 Note: Causes more fragmentation (many small pieces).


🔹 Worst Fit

👉 Use the largest block.

Same example:

  • 250 → 700 → left 450
  • 100 → 450 → left 350
  • 500 → ❌ no block large enough
  • 180 → 350 → left 170

🔹 Next Fit

👉...

Continue reading "Operating Systems Memory Management and Bash Scripting" »