An Operating System requires numerous tasks to be performed at the same time. The ‘Parallel Processing’ is the term which refers to the technique of executing many tasks at the same time. However actual parallel processing is not possible in commonly available computers, but they can simulate such an effect by high speed switching of small amount of CPU time to each of the process that need to be executed. In Operating Systems this process is called ‘Scheduling’ and it helps to achieve the multitasking in an Operating System.
The Raspberrypi is a microcontroller board which is powerful enough to run large operating systems like Linux, Mac and Windows. The Raspberrypi is a microcontroller board which runs on a SoC chip from the Broadcom with ARM11 processor at the core. The Board is a mini computer itself without any input or output devices but ports provided to connect them. The Raspberrypi is called a mini-computer because the SoC has the powerful ARM11 processor which runs on 700 MHz at its core and 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. There is an Ethernet port which can be used to connect the board to a computer network.
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.
The term ‘Process’ refers to the code which is currently in execution and the term ‘thread’ refers to the small part of that code which the CPU will execute at a particular time. The fork () and execve () functions simply creates a new process from one particular process which then starts executing individually. However threading is a technique which makes different parts of the same process to execute in parallel. The following section discusses how to create a multi-threading code for blinking 8 LEDs for a Raspebrrypi board in such a way that they are being operated parallel.
There are eight general purpose IO pins on the 13*2 pin connectors of the Raspberrypi board and to each one of them a LED is connected through 1K resistor. Separate code can be written to blink the LEDs individually and made them into executable files named blink2, blink3, blink4, blink5, blink6, blink7 and blink8. The user can run any of the LED blinking programs from the command line. For example to execute the file ‘blink1’, the user can use the following command: