How so1unp/lab-03-sistemas-operativos-m-a-b works
Project type and purpose
• This is a collection of four command‑line C programs for an operating‑systems laboratory:
• sigcatch.c – intercepts and prints incoming signals
• forkprio.c – creates child processes with varying priorities and coordinates their execution via signals
• sched-threads.c – spawns POSIX threads under different scheduling policies (FIFO, RR, OTHER) writing into a shared buffer
• benchmark.c – measures and compares the cost of creating processes vs threads
• There is no user‑facing GUI or networked service; each program exercises different kernel subsystems (signals, scheduling, threading, resource accounting).
File structure
• Top‑level files:
• .gitignore, .vscode – IDE and VCS configs
• Makefile – build all four executables
• README.md & Ejercicio1.md – project description, requirements, and questions
• benchmark.c, forkprio.c, sched-threads.c, sigcatch.c – source code for each lab exercise
• No “src” or “lib” directories, each C file is a standalone self-contained component.
• No external dependencies beyond libc and pthreads.
Extract insights from the README
• Each exercise description enumerates:
• Which system calls to use (sigaction, fork, setpriority, pthread_create, etc.)
• Expected program flow (how processes/threads are created, how signals are sent, how timing and output occur)
• Required output formats and the questions to answer after experimentation
Main components
a. User CLI layer
– The shell that invokes each executable with arguments
– sigcatch
– forkprio
– sched-threads
– benchmark
– Exports APIs: fork(), exec(), kill(), sigaction(), pause(), setpriority()/nice(), getpriority(), getrusage(), times(), sleep(), pthread_create(), pthread_join(), pthread_exit()
d. Kernel subsystems
– Signal Manager
– Process Scheduler
– Thread Scheduler (POSIX)
– Resource Accounting (for getrusage/times)
e. Shared data
– stdout (console) for printed output
– In-memory buffer (sched-threads only)
Relationships and interactions
• Executable -> System call interface (invoking various syscalls)
• System call interface -> Kernel subsystems (signal delivery, scheduling decisions, thread management)
• Kernel subsystems -> Executable (signal callbacks, scheduling of CPU bursts)
• Executable -> stdout (printing results)
Highlighted patterns and principles
• Single‑threaded vs multithreaded execution
• Use of signals as asynchronous callbacks
• Priority inversion and scheduler policy effects (forkprio and sched-threads)
• Benchmarking overhead of process vs thread creation
Technologies and libraries
• C99 / POSIX C standard library
• POSIX threads
• Linux kernel scheduler and signal facilities
• GNU Make for build orchestration