Skip to main content

3rd chapter

 User-Level Threads:*  

Managed by user-level libraries, not visible to the operating system.  

🔹 Faster to create and manage, but can't run in parallel on multi-core CPUs.


*Kernel-Level Threads:*  

Managed directly by the operating system kernel.  

🔹 Slower to manage but can run in parallel across multiple CPU cores.


*Real-life Example:*  

User-Level: Like tabs in a web browser managed by the browser itself.  

Kernel-Level: Like multiple apps running on your phone, each managed by the operating system.





🧵 Single-threaded Process

A single-threaded process has only one thread of execution.


It can only perform one task at a time.


If the thread is busy or waiting (e.g., for user input or a file to load), the entire process is paused.


Slower when dealing with multiple tasks.


Example:

A basic calculator app that waits for the user to press a button before performing a calculation.


🧵🧵 Multi-threaded Process

A multi-threaded process contains two or more threads.


Multiple tasks can be performed simultaneously, or at least appear to.


Threads share the same memory, so communication between them is easier.


Faster and more efficient, especially on multi-core processors.


Example:

A web browser:


One thread handles the user interface,


Another loads the page,


A third downloads images or videos — all happening concurrently.





Multithreaded programming


is a technique where a program is divided into multiple threads that run concurrently. Each thread performs a specific task, allowing the program to do many things at once. This improves performance and responsiveness, especially on multi-core systems. However, it also requires careful handling to avoid issues like race conditions and deadlocks.




A scalar processor is a type of computer chip that can do one task at a time. It handles one instruction and works on one piece of data during each step. This type of processor is simple and was used in older computers. Scalar processors are good for basic tasks, but they are not very fast when it comes to doing many things at once.


In contrast, a superscalar processor is made to handle many instructions at the same time during one clock cycle. It can do this because it has more parts inside (called execution units) that can work in parallel. It also uses special methods like pipelining and out-of-order execution to speed things up.




Intel Hyper-Threading (HT) - Simple Explanation:

Definition: Intel Hyper-Threading is a technology that allows a single physical processor core to work like two virtual cores. This means it can do two tasks at the same time, instead of just one.

Why it matters: It helps your computer run faster and smoother, especially when doing many things at once, like browsing the internet, playing games, or editing videos.


Simple Example:

Imagine a worker (processor core) at a factory. Normally, this worker can only work on one task at a time (like packing boxes).

With Hyper-Threading, the worker can now handle two packing lines at once — maybe not at full speed for both, but still much better than just one. So things get done faster!


Comments

Popular posts from this blog

Chap#10

Network topologies Definition: Network topologies define how nodes (processors/computers) are interconnected in parallel and distributed systems. The choice of topology affects performance, scalability, and cost. Key Metrics: Degree: Number of links per node. (Formula: deg = connections per node) Example: In a linear array, each node (except ends) has 2 links. Diameter: Longest shortest path between any two nodes. (Formula: diam = max distance) Example: Linear array with 8 nodes has diameter 7 (P₀ to P₇). Bisection Width: Minimum links to cut to split the network into two halves. (Formula: bw = min cuts) Example: Binary tree has bw=1 (cutting the root disconnects it).4 1. Linear Array Define : Nodes are connected one after another in a straight line. Each node (except the ends) connects to two neighbors one on the left and one on the right. Explanation : Simple to build and easy to understand, but not efficient for large networks. Long distance between farthest nodes makes comm...
Asymmetric-key algorithms are algorithms used in cryptography that use two different keys  a public key for encryption and a private key for decryption. These keys are mathematically related, but the private key cannot be easily derived from the public key. Types: RSA (Rivest–Shamir–Adleman): It uses large prime numbers to generate the key pair and supports both encryption and digital signatures DSA (Digital Signature Algorithm): DSA is primarily used for creating digital signatures, ensuring the authenticity. Symmetric-key algorithms are algorithms for cryptography that use the same cryptographic keys for both encryption of plaintext and decryption of ciphertext  Types: Stream Cipher:  Stream Cipher Converts the plain text into cipher text by taking 1 byte of plain text at a time. Block cipher: Converts the plain text into cipher text by taking plain text's block at a time DES? DES stands for Data Encryption Standard . It is a symmetric-key algorithm used to enc...

Ai Mental Health & Cyber Safety Presentation

Module A - The Normalization Engine Linguistic Challenge: Roman Urdu lacks standardized orthography (e.g., "kesa" vs "kaisa"), creating orthographic "noise" that significantly degrades the accuracy of downstream AI models. Technical Role: Acts as a Sequence-to-Sequence (Seq2Seq) transliteration and lexical normalization layer to standardize inputs before analysis. Model: A specialized transformer architecture, specifically m2m100 fine-tuned on parallel corpora or UrduParaphraseBERT. Primary Dataset: Roman-Urdu-Parl (RUP). A large-scale parallel corpus of 6.37 million sentence pairs designed to support machine transliteration and word embedding training. Link: https://arxiv.org/abs/2503.21530 Outcome: Reduces orthographic noise by achieving up to 97.44% Char-BLEU accuracy for Roman-Urdu to Urdu conversion, ensuring Module B receives high-quality "clean" data for risk analysis. Module B - Risk Stratification (BERT) Heading: The "Safety ...