Notes, summaries, assignments, exams, and exercises for Computer science for Other courses

CPU Scheduling: Understanding Processes and Threads

Computer science5.07 KB

1. Processes

A process is a program in execution. It is a unit of work within the system. A program is a passive entity, while a process is an active one. A process needs resources to accomplish its task (CPU, memory, I/O, files). Process termination requires the reclamation of any reusable resources. A single-threaded process has one program counter, specifying the location of the next instruction to execute. The process executes instructions sequentially, one at a time, until completion. A multithreaded process has one program counter per thread. Concurrency is achieved by multiplexing the CPUs among the processes or threads.

2. Process States

As a process executes, it changes its state:

  • New: The process is being created.
  • Running: Instructions
...
Continue reading "CPU Scheduling: Understanding Processes and Threads" »

C Linked List Student Data Management Systems

Computer science14.42 KB

C Linked List Implementations for Student Data

This document presents two distinct C language implementations for managing student records using linked lists: a singly linked list and a circular linked list. Both examples demonstrate fundamental data structure operations such as adding, deleting, searching, and displaying student information.

1. Singly Linked List Implementation

This section details a student management system built using a singly linked list. Students are stored in ascending order of their roll numbers, and duplicate roll numbers are prevented.

Core Structure and Global Head

The Student structure defines the data for each node, including roll number, total marks, average, and a pointer to the next student. The head pointer always...

Continue reading "C Linked List Student Data Management Systems" »

PHP & Web Development Essentials: Core Concepts

Computer science315.08 KB

2Q==

9k=

PHP Core Concepts: Quick Answers

PHP Array Types

  • Indexed Array: A normal array with numeric keys.
  • Associative Array: An array with named keys (strings).
  • Multidimensional Array: An array containing one or more other arrays.

PHP Arithmetic Operators

  • + (Addition): Adds two operands.
  • - (Subtraction): Subtracts the second operand from the first.
  • * (Multiplication): Multiplies two operands.
  • / (Division): Divides the first operand by the second.
  • % (Modulus): Returns the remainder of a division.

Understanding PHP Abstract Classes

An abstract class in PHP is a class that cannot be directly instantiated. It may contain abstract methods that must be defined (implemented) in any child classes that inherit from it.

What is a Sticky Form?

A sticky form is a web form that...

Continue reading "PHP & Web Development Essentials: Core Concepts" »

Core Concepts in Compiler Design and Language Runtime

Computer science10.45 KB

Core Concepts in Compiler Design

Compiler

Compiler: Translates entire source code to target code before execution. It requires a full parse and upfront error checking, then executes the generated target code.

Interpreter

Interpreter: Executes source code incrementally (line-by-line or statement-by-statement). It translates and executes on the fly, and may partially execute ill-formed programs until an error is encountered.

LVar vs. x86 Architecture

LVar: Features nested expressions, implicit control flow (represented by an Abstract Syntax Tree - AST), and an unlimited number of logical variables.

x86: Characterized by flat instructions, atomic operands (registers/memory), explicit control flow (jumps), and a limited set of registers. Compilation passes...

Continue reading "Core Concepts in Compiler Design and Language Runtime" »

Client-Side Web Application Development Examples

Computer science8.49 KB

Client-Side Web Application Logic

Course Registration Script

This script handles the client-side logic for a course registration form. It fetches available courses, populates a selection dropdown, and processes form submissions to register new entries via an API.

DOM Element Selection and Initialization

The script begins by selecting necessary DOM elements for interaction and notification display.

