Notes, summaries, assignments, exams, and exercises for Computer science for Vocational training

Implementing System V Message Queues and Semaphores in C

Computer science1.76 KB

PROGRAMA_ESCRITOR_COLA: IPC Implementation

The PROGRAMA_ESCRITOR_COLA reads an 80-character maximum name, an address, and a salary (long integer) until the word "FIN" is entered in the name field. This information is placed into a message queue along with a user-defined message type. While this program runs, it prevents other processes from accessing the message queue. Upon completion, the system allows up to two processes to simultaneously access the queue to extract messages.

Data Structure Definition

struct employee {
    long type;
    char name[80];
    char dir[80];
    long salary;
};

Implementation Logic

The program initializes the IPC mechanisms using ftok, semget, and msgget. It uses semaphores to ensure exclusive access during the writing...

Continue reading "Implementing System V Message Queues and Semaphores in C" »

Componentes y Arquitectura de la Placa Base: Guía Técnica del Ordenador

Computer science21.16 KB

Componentes del ordenador

Software: Mi material no forma parte del sistema. Hardware: el material visible del ordenador y los periféricos que pueden conectarse.

Computer Science: Mi computadora obtiene resultados que pueden manejar la antisintetización y la lógica. La información que obtengo transforma el resultado.

Arquitectura de Von Neumann

La estructura de un ordenador configurado por Von Neumann centraliza sus componentes en la CPU. La UAL (Unidad Aritmético-Lógica) y la UC (Unidad de Control) se conectan con la CPU.

  • Elementos periféricos: se encuentran dentro de la caja, o conectados a las estructuras.
  • Periféricos de salida: elementos como el monitor del ordenador.
  • Periféricos de entrada: elementos introducidos en el ordenador.

Von Neumann...

Continue reading "Componentes y Arquitectura de la Placa Base: Guía Técnica del Ordenador" »

Digital Switching Systems: Architecture and Network Functions

Computer science2.49 KB

Digital Switching Systems Architecture

Modules with analog connection to the outside of the node:

  • User module analog
  • Analog trunk module (obsolete)

Modules with digital connection to the outside of the node:

  • Digital user module
  • Indirect user module
  • Liaison with other operators
  • Multiprotocol access module
  • Digital links module
  • Data link module
  • Power module
  • Interconnection satellite module
  • Connection with special networks
  • Common channel module

Modules outside the offline node:

  • Service circuit module
  • Peripheral maintenance module
  • User clock module

For final sets, auxiliary control elements are used. This signal differs from the MIC signal by using 16 bits per channel instead of 8, resulting in double the speed.

Communication Paths

  • Local exchange: User module initiates
...
Continue reading "Digital Switching Systems: Architecture and Network Functions" »

Prova de Conexão Java com SQL Server: Busca de Nome e Idade

Computer science3.15 KB

Conexão

public DataBase() {

this.setDatabase("PROVA");

this.setUrl("jdbc:sqlserver://localhost:1433;databaseName=" + this.getDatabase());

this.setUsername("sa");

this.setPassword("sa@12345");

this.setDriver("com.microsoft.sqlserver.jdbc.SQLServerDriver");

Usuário DAO

public class UsuarioDAO {

Usuario user;

public UsuarioDAO(Usuario user) {

this.user = user;

}

public static String BuscarNome(int codusuario) {

DataBase db = new DataBase();

db.openConnectionDB();

String query = "SELECT nome as result FROM USUARIO WHERE codusuario = " + codusuario;

String resp = db.exeSQL(query);

db.closeConnectionDB();

return resp;

}

public static String BuscarIdade(int codusuario)

...

Continue reading "Prova de Conexão Java com SQL Server: Busca de Nome e Idade" »

Review c + +

Computer science2.96 KB

/ * Multiplication table * / # include void main () (int n, cont, prod; do (printf ( "Enter a positive integer:") scanf ( "% i", & n);) while (n < 0); cont = 1 while (cont <= 10) (prod = n * cont; printf ( "\ n% i *% i =% i", n, cont, prod); cont + + / * cont = cont +1 * /))

/ * Multiple of 3 * / # include void main () (int A, B; printf ( "enter any number:") scanf ( "% d", & A), B = A, while (A> = 3) (A = A-3;) if (A == 0) (printf ( "% d is a multiple of 3", B);) else (printf ( "% d is not a multiple of 3", B);))

/ * Sum the first hundred numbers from N * / # include void main () (int N, cont, sum; do (printf ( "Enter a positive number") scanf ( "% i", & N);) while (N <0); cont = N; sum = N while (cont <100) (sum...

Continue reading "Review c + +" »

Process Management in Operating Systems: Scheduling, States, and Context Switch

Computer science38.54 KB

Process Management — Operating Systems Exercises

1 — Batch vs Interactive and Monoprogramming vs Multiprogramming

Question: Analyze the differences between:

  • Batch processes and interactive processes.
  • Monoprogramming and multiprogramming.
  • Compare the text graphs (process management — figures 9.5 and 9.7) and establish similarities and differences.
  • When we speak of the process (program execution), do we refer to batch processes, interactive, or both?
  • What is the difference between simultaneous execution and concurrent execution?

Answer:

  • Batch processes are executed without interactive user input during execution; jobs are collected and run by the system. Interactive processes require user interaction (e.g., a shell session, GUI application).
  • Monoprogramming
...
Continue reading "Process Management in Operating Systems: Scheduling, States, and Context Switch" »

Understanding Network Server Types and Configuration Commands

Computer science2.5 KB

Types of Network Servers

One way to organize a network is by favoring at least one computer, giving it added capabilities in the form of services. These are called servers.

The remaining computers are called clients, which request services from these servers. The servers specialize in the functions for which they were designed, creating a centralized network that is easier to administer by incorporating a system of user accounts and passwords that restrict access.

There are many types of servers:

File Servers

These servers are available to users for their disk storage capacity. They usually have terabytes of capacity and tend to feature redundant storage systems and UPS units.

Print Servers

A dedicated server used to manage and control a specific...

Continue reading "Understanding Network Server Types and Configuration Commands" »

SQL Queries for Course, Faculty, and Student Database Management

Computer science2.25 KB

/* #1 */
SELECT * FROM curso;
ALTER TABLE curso ADD horas INT DEFAULT(30);

/* #2 */
UPDATE curso SET horas=60 WHERE cred=6;

/* #3 */
DELETE FROM curso
-- SELECT * FROM curso
WHERE cno NOT IN(SELECT cno FROM clase)
AND cdept IN(SELECT dept FROM departamento AS d1 WHERE ddespacho=
(SELECT MIN(ddespacho) FROM departamento WHERE dedif=d1.dedif));

SELECT * FROM curso;

/* #6 */

SELECT * FROM claustro;

INSERT INTO claustro
SELECT * FROM (SELECT MAX(fno)+1 FROM claustro) AS t1
CROSS JOIN
(SELECT enombre FROM persona1 WHERE enombre REGEXP "^...[aeiou]" AND enombre NOT REGEXP "[aeiou]$") AS t2
CROSS JOIN
(SELECT fdomi, ffcanti, fnumdep, fsueldo FROM claustro AS c1 WHERE fsueldo >
(SELECT AVG(fsueldo) FROM claustro WHERE fdept=c1.fdept)
AND fnumdep >...

Continue reading "SQL Queries for Course, Faculty, and Student Database Management" »