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

Computer Main Memory Types: RAM and ROM Details

Computer science2.96 KB

1.3 Main Memory Fundamentals

The main memory can be defined as a device capable of storing information. This information is made up of bits, which are the basic elements of memory. A bit is the basic unit of information and can only take two values: (0 or 1). The quantity of bits of information that can be stored in a given memory defines its capacity. Main memory can be distinguished into two main groups: RAM and ROM memory.

RAM (Random Access Memory)

RAM is characterized as being very fast for reading and writing and is volatile (loses data when power is off).

RAM Divisions

  • SRAM (Static RAM): In static memory cells, the storage of information resides in a bistable state; each bit is formed by a continuous bistable order so that the information
...
Continue reading "Computer Main Memory Types: RAM and ROM Details" »

Page Replacement Algorithms and Thrashing Explained

Computer science2.49 KB

Page Replacement Algorithms

  • Random: The least efficient method, though simple to implement.
  • FIFO (First-In, First-Out): Replaces the page that has resided in real memory the longest. It is easy to implement using a list to track page order.
  • LRU (Least Recently Used): Replaces the page that has not been referenced for the longest period. It is highly effective because past behavior is often a reliable indicator of future needs.
  • NUR (Not Used Recently): Selects a victim page cyclically, specifically targeting pages that have not been accessed or modified within a recent time window.
  • LFU (Least Frequently Used): Replaces the page with the lowest reference count. This requires maintaining reference counters for each page.
  • The Clock: A variant of LRU
...
Continue reading "Page Replacement Algorithms and Thrashing Explained" »

Data Flow Diagram (DFD) Explained: Systems Analysis Essentials

Computer science11.54 KB

What Is a Data Flow Diagram (DFD)?

A Data Flow Diagram (DFD) is a graphical representation of the flow of data through an information system. A DFD can also be used to display data processing within structured design. It is common practice for a designer to draw a connection to the first-level DFD, which shows the interaction between the system and external entities. This context-level DFD is "exploded" to reveal more details of the system being modeled.

History and Purpose of DFDs

Data flow diagrams were invented by Larry Constantine, the original developer of structured design, based on the computer model of Martin and Estrin, known as the "Data flow chart." The DFD is one of three essential perspectives of the Structured Systems Analysis and

...
Continue reading "Data Flow Diagram (DFD) Explained: Systems Analysis Essentials" »

Dining Philosophers Problem: C Implementation with Pthreads

Computer science2.22 KB

C Implementation of the Dining Philosophers Problem

This program simulates the Dining Philosophers problem using C and Pthreads to demonstrate concurrency and synchronization concepts.

Global Variables

  • num_filosofos (int): Number of philosophers.
  • seed (int): Seed for random number generation.
  • holders (pthread_mutex_t*): Array of mutexes representing forks.
  • timeIni (long): Initial time in milliseconds.

Functions

long dameTiempo()

Returns the current time in milliseconds.

int eat(int n)

Simulates a philosopher eating.

  • TimeWait (long): Random wait time (0-500 ms).
  • Prints a message indicating the philosopher is eating.
  • Waits for TimeWait milliseconds.
  • Releases the left and right forks (mutexes).

int sleep(int n)

Simulates a philosopher sleeping.

  • TimeWait (long):
...
Continue reading "Dining Philosophers Problem: C Implementation with Pthreads" »

jQuery Functions and HTML Form Management

Computer science15.61 KB

jQuery Selectors

jQuery selectors are used to select and access HTML elements in a webpage. They help in finding elements so that different operations like hiding, showing, styling, and event handling can be performed easily. Selectors in jQuery are similar to CSS selectors and start with the dollar sign $().

Basic Syntax

$(selector).action();

  • $: Defines jQuery
  • selector: Selects HTML elements
  • action(): Performs operations on selected elements

Example: $("p").hide(); (This hides all paragraph elements.)

Types of jQuery Selectors

1. Element Selector

This selector selects elements based on the tag name.

Syntax: $("tagname")

Example: $("h1").hide(); (It hides all <h1> elements.)

  • Selects all elements of the same type
  • Easy to use

2. ID Selector

This selector...

Continue reading "jQuery Functions and HTML Form Management" »

Networking Fundamentals: OSI, TCP/IP, and Topologies

Computer science2.75 KB

OSI Model and Its Seven Layers

