18.3/20
Este repositório destina-se ao Shellium, desenvolvido no âmbito da unidade curricular de Sistemas Operativos. O projeto consiste num sistema de execução e escalonamento de comandos em ambiente UNIX, implementado em C, que separa a gestão central de tarefas da execução dos comandos submetidos pelos utilizadores.
A arquitetura é composta por dois programas. O controller é o processo central do sistema: recebe pedidos, mantém as listas de tarefas em espera e em execução, aplica a política de escalonamento selecionada, limita o número de comandos executados em simultâneo e guarda um registo da atividade. O runner é utilizado para submeter comandos, consultar o estado atual do sistema e solicitar o encerramento controlado do controlador.
A comunicação entre os processos é feita através de FIFOs. O controlador cria um FIFO público para receber pedidos e cada runner cria um FIFO privado para receber a resposta correspondente. Esta abordagem permite coordenar múltiplas submissões concorrentes, identificar cada comando pelo PID do runner e devolver informação de estado ao processo que a solicitou.
O Shellium suporta as políticas de escalonamento FCFS, RANDOM, Round Robin (RR) e Fair Switch (FS), permitindo diferentes estratégias na seleção de comandos em espera. O controlador respeita o limite de comandos concorrentes definido no arranque.
Os comandos submetidos podem incluir argumentos, pipelines e redirecionamentos. O runner interpreta a linha de comandos e executa cada etapa com processos filhos, execvp, pipes e descritores de ficheiros, suportando redirecionamentos de entrada, saída e erro. O sistema também permite consultar as tarefas em execução e agendadas, e efetuar um encerramento gracioso após a conclusão das tarefas pendentes.
O projeto inclui uma bateria de testes interativa para comparar as políticas de escalonamento, validar múltiplos comandos em paralelo, testar pipelines e redirecionamentos e consultar os registos de atividade.
Made with ❤️ by Diogo Azevedo, Andreia Carvalho & Vera Almeida
This repository is intended for Shellium, developed as part of the Operating Systems course. The project is a UNIX command execution and scheduling system written in C that separates central task management from the execution of commands submitted by users.
The architecture consists of two programs. The controller is the system's central process: it receives requests, maintains the waiting and running task lists, applies the selected scheduling policy, limits the number of concurrently running commands and records activity. The runner is used to submit commands, inspect the current system state and request a controlled shutdown of the controller.
Communication between processes is implemented with FIFOs. The controller creates a public FIFO to receive requests, while every runner creates a private FIFO to receive its corresponding response. This approach coordinates multiple concurrent submissions, identifies each command with the runner PID and returns status information to the process that requested it.
Shellium supports FCFS, RANDOM, Round Robin (RR) and Fair Switch (FS) scheduling policies, providing different strategies for selecting waiting commands. The controller observes the concurrent-command limit configured at startup.
Submitted commands may include arguments, pipelines and redirections. The runner parses the command line and executes each stage with child processes, execvp, pipes and file descriptors, supporting standard input, output and error redirections. The system can also report running and scheduled tasks, and performs a graceful shutdown once pending work has completed.
The project includes an interactive test suite for comparing scheduling policies, validating multiple commands in parallel, testing pipelines and redirections, and inspecting activity logs.
Made with ❤️ by Diogo Azevedo, Andreia Carvalho & Vera Almeida
[PT] Pode compilar o controlador e o runner através do make na raiz do projeto. A compilação gera os executáveis em bin/.
[EN] You can compile the controller and runner with make from the project root. The build generates the executables in bin/.
make[PT] Para remover os executáveis e os ficheiros temporários gerados:
[EN] To remove generated executables and temporary files:
make clean[PT] Inicie o controlador indicando o número máximo de comandos em execução simultânea e a política de escalonamento (FCFS, RANDOM, RR ou FS).
[EN] Start the controller with the maximum number of concurrently running commands and a scheduling policy (FCFS, RANDOM, RR or FS).
./bin/controller <max_commands> <FCFS|RANDOM|RR|FS>Exemplo - Example:
./bin/controller 3 RR[PT] Com o controlador em execução, utilize o runner noutro terminal para submeter um comando, consultar o estado ou pedir o encerramento controlado.
[EN] With the controller running, use the runner in another terminal to submit a command, inspect the state or request a graceful shutdown.
./bin/runner -e <user_id> <command> [args...]
./bin/runner -c
./bin/runner -sExemplos - Examples:
./bin/runner -e 1 "ls src | grep .c | wc -l > tmp/c_files.txt"
./bin/runner -c
./bin/runner -s[PT] Pode executar a bateria de testes interativa para testar as políticas de escalonamento, comandos paralelos, pipes e redirecionamentos. Requer Bash e ferramentas UNIX habituais (make, pkill, awk e grep).
[EN] You can run the interactive test suite to test scheduling policies, parallel commands, pipes and redirections. It requires Bash and common UNIX tools (make, pkill, awk and grep).
bash scripts/test_all.sh