The Raspberry pi is a mini computer which is designed in a single board with all the essential components required for running an operating system. The Raspberry pi board runs on the Broadcom controller chip which is a SoC (System on Chip). This SoC has the powerful ARM11 processor which runs on 700 MHz at its core. This powerful processor and the controller having the peripherals like timers, interrupt controller, GPIO, PCM / I2S, DMA controller, I2C, SPI slave, PWM, UART, USB, graphical processing unit (GPU) which includes VideoCore, MPEG-2 and MPEG-4 and a 512 MB SDRAM makes it a mini-computer. The Raspberrypi board is powerful enough to run large operating systems like Linux, Mac and Windows.
The Multi-tasking Operating Systems can run several processes at a time creating and effect of parallel processing with the help of the high speed processor. The Linux Operating Systems provides Multi-User-Multitasking. Linux operating systems especially Ubuntu is preferred for all kind of programming and development. The operating systems like Archlinux ARM, OpenELEC, Pidora, Raspbmc, RISC OS and the Raspbian and also Ubuntu versions are available for the Raspberrypi board.
The Raspberrypi is a board actually designed for helping computer education for remote schools but it is a nice platform for programmers especially beginners to explore various coding techniques. A Parent process can create another process, which are called the Child process and the Parent process can use signals to control the Child process. This project demonstrates the implementation of a Process system in which there is a single Parent and so many Childs and the entire systems operates on the signal received by the Parent process.
A signal is sent for the purpose of notifying the process about something that required immediate attention. Different signals are used to notify different events and the signals are differentiated by their signal numbers. The list of all the available signals in the OS and their signal numbers can be obtained using the following command:
kill -l
The following table gives a list of the most common signals that a process might encounter in an Operating System;
NAME | NUMBER | DESCRIPTION |
SIGHUP | 1 | Linux sends a process this signal when it becomes disconnected from a terminal. |
SIGINT | 2 | Linux sends a process this signal when the user tries to end it by
pressing CTRL+C. |
SIGILL | 4 | Linux sends a process this signal when it attempts to execute an illegal instruction. |
SIGABRT | 6 | Linux sends a process this signal to the process when the process calls the ‘abort ()’ function |
SIGFPE | 8 | Linux sends a process this signal when it has executed an invalid floating-point math instruction |
SIGKILL | 9 | Linux sends a process this signal to end it immediately |
SIGUSR1 | 10 | User programs can send this signal to other process |
SIGUSR2 | 12 | User programs can send this signal to other process |
SIGSEGV | 11 | Linux sends a process this signal when the program has attempted an invalid memory access |
SIGPIPE | 13 | Linux sends a process this signal when the program has attempted to access a broken data stream, such as a socket connection that has been already closed |
SIGALRM | 14 | A process can receive this signal from the Linux using the function alarm(), after a time period mentioned in its argument. |
SIGTERM | 15 | Linux sends a process this signal requesting it to terminate |
SIGCHLD | 17 | Linux sends a process this signal when a child process exits |
SIGXCPU | 24 | Linux sends a process this signal when it exceeds the limit of
CPU time that it can consume. |
SIGVTALRM | 26 | A process can receive this signal from the Linux using the function setitimer (), after a time period mentioned in its argument. |
In this project the Raspberrypi board is loaded with Ubuntu and is remotely accessed using VNC. The Raspberrypi board is also connected to the internet. There are 26 connectors which can be taken out from the connector port of the Raspberrypi board. All the connector pins are taken out using 13*2 pin female connectors and at the other end of their wire 26 pin Burg stick male connectors are attached. The Burg stick male connectors allow each pin out from the Raspberrypi board to be plugged into the holes of a breadboard. To access the pins that coming out of the Broadcom controller of the Raspberrypi board using C language, a C library is available called “bcm2835” which has been downloaded and installed.
In this project a Parent process creates so many Child process and controls them using the signal 12 which is the ‘SIGUSR2’. The two signals ‘SIGUSR1’ and the ‘SIGUSR2’ are reserved for the user applications and hence they can be used in this project also. The Parent process creates the Child processes using the fork () function. When the Parent calls the fork (), it always returns a positive value on success. The positive value which the Parent receives is the process-id of the newly created Child process. The Child process however get a value ‘0’ from the same fork () function call.
For more detail: Self Signalled Process System Using Raspberry Pi