const init = async function () {
  const selectEl = document.querySelector("select");
  const formEl = document.querySelector("form");
  const notifEl = document.querySelector(".success-notif");
  const errNotifEl = document.querySelector(".fail-notif");

Notification Dismissal Logic

Functionality to close success and error notification boxes is implemented

...

Continue reading "Client-Side Web Application Development Examples" »

TCP vs UDP: Key Differences & Protocol Characteristics

Computer science3.24 KB

Here's a breakdown of key characteristics and differences between TCP and UDP protocols:

  • TCP and UDP sockets are created by the transport layer: False
  • Before any data exchange takes place between two UDP applications, a logical connection must be established between them: False
  • Both SMTP and POP3 are TCP based: True
  • The UDP segment contains a checksum: True
  • The TCP segment contains a checksum: True
  • UDP makes use of the Selective Repeat protocol: False
  • The Selective Repeat algorithm is used for congestion control: False
  • HTTP uses TCP as its underlying transport protocol: True
  • With POP3, the email message is always deleted from the mail server if the client downloads the email message to its local email client application: False
  • Only TCP uses port numbers,
...
Continue reading "TCP vs UDP: Key Differences & Protocol Characteristics" »

ARM Processor Architecture and Design Principles

Computer science3.89 KB

ARM Family Core Architecture and Design Philosophy

ARM (Advanced RISC Machine) is a family of 32-bit/64-bit RISC processors designed for high performance, low power consumption, and efficient execution. ARM processors are widely used in embedded systems, smartphones, and IoT devices.

Components of the ARM Core Architecture

  • ARM Core: Executes instructions and performs arithmetic and logical operations. It contains registers, an ALU, and a control unit.
  • Instruction Cache: Stores frequently used instructions. It improves execution speed by reducing memory access time.
  • Data Memory / Data Cache: Stores program data and temporary variables, enabling faster data access.
  • Bus Interface: Connects the processor with memory and peripherals, transferring data
...
Continue reading "ARM Processor Architecture and Design Principles" »

Blockchain Cryptography: ECC, Hashing, and Consensus

Computer science19.16 KB

Elliptic Curve Cryptography (ECC) in Blockchain

Elliptic Curve Cryptography (ECC) is a public-key cryptography technique based on the mathematics of elliptic curves over finite fields. It is widely used in blockchain systems such as Bitcoin and Ethereum for generating secure public-private key pairs and digital signatures. The main advantage of ECC is that it provides high security with smaller key sizes, making it faster and more efficient.

The Mathematical Equation of ECC

The general equation of an elliptic curve is:

y2 = x3 + ax + b

  • a and b are constants that define the shape of the curve.
  • The curve is defined over a finite field Fₚ (where p is a prime number) for cryptographic applications.
  • To be a valid elliptic curve, it must satisfy the condition:
...
Continue reading "Blockchain Cryptography: ECC, Hashing, and Consensus" »

Cybersecurity Threat Landscape: Actors, Vectors, and Defenses

Computer science9.76 KB

🔎 Threat Actors & Their Attack Paths

Who is attacking?

Threat Actors are the people or groups launching attacks. Mnemonic: “NO HIS” (Nation-State, Organized Crime, Hacktivists, Insiders, Script Kiddies).

Actor TypeMotivationTactics
Nation-State (APT Groups)Espionage, warfareAdvanced, persistent attacks
Organized CrimeFinancial gainRansomware, phishing
HacktivistsSocial justice, ideologyWebsite defacement, data leaks
InsidersRevenge, profitData theft, sabotage
Script KiddiesFun, fameLow-skill attacks using existing tools

How do threats reach systems?

Threat Vectors are the attack paths used by threat actors. Mnemonic: “MFWDVN” (Messages, Files, Websites, Devices, Vendors, Networks).

Attack PathExampleHow It Works
Message-BasedPhishing, smishingTrick
...
Continue reading "Cybersecurity Threat Landscape: Actors, Vectors, and Defenses" »

Essential Linux Commands: A Practical Reference

Computer science3.95 KB

Essential Linux Commands

File and Directory Management

  • mkdir: Create a new directory.
  • ls: List contents of a directory.
  • rm: Remove files or directories (-r for recursive).
  • cp: Copy files or directories.
  • mv: Move or rename files or directories.
  • cat: Display file contents or create files.
  • less: View file contents one page at a time.
  • head: Display the first 10 lines of a file.
  • tail: Display the last 10 lines of a file.

System Information

  • uname: Show system information (kernel, version, etc.).
  • top: Display running processes and resource usage.
  • df: Show disk space usage.
  • df -h: Show disk usage in human-readable format.
  • free: Display memory usage (RAM and swap).

File Creation and Editing

  • touch: Create an empty file or update its timestamp.
  • echo: Write text to a file
...
Continue reading "Essential Linux Commands: A Practical Reference" »