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

Pentium P5 Pipelining and Control Word Architecture

Computer science2.78 KB

Pentium P5 Processor Pipelining Stages

The Pentium processor, specifically the Pentium Classic (P5) architecture, featured a five-stage pipeline. The five stages of pipelining in the Pentium processor are as follows:

  1. Instruction Fetch (IF): This stage is responsible for fetching instructions from the memory. The instruction pointer determines the next instruction to be fetched, and the instruction cache is utilized to improve performance by storing frequently accessed instructions.
  2. Instruction Decode (ID): In this stage, the fetched instruction is decoded. The opcode and operands are identified, and any necessary data dependencies or control hazards are resolved.
  3. Execution (EX): The execution stage performs the actual computation or operation specified
...
Continue reading "Pentium P5 Pipelining and Control Word Architecture" »

Introduction to Operating Systems

Computer science2.21 KB

Application Software

System Software

Operating System

Why OS?

Operating System Function

OS Goals

Types of Operating Systems

  • Single Process Operating System
  • Batch-Processing Operating System
  • Multiprogramming Operating System
  • Multitasking Operating System
  • Multi-Processing Operating System
  • Distributed System
  • Real Time OS

Program

Process

Thread

Multi-tasking vs Multi-Threading

Thread Scheduling

Thread Context Switching vs Process Context Switching

User Space

Kernel

Functions of Kernel

  • Process Management
  • Memory Management
  • File Management
  • I/O Management

Type Of Kernel

  • Monolithic
  • Micro
  • Hybrid
  • Nano

System Calls

Types

  • Process Management
  • Device Management
  • File Management
  • Information Management
  • Communication Management

Firmware: SW embedded in HW (microprocessor -> microcontroller)

What

...
Continue reading "Introduction to Operating Systems" »

Essential Definitions and Theorems in Graph Theory

Computer science103.48 KB

M1: Fundamental Graph Definitions

Walks, Paths, and Circuits

Walk

A Walk is a finite alternating sequence of vertices and edges, beginning and ending with vertices, such that each edge is incident with the vertices preceding and following it. No edge appears more than once in a walk, though a vertex may appear multiple times.

  • Closed Walk: A walk that begins and ends at the same vertex.
  • Open Walk: A walk that begins and ends at different vertices.

Path

A Path is an open walk in which no vertex appears more than once. The number of edges in a path is called the length of the path. A self-loop can be included in a walk but not in a path. The terminal vertices of a path are of degree 1, and the remaining intermediate vertices are of degree 2.

Circuit

A...

Continue reading "Essential Definitions and Theorems in Graph Theory" »

Caloreats: Personalized Daily Calorie and Meal Planning

Computer science2.48 KB

Caloreats

Functionality

The goal of Caloreats is to help users control their daily calorie intake. With an intuitive menu, users can select their preferred diet (e.g., gluten-free, vegetarian, vegan) and their daily calorie target. The app then generates a personalized meal plan for the day, including breakfast, lunch, and dinner, complete with detailed nutritional information.

All recipes are provided by the Spoonacular API, which features over 2,600 ingredients and 360,000 recipes. Each recipe includes pricing, health information, nutritional analysis, images, and cooking tips.

Navigation

Upon launching the app, users are directed to the login page, which supports email or Google account authentication. Once logged in, the user is taken to the...

Continue reading "Caloreats: Personalized Daily Calorie and Meal Planning" »

OpenMP Parallel Programming: Optimization Techniques

Computer science3.13 KB

Conceptos Básicos de OpenMP

  • Flush: Ocurre cuando hay algo modificado y se escribe en la misma línea.
  • Bus Upgrade: Sucede cuando tienes un dato exclusivo y lo modificas.

Versión Secuencial con Pragma Parallel For y Reduction

int minimo(int *V, int n) {
    int i, k, i_end, i_start;
    int min = V[0];
    #pragma omp parallel for private(i_end, i_start) reduction(min:min)
    for(k = 0; k < 4; k++) {
        i_end = (k + 1) * (n / 4);
        if(k == 0) i_start = 1;
        else i_start = k * (n / 4);
        for(i = i_start; i < i_end; i++) {
            if(V[i] < min) min = V[i];
        }
    }
    return min;
}

Versión Usando Pragma OMP Task

