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

Thread Synchronization, Priority Inversion, and CPU Efficiency

Computer science2.18 KB

Can the Priority Inversion Problem Happen with User-Level Threads?

The priority inversion problem occurs when a low-priority process is in its critical region and suddenly a high-priority process becomes ready and is scheduled. With user-level threads, it cannot happen that a low-priority thread is suddenly preempted to allow a high-priority thread to run. There is no preemption. With kernel-level threads, this problem can arise.

Does Round-Robin Scheduling Resolve Priority Inversion?

Round-robin scheduling can resolve the issue. Sooner or later, the low-priority process will run and eventually leave its critical region. With priority scheduling, the low-priority process never gets to run at all; with round-robin, it gets a normal time slice periodically,...

Continue reading "Thread Synchronization, Priority Inversion, and CPU Efficiency" »

Python Programming Basics: Essential Code Snippets

Computer science4.07 KB

Python Fundamentals: Practical Code Examples

This document presents a collection of basic Python code snippets, demonstrating fundamental programming concepts such as conditional statements, loops, data input, and list manipulation. Each example is designed to illustrate a specific programming principle, making it ideal for beginners learning Python.

Compare Car Top Speeds with Python

This Python script compares two user-entered car speeds to determine which is faster, showcasing basic input and conditional logic.

car_a = int(input("Please enter the top speed of a Ferrari: "))
car_b = int(input("Please enter the top speed of a Lamborghini: "))

if car_a >= car_b:
    print("The fastest car is a Ferrari.")
elif car_b > car_a:
    print("The
...
Continue reading "Python Programming Basics: Essential Code Snippets" »

Concurrency Control and ER Model in Database Systems

Computer science2.2 KB

Concurrency Control in RDBMS

What are Transactions?

Transactions are sets of operations (like reading or writing data) treated as a single unit. Think of transferring money: multiple steps must happen together.

Isolation Levels

RDBMS uses isolation levels to manage how transactions interact:

  • Read Uncommitted: Transactions see changes before they're finalized, which is risky due to potential inaccuracies.
  • Read Committed: Transactions only see finalized changes, safer but still prone to inconsistencies.
  • Repeatable Read: Data remains unchanged during a transaction, preventing some issues.
  • Serializable: Transactions run sequentially, avoiding all problems but potentially slowing performance.

Concurrency Control Techniques

Techniques like locking data, timestamps,...

Continue reading "Concurrency Control and ER Model in Database Systems" »

Comprehensive Guide to HTML Headings: Types, Usage, and SEO Optimization

Computer science2.25 KB

Types of HTML Headings

HTML headings are classified into six levels, ranging from <h1> to <h6>, with <h1> representing the most important heading and <h6> the least important.

Usage of HTML Headings

Headings play a crucial role in structuring your web content and enhancing its readability. They help:

  • Organize content: Headings divide your content into logical sections, making it easier for users to navigate and understand.
  • Establish hierarchy: The different heading levels create a visual hierarchy, indicating the relative importance of each section.
  • Improve accessibility: Headings provide context and structure for screen readers, assisting users with disabilities.

SEO Optimization of HTML Headings

Headings are significant for...

Continue reading "Comprehensive Guide to HTML Headings: Types, Usage, and SEO Optimization" »

dsdfs

Computer science7.22 KB

Kako si lep danes 

What is Lorem Ipsum?

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

What is Lorem Ipsum?

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard...

Continue reading "dsdfs" »

Communication Modes, Data Circuits, OSI Stack, and Network Types

Computer science2.54 KB

Communication Modes

Operability:

  • Simplex Communication: Clearly defined transmitter and receiver functions. Transmission occurs in one direction only. Example: a TV broadcast using a single physical channel and a single unidirectional logical channel.
  • Half-Duplex Communication: Two-way communication where sender and receiver roles are interchangeable, but transmission is not simultaneous. When one device sends, the other must receive. It uses one physical channel and a bidirectional logical channel.
  • Full-Duplex Communication: Bidirectional and simultaneous communication. Sender and receiver roles are not strictly defined.

Data Circuit Components

Circuit Data:

  • Data Terminal Equipment (DTE): The source or destination of information.
  • Data Circuit-Terminating
...
Continue reading "Communication Modes, Data Circuits, OSI Stack, and Network Types" »

Dijkstra's Algorithm in C: Code & Explanation

Computer science3.5 KB

Dijkstra's Algorithm in C

This code implements Dijkstra's algorithm to find the shortest path from a source vertex to all other vertices in a graph represented as an adjacency matrix. The program reads graph data from an input.txt file and writes the results to an output.txt file.

Code Implementation


#include <stdio.h>
#include <limits.h>
#include <stdbool.h>

#define MAX_VERTICES 100

// Function to find the vertex with minimum distance
int minDistance(int dist[], bool visited[], int vertices) {
    int min = INT_MAX, min_index;

    for (int v = 0; v < vertices; v++)
        if (!visited[v] && dist[v] <= min) {
            min = dist[v];
            min_index = v;
        }

    return min_index;
}

// Dijkstra'
...
Continue reading "Dijkstra's Algorithm in C: Code & Explanation" »

SQL Aggregate Functions: COUNT, SUM, MIN, MAX, AVG

Computer science12.36 KB

Aggregations

Consider the case of sports tournaments like cricket. Players' performances are analyzed based on their batting average, the maximum number of sixes hit, the lowest score in a tournament, etc.

In such scenarios, we perform aggregations to combine multiple values into a single value, i.e., individual scores into an average score.

Let's learn more about aggregations to perform insightful analysis using the following database.

Database: The database consists of a player_match_details table that stores information about players' details in a match, such as name, match, score, year, and the number of fours and sixes scored.

Schema

12345678
player_match_details (name VARCHAR(250),match VARCHAR(10),score INTEGER,fours INTEGER,sixes INTEGER,year
...
Continue reading "SQL Aggregate Functions: COUNT, SUM, MIN, MAX, AVG" »

Key Concepts in Information Systems and Technology

Computer science5.24 KB

Expert systems

have four major components. Which of the following is not one of the four?

  • Interference motor

Major categories of E-commerce

include all of the following except which one?

  • Business to department (B2D)

Computing environment

that is always present and is capable perceive the surroundings and offer recommendations based on individual need and requirement is known as:

  • Contextual computing

AI application

includes Bots, Virtual agents, and Intelligent virtual agents. Which of the following best describes this AI technology?

  • Intelligent agents

Application used in all the functions of a business

which supports decision making throughout the organization is known as___

  • Enterprise system

Four phases of the decision-making process

in a typical organization...

Continue reading "Key Concepts in Information Systems and Technology" »

Cheat Sheets: Definition, Academic Use, and Technical Reference

Computer science3.02 KB

What is a Cheat Sheet? Definition and Terminology

A cheat sheet or crib sheet is a concise set of notes used for quick reference. The term may also be rendered as cheatsheet.

Academic Use and Exam Preparation

Cheat sheets are so named because they may be used by students without the instructor's knowledge to cheat on a test. However, in many educational settings, particularly high school or undergraduate studies, rote memorization is often less important than basic education or intense graduate studies. Therefore, students may be permitted to consult their own notes during the exam, which is not considered cheating.

The act of preparing a so-called cheat sheet is also an educational exercise. For this reason, students are typically only allowed...

Continue reading "Cheat Sheets: Definition, Academic Use, and Technical Reference" »