Operating System Fundamentals: Processes, Memory, Concurrency, Scheduling
Operating System Processes
Process View: The Illusion of Exclusivity
A process is essentially a running instance of a program. One of the key abstractions that the Operating System (OS) provides is the illusion that each process has exclusive access to the CPU and memory. However, in reality, the CPU and memory are shared among multiple processes.
How the Illusion is Created
- CPU Time Sharing: The OS rapidly switches between processes (context switching) so that it seems each process has its own CPU.
Implementing Stack, Queue, and Deque Data Structures
This document provides implementations of three fundamental data structures: Stack, Queue, and Deque. Each data structure is presented with code examples in both Python and C++, demonstrating their core functionalities using linked lists.
Stack Data Structure (LIFO)
A Stack is a Last-In, First-Out (LIFO) data structure. Elements are added and removed from the same end, often referred to as the “top” of the stack.
Python Stack Implementation
The Python implementation uses a simple Node class to build
Read MoreC Programming Examples: Data Structures & Algorithms
C Programming Examples: Data Structures and Algorithms
This document presents a collection of fundamental C programming examples, covering essential data structures and algorithms. Each section includes a C code implementation along with a brief explanation of its functionality.
1. String Length and Concatenation in C
This C program demonstrates how to calculate the length of a string and concatenate two strings without using built-in library functions like strlen()
or strcat()
. It provides a menu-
Object-Oriented Concepts and UML Diagrams Explained
Object-Oriented Concepts
Object: An object is anything that we can recognize with an identity, a state, and behavior.
Class: It is an abstraction representing a set of objects with similar behavioral characteristics.
Use Cases
Use Case: A sequence of interactions (user-software product) to meet requirements.
Actor: Anyone who needs to meet their requirements. There may be 3 types:
- Main: The one who initiates the use case and needs to fulfill its requirements.
- Partner: An actor interacting with the principal
Validação de Formulários HTML com JavaScript e Regex
Validação com Expressões Regulares (Regex)
Validar Apenas Números
Expressão regular para checar se o campo possui apenas números.
function validaApenasNumero() {
var regex = /^\d+$/;
var value = document.getElementById("name1").value;
if (regex.test(value)) {
alert("Correto");
return;
}
alert("Errado");
return;
}
Nome: Ok
Validar Apenas Letras
Expressão regular para checar se o campo possui apenas letras.
function validaApenasLetras(){
var regex = /^[a-zA-Z]+$/;
// Corrigido:
Read More
Understanding Use Cases, Object Interaction, and Domain Models
Understanding Use Cases
Use Case: A business process that begins and ends with an actor, accomplishing a business task for that actor.
Components:
- Operation: A series of actions or instructions to accomplish a step in a business process.
- Action: An indivisible act, movement, or instruction performed during an operation.
Steps in Use Case Development
- Identifying use cases: deriving use cases, actors, and subsystems.
- Rearranging use cases among subsystems.
- Constructing a traceability matrix.
- Specifying use