int minimo(int *V, int N) {
    int i, k, i_end, i_start;
    int min;
    int min4[4][16]
...
Continue reading "OpenMP Parallel Programming: Optimization Techniques" »

Deep Learning Analysis and Data Management Systems

Computer science3.25 KB

DeepBase: Deep Inspection of Neural Networks

Introduction

  • Neural networks (NNs) are revolutionizing a wide range of machine intelligence tasks.
  • However, it remains unclear how and why neural networks are so effective.
  • One approach to understanding how NNs work is studying how and when neurons activate for test data; this class of analysis is called Deep Neural Inspection (DNI).

Deep Neural Inspection (DNI)

Given user-provided hypothesis logic (e.g., “detects nouns”, “detects keywords”), DNI seeks to quantify the extent that the behavior of hidden units (e.g., the magnitude or the derivative of their output) is similar to the hypothesis logic when running the model over a test set. This quantification is performed using statistical measures....

Continue reading "Deep Learning Analysis and Data Management Systems" »

Processes, Threads, and RAID Levels in Operating Systems

Computer science234.98 KB

What is a Process?

A process is a program in execution, encompassing the current values of the program counter, registers, and variables. It's an active entity with a limited lifespan, created at execution start and terminated upon completion. Processes utilize various resources like memory, disk, and printers as needed.

Process vs. Program

Process

Program

A program in execution.

A set of instructions.

Active/dynamic entity.

Passive/static entity.

Limited lifespan.

Longer lifespan (stored on disk).

Uses various resources (memory, disk, etc.).

Stored on disk, doesn't use other resources.

Has a memory address space.

Requires disk space for instructions.

Multiprogramming and the Process Model

Multiprogramming involves rapidly switching the CPU between multiple...

Continue reading "Processes, Threads, and RAID Levels in Operating Systems" »

Understanding HashMaps in Python: A Practical Example

Computer science7.43 KB

Understanding HashMaps in Python

Introduction

This document demonstrates a simple implementation of a HashMap in Python. A HashMap, also known as a hash table, is a data structure that implements an associative array abstract data type, a structure that can map keys to values. A hash function is used to compute an index into an array of buckets or slots, from which the desired value can be found.

Code Implementation

The following code provides a basic HashMap class in Python:

from random import *

class HashMap:
DEFAULT_SIZE = 4096
class item:
def __init__(self,k,v):
self.key = k
self.value = v

def __init__(self):
self.table = [None] * self.DEFAULT_SIZE
self.size = 0

def __eq__(self,
...
Continue reading "Understanding HashMaps in Python: A Practical Example" »

Java Servlet Bookstore: Cart and Checkout Logic with Hibernate

Computer science10.02 KB

LibreriaServlet: Java Servlet for an Online Bookstore


public class LibreriaServlet extends HttpServlet {


    protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


        HttpSession session = request.getSession(false);
        Almacen almacen = new Almacen();
        List<Libro> librosDisponibles = new ArrayList<Libro>();
        try {
            librosDisponibles = almacen.consultaLibrosDisponibles();
        } catch (Exception e) {
            PrintWriter out = response.getWriter();
            out.print("ERROR: " + e.getMessage());
            out.close();
        }


        if (session != null) {


            String accion = request.getParameter("Accion");


...
Continue reading "Java Servlet Bookstore: Cart and Checkout Logic with Hibernate" »

Understanding Cisco IGRP and EIGRP Protocols

Computer science3 KB

Understanding IGRP Protocol

What is IGRP?

IGRP is a Cisco-specific protocol developed in the mid-1980s.

IGRP Advantages Over RIP

IGRP calculates a composite metric from a set of route variables. It can be implemented on networks of up to 255 hops in diameter. Additional advantages include:

  • Unequal-cost load sharing
  • An update period three times longer than RIP's
  • A more efficient update packet format

Unlike RIP, which uses UDP, the IGRP process is accessed directly from the IP layer as protocol 9.

IGRP Routing and Process Domains

Using domains allows isolating communications within one domain from others. IGRP uses two types: routing domains and process domains.

  • Routing domains: Defined by Autonomous System (AS) boundaries and communicate via Exterior Gateway
...
Continue reading "Understanding Cisco IGRP and EIGRP Protocols" »