This project emphasizes practical understanding of operating system architecture, specifically in the context of systems programming under the POSIX standard.

Source: https://github.com/seniorbeto/SO_practica2

Features

  • Custom command-line interface
  • Built-in commands (mycalc, mytime) with internal state handling
  • Execution of external programs using fork() and execvp()
  • Support for pipelining (|) and I/O redirection (<, >)
  • Basic signal management (e.g., SIGINT)
  • Background task support with &
  • Timer implementation using POSIX threads
  • Structured codebase with modular design

Architecture Overview

The architecture follows a modular design:

  • msh.c: Main entry point; handles input parsing, job control, redirections, and signal management.
  • POSIX primitives: Uses fork(), execvp(), pipe(), dup2(), waitpid(), and pthread_create() to manage execution and concurrency.
  • Internal state: The mycalc built-in command maintains internal registers with arithmetic state.
  • Timer thread: A concurrent POSIX thread tracks elapsed time for the mytime command.

Compilation

make

Requires a POSIX-compliant system (e.g., Linux or macOS) and a C compiler such as gcc.

Usage

Launch the shell by running:

./msh

Example commands:

msh> ls -l | grep msh > result.txt
msh> mycalc 5 + 3
msh> mytime

Exit with Ctrl+C or exit.

Educational Objectives

This shell was developed within the scope of a university course on Operating Systems. Its main goals are:

  • To understand the lifecycle of processes via system calls.
  • To implement shell-level features like piping, redirection, and job control.
  • To apply knowledge of concurrent programming using POSIX threads.
  • To manage signals and interrupts in a controlled environment.

Authors

See autores.txt for contributors.