The OSI (Open Systems Interconnection) Model is a conceptual framework used to understand and standardize how different networking protocols interact and communicate. It consists of 7 layers:

  1. Physical Layer: Hardware transmission (bits).
  2. Data Link Layer: Error-free data transfer (frames).
  3. Network Layer: Path determination and IP addressing (packets).
  4. Transport Layer: End-to-end connection and reliability (segments).
  5. Session Layer: Managing communication sessions.
  6. Presentation Layer: Data translation and encryption.
  7. Application Layer: User interface and network services (HTTP, FTP).

TCP/IP Model Architecture

The TCP/IP Model is a four-layer architecture used for the modern internet.

Explanation of Two Key Layers

  • Application
...
Continue reading "Networking Fundamentals: OSI, TCP/IP, and Topologies" »

Common Types of Computer Malware Explained

Computer science6.04 KB

1. Boot Sector Virus

  • It is a type of virus which infects the master boot record (portion of the hard disk which helps to load the OS) or hard disks.
  • The infected code runs when the system is booted from an infected disk.
  • They infect at a BIOS level (BIOS checks hardware and loads the OS).
  • They use DOS commands (text-based commands used to perform tasks such as file management, disk management, and running programs) to spread to other floppy disks. Since floppy disks are rarely used now, the propagation of boot sector viruses has almost ended.
  • With the boot-sector safeguards in operating systems, boot-sector viruses can no longer infect computers.
  • This virus can infect a computer only during boot-up. Once the system has started and the OS is running,
...
Continue reading "Common Types of Computer Malware Explained" »

Essential Software Design Patterns and Testing Techniques

Computer science6.26 KB

Domain Model

  • Shows concepts only: classes, attributes, associations, and multiplicities.
  • No methods, no UI, and no controllers are included.
  • Purpose: To understand the real-world objects involved in the system.

Use Case Model (Module 6)

  • Focuses on Actor ↔ System interaction.
  • Uses the Verb + Noun naming convention.
  • Format: Defines Actor steps versus System steps.
  • Use cases serve as input for sequence diagrams, which inform class diagrams.

UML Class Diagram (Module 7)

  • Class Components: Name, attributes, and methods.
  • Association: Line connecting classes with multiplicity (1, 0..1, *, 1..*).
  • Inheritance: Represented by an open triangle arrow symbol.
  • Interface: Indicated by the «interface» stereotype.
  • DCD (Design Class Diagram): Explicitly includes methods
...
Continue reading "Essential Software Design Patterns and Testing Techniques" »

Understanding Network Switches, IP Addressing, and Key Terms

Computer science2.96 KB

Network Switches

Managed vs. Unmanaged Switches

Managed Switch: Configurable via software, supports security and communication settings. Used in large networks (enterprise, universities).

Unmanaged Switch: Fixed configuration, hardware-only, cannot be configured.

Ethernet & Speed

  1. Fast Ethernet: 100 Mbps.
  2. Gigabit Ethernet: 1 Gbps.

Ethernet Protocol

Divides data into frames, encapsulates IP addresses, performs error detection.

Ports

  1. Console Port: Connects PC/laptop to configure switch.

Communication Modes

  • Simplex (Half Duplex): One-way communication at a time.
  • Duplex (Full Duplex): Two-way communication simultaneously.

Bandwidth

  1. Maximum transmission speed of a network, determined by signal frequency range.

IP Addressing & Subnets

  1. IP Address: Identifies
...
Continue reading "Understanding Network Switches, IP Addressing, and Key Terms" »

Processor Architectures: RISC, CISC, and Micro-operations Demystified

Computer science3.23 KB

CISC: Complex Instruction Set Computer

The Complex Instruction Set Computer (CISC) architecture packs more complex instructions into the processor. Some instructions might perform several tasks in one go. This design reduces the number of instructions a programmer needs to write but makes the CPU's internal logic more complicated and potentially slower for some tasks.

  • Think: “Do more, but it might take longer.”

CISC is commonly found in x86 architectures (e.g., typical laptops or desktops), where compatibility and code density often matter more than raw efficiency.

RISC vs. CISC: Architectural Approaches

Both RISC (Reduced Instruction Set Computer) and CISC architectures aim to solve the same problem—efficient program execution—but they...

Continue reading "Processor Architectures: RISC, CISC, and Micro-operations Demystified" »