Monday 29 October 2012


WHAT IS KERNEL, ITS FUNCTIONS, IS LINUX A KERNEL OR OS?




·        WHAT IS A KERNEL????

Hmmm….Basically we can define a Kernel is the main component of most computer operating systems. It provides an interface between applications and actual data processing at the hardware level.

Kernel is considered as the Heart of an Operating System. Kernel provides the lowest-level abstraction layer for the resources (especially processors and I/O devices) that application software must control to perform its function. It makes these facilities available to applicaton processes through Inter- Process Communication (IPC) mechanism and System Call.


TYPES OF KERNEL:
·         MONOLITHIC KERNEL,
·         MICROKERNEL, and
·         HYBRID KERNEL.

Since Linux system is having a Monolithic Kernel, so it can execute all the operating system code in the same address space to increase the performance of the system, whereas Microkernel runs most of the operating system services in user space, for example as servers, aiming to improve maintainability and modularity of the operating system.


·        BASIC FUNCTION OF KERNEL:
As we have seen above that kernel is the Engine of any Operating System, so all the vital functions should e controlled and managed by kernel itself. There are various tasks and functions of a kernel but some of the important are given below:

1.   Resource allocation- The kernel's primary function is to manage the computer's resources and allow other programs to run and use these resources. These resources are- CPU, Memory and I/O devices.


2.  Process Management- A process defines which memory portions the application can access. The main task of a kernel is to allow the execution of applications and support them with features such as hardware abstraction.
To run an application, a kernel first set up an address space for the application, then loads the file containing the application's code into memory, then set up a stack for the program and branches to a given location inside the program, thus finally starting its execution.


3.  Memory Management- The kernel has full access to the system's memory. It allows processes to safely access this memory as they require it. Virtual addressing helps kernel to create virtual partitions of memory in two disjointed areas, one is reserved for the kernel (kernael space) and the other for the applications (user space).


4.  I/O Device Management- To perform useful functions, processes need access to the peripherals connected to the computer, which are controlled by the kernel through Device Drivers. A device driver is a computer program that enables the operating system to interact with a hardware device. It provides the operating system with information of how to control and communicate with a certain piece of hardware.
A kernel maintains a list of available devices. A device manager first performs a scan on different hardware buses, such as Peripheral Component Interconnect (PCI) or Universal Serial Bus (USB), to detect installed devices, then searches for the appropriate drivers. The kernel provides the I/O to allow drivers to physically access their devices through some port or memory location.


5.  Inter- Process Communication- Kernel provides methods for Synchronization and Communication between processes called Inter- Process Communication (IPC). There are various approaches of IPC say, semaphore, shared memory, message queue, pipe (or named fifo), etc.


6.  Scheduling- In a Multitasking system, the kernel will give every program a slice of time and switch from process to process so quickly that it will appear to the user as if these processes were being executed simultaneously. The kernel uses Scheduling Algorithms to determine which process is running next and how much time it will be given. The algorithm sets priority among the processes.


7.  System Calls and Interrupt Handling- A system call is a mechanism that is used by the application program to request a service from the operating system. System calls include close, open, read, wait and write. To access the services provided by the kernel we need to invoke the related kernel functions. Most kernels provide a C Library or an API, which in turn invokes the related kernel functions.
 There are few methods by which the respective kernel function can be invoked- using Software- Simulated Interrupt, or using a Gate Call, or by using a Special System Call Instruction and by using a Memory- based Queue.


8.  Security or Protection Management- Kernel also provides protection from faults (error control) and from malicious behaviors (Security). One approach toward this can be Language based protection system, in which the kernel will only allow code to execute which has been produced by a trusted language compiler.


·        WHAT IS LINUX- a KERNEL OR an OS?????
Whenever someone talks about LINUX or Linux Systems, usually most of the times people gets confused with the name called “LINUX”. Questions may arise in one’s grey matter such as- “What the Linux actually is? “, “Whether is it a Kernel or an OS?”, and many more…..
To solve this query, firstly we need to take a look on the basic architecture of a Linux System. The figure shown below gives a simplified view of the Linux System:










Now, many times we heard that Linux is an UNIX- like operating system which basically comprises of many free and open source development software and applications but don’t get confused with this stuff. So, A LINUX is a kernel, not an Operating System (OS) because Linux Kernel handles the above mentioned functions to provide an user application access to the hardware and also, it does not constitute applications, utilities, windowing system, compiler, editors, graphical interfaces or Desktops, etc. with itself. Whereas OS includes all components like kernel, file system and applications, etc. An OS provides both User Space and Kernel Space.


If these applications and utilities get together with the Linux Kernel then they forms a bonanza package, which is known to be an operating system. For example- many distribution companies include various Applications and Utilities with Linux Kernel and make these Linux kernel based OS available to all. Some of them are- redHat, Ubuntu, Fedora, Suse, Debian, centOS, BackTrack, etc.

What is Kernel, its functions and Is Linux a kernel or an OS?

Thursday 18 October 2012

The MSP-EXP430G2 LaunchPad is an easy-to-use flash programmer and debugging tool for the MSP430G2xx microcontrollers. It features everything you need to start developing on an MSP430 microcontroller device for just 300-400 rupees. It has on-board emulation for programming and debugging and features a 14/20-pin DIP socket, on-board buttons and LEDs & BoosterPack-compatible pinouts that support a wide range of plug-in modules for added functionality such as wireless, displays & more.

In this tutorial we will see how to get starting with the msp program very first time.

step 1: First download the code composer studio. DOWNLOAD

step 2: Now install it and connect the device to the computer.

step 3: Open the code composer studio. Select the path of the workspace where you want to store your project.

step 4: Now the project window is appear. This is the entire environment in which you write the c code and dump it into the microcontroller.

                            

step 5: Go to the file menu and select new in the new option you will see various project option in which you will chose the ccs project.
                                                  file-) new -) ccs project


step 6: Give the project name and path of the location.


step 7: Now its time to select the type of the project. select the platform chose msp430.


step 8: This is an optional or additional feature if u wish to include any other project or c file so we do not need to do any thing with this just click next.

step 9: Select the Output file as EXECUTABLE and your microcontroller in this step as shown in the image below.

step 10: Now select the project templet as you are new so chose the empty project .


step 11: after the step 10 your window will look like this .


step 12: Now make new file.
                            > file-) new file

step 13: Put the new file name with extension .c.As in first program write it led_blink.c.


step 14: After the 13th step the window will look like ..


step 15: Now write your code of led blinking.  mine is in the image below.


//***********************************************************
// LED BLINK
//***********************************************************

#include <msp430g2553.h>
#define led1  BIT5
#define led2  BIT0

void main()
{
WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer
P1DIR = (led1+led2);                             // P1.0 & 6 output (red/green LEDs)
P1OUT = led1;
while(1)
{
P1OUT = 0;    // green LED on & Red LED off
_delay_cycles(500000);
P1OUT = 1;        // green LED off & RED LED ON
_delay_cycles(500000);
}
}



step 16: Now compile it by using build all in the project bar. and you can also use ctr+b
                               project-) build active project



step 17: Now launch debug button  if your device is connected with the computer it will burn your conttroller.


 step 18: Now hit the terminate button in the screen and disconnect the device and reconnect it your code will run and use these steps for your further development best of luck.

video tutorial will be coming soon.....

MSP430(LAUNCHPAD) GETTING STARTING

 
2embeddedrobotics © 2015 - Designed by Templateism.com