Friday, 11 September 2015

Embedded System Concepts

1. What is an Embedded System? Give some examples of
embedded system in daily life.

Ans. Embedded System is a system which hides a small computation unit inside. This computer is not general purpose computer like our Desktop PC but a small micro controller or microprocessor. Embedded System is designed to perform specific tasks. Best example of an Embedded System is our mobile phone which includes a processing unit or no. of processing units along with peripherals like keypad/touchpad, touch screen, LCD, Communication modules etc.
There are other examples like Electronic System in washing machine, ATM machine, front panel of Microwave oven, printers, TV, set top boxes, Remote control, Dashboard of a 4-wheeler and many more. If you observe carefully we are surrounded by a no. of embedded system and use them very frequently in our day to day life.

2. What are basic features of an Embedded System?
Ans. A good embedded system must possess following features…
• Microcontroller based
• Software driven
• Reliable
• Real time control system
• Autonomous and human interactive
• Operating on diverse physical variables
• Operating in diverse environments

3. What are various categories of an Embedded System based on complexity?
Ans. Embedded Systems can be broadly classified in three categories…
a. Small Scale – 8/16 bit CPU, little hardware, less software
complexity, no RTOS, battery operated.
b. Medium scale – 16/32 bit uC or DSPs, Complex hardware and
software design, RTOS source code engg tool, IDE.
c. Sophisticated – Configurable processors, Cutting edge applications, highly complex hardware and software design.

4. Why PC can’t be treated as an Embedded System?
Ans. Of course PC is also embedded with a processing unit but still it can not be called as an Embedded System. The reason is very clear that PC is not supposed to do a specific task. For a bank employee PC is accounting add for his work while for an engineer it is designs add. For a doctor PC helps to analyze patient reports and for children it’s more like video game or a communication system to stay connected with their friends through social networking websites. Hence PC has different applications for different people; hence it cannot be treated as an
embedded system.

5. What is difference between a PC based System and an Embedded System?
Ans. A PC based system is bulky hence difficult to be deployed specially in remote areas. For example if one wants a data logger system to monitor all the processes and events in an aircraft or on a hilly area, PC is never a suitable option. In this case an Embedded System can do the job well consuming very small space. Also PC based system are not so cost efficient and as reliable as embedded systems.

6. Ok if embedded systems are so important and popular than why PCs still exist, why can’t we use embedded systems instead of PCs?
Ans. Well PC works with operating systems and they support comprehensive cross compilers for generating executable files for embedded systems. Hence we can never ignore the importance of PCs.

7. What are the main components of an Embedded System?
see more at below link...

Wednesday, 19 August 2015

Write a program to reverse the digits of a given integer, factorial of a number, sum of digits of a given number and multiplication table ?

Write a program to reverse the digits of a given integer, factorial of a number, sum of digits of a given number and multiplication table ?
1.Program to print multiplication table
‪#‎include‬ < stdio.h > 
int main() 
int i,j,n,m; 
int a[50],b[50]; 
printf("enter the number\n"); 
printf("enter the size of table\n"); 
b[j]=(n * i); 
printf("%d X %d = %d",n,i,b[j]);
Please look more at the below link.....

Saturday, 8 August 2015

Types of IPC's in Linux

Inter-Process-Communication (or IPC for short) are mechanisms provided by the kernel to allow processes to communicate with each other. On modern systems, IPCs form the web that bind together each process within a large scale software architecture.
The Linux kernel provides the following IPC mechanisms:
Anonymous Pipes 
Named Pipes or FIFOs 
SysV Message Queues 
POSIX Message Queues 
SysV Shared memory 
POSIX Shared memory 
SysV semaphores 
POSIX semaphores 
FUTEX locks 
File-backed and anonymous shared memory using mmap 
UNIX Domain Sockets 
Netlink Sockets 
Network Sockets

Usage of Linux Signal handler

• A signal is an asynchronous event which is delivered to a process. 
• Asynchronous means that the event can occur at any time 
- may be unrelated to the execution of the process 
- E.g. user types ctrl-C or the modem hangs
Name Description Default Action 
SIGINT Interrupt character typed terminate process 
SIGQUIT Quit character typed (^\) create core image 
SIGKILL kill -9 terminate process 
SIGSEGV Invalid memory reference create core image 
SIGPIPE Write on pipe but no reader terminate process 
SIGALRM alarm() clock ‘rings’ terminate process 
SIGUSR1 user-defined signal type terminate process 
SIGUSR2 user-defined signal type terminate process
Generating a Signal 
• Use the UNIX command: 
$ kill -KILL 4481 
– send a SIGKILL signal to pid 4481 
– check 
? ps –l 
– to make sure process died 
• kill is not a good name; send....
Please look more at below link...…

Types of Linux Sockets

Sockets allow communication between two different processes on the same or different machines. To be more precise, it's a way to talk to other computers using standard Unix file descriptors. In Unix, every I/O action is done by writing or reading a file descriptor. A file descriptor is just an integer associated with an open file and it can be a network connection, a text file, a terminal, or something else.
To a programmer, a socket looks and behaves much like a low-level file descriptor. This is because commands such as read() and write() work with sockets in the same way they do with files and pipes.
Where is Socket Used?
A Unix Socket is used in a client-server application framework. A server is a process that performs some functions on request from a client. Most of the application-level protocols like FTP, SMTP, and POP3 make use of sockets to establish connection between client and server and then for exchanging data.
int socket(int domain, int type, int protocol)

Here., Domain refers to: Socket Family
Protocol refers to: The type of Protocol we want to use
Type refers to: Socket Service Type

Socket Service Types:

The following socket types are.....…

Linux Process Management

Process Descriptors:
• The kernel maintains info about each process in a 
• process descriptor, of type task_struct. 
• See include/linux/sched.h 
• Each process descriptor contains info such as run-state of process, address space, list of open files, process priority etc...
Content of Process Descriptors:
struct task_struct 
volatile long state; /* -1unrunnable, 0runnable, >0 stopped */ 
unsigned long flags; /* per process flags */ 
mm_segment_t addr_limit; /* thread address space: 0-0xBFFFFFFF for user-thread 
0-0xFFFFFFFF for kernel-thread */ 
struct exec_domain *exec_domain; 
long need_resched; 
long counter; 
long priority; 
/* SMP and runqueue state */ 
struct task_struct *next_task, *prev_task; 
struct task_struct *next_run, *prev_run; 
/* task state */ 
/* limits */ 
/* file system info */ 
/*ipc stuff */ 
/*tss for this task */ 
/*filesystem information */ 
/* open file information */ 
/* memory management info */ 
/* signal handlers */
Process State:
Consists of an array of mutually exclusive flags* 
*at least true for 2.2.x kernels.....
Look more at below link......…

Usage of a Pointer in C

A pointer is declared as : 
< pointer type > * < pointer-name > 
In the above declaration : 
1. pointer-type : It specifies the type of pointer. It can be int,char, float etc. This type specifies the type of variable whose address this pointer can store. 
2. pointer-name : It can be any name specified by the user. Professionally, there are some coding styles which every code follows. The pointer names commonly start with ‘p’ or end with ‘ptr’ 
An example of a pointer declaration can be : 
char *chptr; 
In the above declaration, ‘char’ signifies the pointer type, chptr is the name of the pointer while the asterisk ‘*’ signifies that ‘chptr’ is a pointer variable.
How to initialize a Pointer? 
A pointer is initialized in the following way : 
< pointer declaration(except semicolon) > = < address of a variable >
< pointer declaration > 
< name-of-pointer > = < address of a variable > 
Note that the type of variable above...

Embedded Systems Articles-4

Overview of Linux Process:
A Process is one of the most important fundamental concepts of the Linux operating system. This article focuses on the basics of Linux processes.
A process is an instance of a program running in Linux. This is the basic definition that you might have heard before. Though its simple enough to understand bu

See More at below link

Data Structures and it's types in C:
It is a logical way of storing data and it is also define mechanism of retrieving data. To construct an abstract software model of a collection, we start by building the formal specification. The first component of this is the name of a data type this is the type of objects that belong to the collection class. In C, we

See More at below link

Protocols used every day for Internet Browsing:
Communication on the Internet network is governed by various protocols. These protocols, or rules, spell out how the participants in various network processes should behave. Application protocol is one such protocol.
Application Protocol
Application protocols govern various processes, such as the process for download

See More at below link

Predefined and User defined Functions:
Function is a block of codes which do a specific task. When we have a large line of code, developed for a real time application we divide the program in to small blocks called functions. Every program has minimum 1 function which is our main() function. Every code starts executing from the main() function .

See More at below link

Connectionless-mode Network Protocol (CLNP):
Is an OSI protocol deployment. CLNS is the service provided by the Connectionless-mode Network Protocol (CLNP). CLNP is widely used in many telecommunications networks around the world because IS-IS (an OSI routing protocol) is mandated by the ITU-T as the protocol for management of Synchronous Digital Hierarchy (SDH)

See More at below link

Function call in C from Main:
All C functions can be called either with arguments or without arguments in a C program. These functions may or may not return values to the calling function. Now, we will see the types of calling.
1. C function with arguments (parameters) and with return value
2. C function with arguments (parameters) and without r

See More at below link

What is file transfer protocol FTP:
The file transfer protocol (FTP) is a standard network protocol used to transfer computer files from one host to another host over a TCP-based network, such as the internet
1. FTP is built on a client-server architecture and uses separate control and data connections between the clien

See More at below link

What is a Pointer in C:
C Pointer is a variable that stores/points the address of another variable.C Pointer is used to allocate memory dynamically i.e. at run time. The pointer variable might be belonging to any of the data type such as int, float, char, double, short etc.
Syntax : data_type *variableName;
Example : int *p;

See More at below link

Command to See Processes and Threads in Linux:
How do I see all running process in Linux operating systems using command line or GUI options?
You need to use the ps command. It provide information about the currently running processes, including their process identification numbers (PIDs). Both Linux and UNIX support the ps command to display information about a

See More at below link

Embedded Systems Articles-3

Dynamic Allocation and Pointer:
What Are Pointers
Pointers are basically the same as any other variable. However, what is different about them is that instead of containing actual data, they contain a pointer to the memory location where information can be found. This is a very important concept. Many programs and ideas rely on pointers as the basis

See More at below link

Array Of Structures:
C Structure is collection of different datatypes ( variables ) which are grouped together. Whereas, array of structures is nothing but collection of structures. This is also called as structure array in C.
This program is used to store and access “id, name and percentage” for 3 students. Structure array

See More at below link

Socket System Calls:
Let’s look at a call to socket() (the includes required are sys/types.h and sys/socket.h):
int socket(int domain, int type, int protocol);
A successful call to socket() returns a descriptor that will be used for end-point communication. The first argument, domain, specifies a communication domain — the protocol famil

See More at below link

While Loop:
/*C program to demonstrate the working of while loop*/
#include <stdio.h>
int main()
int number,factorial;
printf("Enter a number.\n");
while (number>0)

See More at below link

A Small notes on Internet Protocol (IP):
TCP/IP includes a wide range of protocols which are used for a variety of purposes on the network. The set of protocols that are a part of TCP/IP is called the TCP/IP protocol stack or the TCP/IP suite of protocols. The Network layer is also know as the internet layer. The internet layer is a group of internetworking m

See More at below link

Linux Process creation:
Process Descriptors:
The kernel maintains info about each process in a process descriptor, of type task_struct.
See include/linux/sched.h
Each process descriptor contains info such as run-state of process, address space, list of open files, process priority etc…
Process State:
Consists of an array of mutually ex

See More at below link

A small note on Protocol:
Application layer is the top most layer in OSI and TCP/IP layered model. This layer exists in both layered Models because of its significance, of interacting with user and user applications. This layer is for applications which are involved in communi

See More at below link

A small note on Linux Kernel:
kernel is the innermost portion of the operating system, where user interface is the outer portion. kernel is the core internal, the software that provides the basic services for all the other parts of the system, manage hardware and distributes system resources.
applications running on the system communicate with th

See More at below link

C Structure in Detail:
C Structure is a collection of different data types which are grouped together and each element in a C structure is called member.
• If you want to access structure members in C, structure variable should be declared.
• Many structure variables can be declared for same structure and memory will be allocated for each

See More at below link

C Pointers in Detail:
Pointers have many but easy concepts and they are very important to C programming. There are following few important pointer concepts which should be clear to a C programmer:
Passing pointers to functions in C:
C programming language allows you to pass a pointer to a function. To do so, simply declare the function pa

See More at below link

A note on Linux Signal:
Signals are software interrupts.
A robust program need to handle signals. This is because signals are a way to deliver asynchronous events to the application.
A user hitting ctrl+c, a process sending a signal to kill another process etc are all such cases where a process needs to do
signal handling.

See More at below link

Embedded Systems Articles-2

A simple explanation of C Loops:
Loops cause program to execute the certain block of code repeatedly until test condition is false. Loops are used in performing repetitive task in programming. Consider these scenarios:
• You want to execute some code/s 100 times.
• You want to execute some code/s certain number of times depending upon input from use
See More at below link

Simple Data Structure:
In the C language structures are used to group together different types of variables under the same name. For example you could create a structure “telephone”: which is made up of a string (that is used to hold the name of the person) and an integer (that is used to hold the telephone number).
Take a look at the exam

See More at below link

Linux Signal Explained in Detail:
Linux supports both POSIX reliable signals (hereinafter "standard signals") and POSIX real-time signals.
Signal dispositions :-
Each signal has a current disposition, which determines how the
process behaves when it is delivered the signal.
The entries in the "Action" column of the tabl

See More at below link

Linux Kernel Explained in Detail:
What is the Kernel?
A kernel is the lowest level of easily replaceable software that interfaces with the hardware in your computer. It is responsible for interfacing all of your applications that are running in “user mode” down to the physical hardware, and allowing processes, known as servers, to get information from

See More at below link

Fork and Wait System Calls and it's Programs:
We can create a new process by calling fork(). This system call duplicates the current process, creating a new entry in process table with many of the same attributes as the current process. In other words, the newly created process will be the child of the calling process (parent).
The key point to underst

See More at below link

Linked List with Example Program:
1. It is a data Structure which consists if group of nodes that forms a sequence.
2. It is very common data structure that is used to create tree,graph and other abstract data types.
Linked list comprise of group or list of nodes in which each node have link to next node to form a chain.
Linkled list Definition:

See More at below link

Usage of Linux Sockets in Programs:
Sockets are an inter-process network communication implementation using an Internet Protocol (IP) stack on an Ethernet transport. Sockets are language and protocol independent and available to "C", Perl, Python, Ruby and Java (and more) programmers. The "C" language BSD API is used on Linux, all popular variants of Uni

See More at below link

How to write a Function:

/* Write a C program to add two integers. Make a function add to add integers and display sum in main() function. */
int add(int a, int b); //function prototype(declaration)
int main(){
int num1,num2,sum;
printf("Enters two number to add\n");
scanf("%d %d",&nu

See More at below link

Algorithms Used in Data structures:
What is a data structure? What are the types of data structures?
The scheme of organizing related information is known as ‘data structure’. The types of data structure are:
Lists: A group of similar items with connectivity to the previous or/and next data items.
Arrays: A set of homogeneous values
Records: A set o

See More at below link

Linux Inter process communication ( IPC ):
Processes communicate with each other and with the kernel to coordinate their activities. Linux supports a number of Inter-Process Communication
(IPC) mechanisms. Signals and pipes are two of them but Linux also supports the System V IPC mechanisms named after the Unix TM release in which they
first appeared.

See More at below link

Monday, 3 August 2015

Embedded Systems Articles-1

Functions in C
C functions are basic building blocks in a program. All C programs are written using functions to improve re-usability, understandability and to keep track on them. You can learn below concepts of C functions in this section in detail.
1. What is C function?
2. Uses of C functions
3. C function declaration, func


Linked lists in C

This article explains the fundamentals of C linked list with an example C program.
Linked list is a dynamic data structure whose length can be increased or decreased at run time.
How linked lists are arranged in memory?
Linked list basically consists of memory blocks that are located at random memory locations.

Network Protocols
Network protocols are standard rules or conventions that govern the communications between network devices. The network devices like router and switches that follows the network protocols to communicate with each other instead of their different internal architecture. Basically the data travels in the form of packets c


Inter Process Communications ( IPC)
Processes communicate with each other and with the kernel to coordinate their activities. Linux supports a number of Inter-Process Communication (IPC) mechanisms.
Interprocess communication (IPC) is the Mechanism where one or more process can send and receive/communicate data with each other. Process may be running in


Pointers in C
Pointers are a fundamental part of C. If you cannot use pointers properly then you have basically lost all the power and flexibility that C allows. The secret to C is in its use of pointers.
C uses pointers a lot. Why?
-> It is the only way to express some computations.
-> It produces compact and efficient code.


Linux Process
Process is instance execution of a program. Linux can manage the processes in the system, each process is represented by
a task_struct data structure (task and process are terms that Linux uses interchangeably). The task vector is an array
of pointers to every task_struct data structure in the system.


Linux Kernel
The kernel is a program that constitutes the central core of a computer operating system. It has complete control over everything that occurs in the system.
1) A kernel can be contrasted with a shell (such as bash, csh or ksh in unix-like operating systems),
2) which is the outermost part of an operating system an


Please look more at below link....

Friday, 31 July 2015

UNIX/LINUX commands

1. tar command examples
Create a new tar archive.
$ tar cvf archive_name.tar dirname/
Extract from an existing tar archive.
$ tar xvf archive_name.tar
View an existing tar archive.
$ tar tvf archive_name.tar

2. grep command examples
Search for a given string in a file (case in-sensitive search).
$ grep -i "the" demo_file
Print the matched line, along with the 3 lines after it.
$ grep -A 3 -i "example" demo_text
Search for a given string in all files recursively
$ grep -r "ramesh" *

3. find command examples
Find files using file-name ( case in-sensitve find)
# find -iname "MyCProgram.c"
Execute commands on files found by the find command
$ find -iname "MyCProgram.c" -exec md5sum {} \;
Find all empty files in home directory
# find ~ -empty

4. ssh command examples
Login to remote host
ssh -l jsmith
Debug ssh client
ssh -v -l jsmith
Display ssh client version
$ ssh -V
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003

5. sed command examples
When you copy a DOS file to Unix, you could find \r\n in the end of each line. This example converts the DOS file format to Unix file format using sed command.
$sed 's/.$//' filename
Print file content in reverse order
$ sed -n '1!G;h;$p' thegeekstuff.txt
Add line number for all non-empty-lines in a file
$ sed '/./=' thegeekstuff.txt | sed 'N; s/\n/ /'

see more at below link

Tuesday, 28 July 2015

Programs to be explained in short

Programs to be explained in short
int i=3; 
case 1: printf("one"); 
‪#‎define‬ uint16 unsigned short int 
uint16 i=65; 

Saturday, 25 July 2015

Program to reverse a given string:

#‎include‬ < stdio.h > 
#include < string.h >
void ReverseString (char *String); 
char string[] = "Episteme Soft India";

One line Interview Questions on Linux Signals and Linux Process

Signal: A signal tells our program that some event has occurred
SIGINT: Interrupt signal from terminal (ctrl-c)
SIGTSTP: Stop signal from terminal (ctrl-z)
SIGCHLD: A child process has stopped or terminated

Send Signal to Process: int kill(pid_t pid, int sig)
Send Signal to Groups: int kill(pid_t gid, int sig)
One line Interview Questions on Linux Process
Process: An instance of running program
Context switching: Multiple processes run “concurrently” by time slicing
RTOS: Preemptive scheduler of OS
Process vs Threads: Threads are logical flows that run in the context of a single process.
PID: A process has its own, unique process ID: pid_t getpid();
More at below link

Friday, 24 July 2015

Precedence and Order of Evaluation and Programs

Precedence and Order of Evaluation examples
/* hirarchy operations */ 
int k;
--> 1*4+3/8+3 
--> 4+3/8+3
--> 4+0+3 
--> 7
/* hirarchy operations */ 
(abc=1.5 , big=3 ,assume g is float) 
g = 3/2+3*4/3-3+1.5/3 
= 1+12/3-3+1.5/3
Precedence and Order of Evaluation
The rules for precedence and associativity of all operators. Operators on the same line have the same precedence; rows are in order of decreasing precedence, so, for example, *, /, and % all have the same
Program to tell the given number is Even or Odd
‪#‎include‬ < stdio.h >
int number;
printf("Enter number\n"); 
scanf("%d", &number);
if(number % 2 == 0)

Program to do sum of two values using functions
#include < stdio.h >
int sumfun(int numa, int numb);
int a = 10, b = 20; 
int sum;
sum = sumfun(a, b);
All programs at below link

Thursday, 23 July 2015

Program to calculate Simple Interest

1. Program to print name four times using while loop

#include < stdio.h >

int count = 1;

while(count <= 4 )

2. Program to calculate Simple Interest

#include < stdio.h >

int princ, time, rate;
int result;

printf("Enter Principal amount:\n");

3. Program to calculate Simple Interest

#include < stdio.h >

int princ, time, rate;
int result;

printf("Enter Principal amount:\n");
printf("Enter time:\n");

4. Program to print Banner

#include < stdio.h >


All programs at below link

Saturday, 11 July 2015

Shell Scripting

A shell script is a computer program designed to be run by the Unix shell, a command line interpreter. The various dialects of shell scripts are considered to be scripting languages. Typical operations performed by shell scripts include file manipulation, program execution, and printing text.In the simplest terms, a shell script is a file containing a series of commands. The shell reads this file and carries out the commands as though they have been entered directly on the command line.

The file name should have the extension .sh

To Execute the file we have to give execution
     chmod +x
to execute
Or we can execute the file without changing the permissions, like
Let's see some examples on the shellscripting

1.#To print the user name
open a file with the name as
copy the below line to that file
echo “Hello $USER”
save and quit the file with
Esc :wq
execute the file with the command
Hello episteme

2.#to take the input from the user and print the output
echo "enter a value"
read a
#read -t 2 a :to wait for 2 sec
echo "enter b value"
read b
echo "a value: $a"
echo "b value: $b"
enter a value
enter b value
a value:1
b value:2

3.programming with command line arguments
#to print command line arguments
echo $*
#to print number of command line arguments
echo $#
#to print command line arguments
echo $@
./ 1 2 3
1 2 3
1 2 3

4.#To find to numbers are equal or not using conditional statements
echo "a value: $a"
echo "b value: $b"
if [ $a -eq $b ]
          echo "$a and $b are equal.."
           echo "$a and $b are not equal.."
Note: Here $1 and $2 are argv[1] and argv[2] respectively(command line arguments).
./ 1 2
a value: 1
b value: 2
1 and 2 are not equal..

5.#to check whether a file is existed or not
if [ -e $1 ]
             echo "file $1 is existed"
             echo "file $1 is not existed"
file existed
./ hi
file hi is not existed

6.#shell script to implement arithmetic operations using switch statement
echo "enter a value"
read a
echo "enter b value"
read b
echo -e "1:add\n2:sub\n3:mul\n"
read c
case $c in
1)echo "result: $(($a + $b))";;
2)echo "result: $(($a - $b))";;
3)echo "result: $(($a * $b))";;
enter a value
enter b value
result: 3

7.#To perform arithmetic operations
val=`expr $a + $b`
echo "a + b : $val" 

val=`expr $a - $b`
echo "a - b : $val" 

val=`expr $a \* $b`
echo "a * b : $val" 

val=`expr $b / $a`
echo "b / a : $val" 

val=`expr $b % $a`
echo "b % a : $val" 

if [ $a == $b ]
echo "a is equal to b"

if [ $a != $b ]
echo "a is not equal to b"
a + b : 30
a - b : -10
a * b : 200
b / a : 2
b % a : 0
a is not equal to b

Tuesday, 7 July 2015

Linux Interview Questions

1) What is Linux?
Linux is an operating system based on UNIX, and was first introduced by Linus Torvalds. It is based on the Linux Kernel, and can run on different hardware platforms manufactured by Intel, MIPS, HP, IBM, SPARC and Motorola. Another popular element in Linux is its mascot, a penguin figure named Tux.

2) What is Linux Kernel?
The Linux Kernel is a low-level systems software whose main role is to manage hardware resources for the user. It is also used to provide an interface for user-level interaction.

3) What is LILO?
LILO is a boot loader for Linux. It is used mainly to load the Linux operating system into main memory so that it can begin its operations.

4) What is BASH?
BASH is short for Bourne Again SHell. It was written by Steve Bourne as a replacement to the original Bourne Shell (represented by /bin/sh). It combines all the features from the original version of Bourne Shell, plus additional functions to make it easier and more convenient to use. It has since been adapted as the default shell for most systems running Linux.

5) What is a swap space?
A swap space is a certain amount of space used by Linux to temporarily hold some programs that are running concurrently. This happens when RAM does not have enough memory to hold all programs that are executing.

6) What is the basic difference between BASH and DOS?
The key differences between the BASH and DOS console lies in 3 areas:
- BASH commands are case sensitive while DOS commands are not;
- under BASH, / character is a directory separator and \ acts as an escape character. Under DOS, / serves as a command argument delimiter and \ is the directory separator
- DOS follows a convention in naming files, which is 8 character file name followed by a dot and 3 character for the extension. BASH follows no such convention.

7) What is CLI?
CLI is short for Command Line Interface. This interface allows user to type declarative commands to instruct the computer to perform operations. CLI offers an advantage in that there is greater flexibility. However, other users who are already accustom with using GUI find it difficult to remember commands including attributes that come with it.

8) What is GUI?
GUI, or Graphical User Interface, makes use of images and icons that users click and manipulate as a way of communicating with the computer. Instead of having to remember and type commands, the use of graphical elements makes it easier to interact with the system, as well as adding more attraction through images, icons and colors.

9) How can you find out how much memory Linux is using?
From a command shell, use the “concatenate” command: cat /proc/meminfo for memory usage information.

10) What are symbolic links?
Symbolic links act similarly to shortcuts in Windows. Such links point to programs, files or directories. It also allows you instant access to it without having to go directly to the entire pathname.

11) What are hard links?
Hard links point directly to the physical file on disk, and not on the path name. This means that if you rename or move the original file, the link will not break, since the link is for the file itself, not the path where the file is located.

12) Are drives such as hard drive and floppy drives represented with drive letters?
No. In Linux, each drive and device has different designations. For example, floppy drives are referred to as /dev/fd0 and /dev/fd1. IDE/EIDE hard drives are referred to as /dev/hda, /dev/hdb, /dev/hdc, and so forth.

13) What is the maximum length for a filename under Linux?
Any filename can have a maximum of 255 characters. This limit does not include the path name, so therefore the entire pathname and filename could well exceed 255 characters.

14)What are filenames that are preceded by a dot?
In general, filenames that are preceded by a dot are hidden files. These files can be configuration files that hold important data or setup info. Setting these files as hidden makes it less likely to be accidentally deleted.

Embedded Systems Training

Saturday, 4 July 2015


  • I2C is a MULTI MASTER SERIAL BUS i.e. more than one device capable of controlling the bus can be connected to it. It was invented by PHILIPS & stands for Inter-Integrated Circuit.
  • In I2C only two bi-directional lines Serial Data (SDA) & Serial Clock (SCL) are required to carry information between the devices connected to the bus.
  • Each I2C device is recognized by a unique 7-bit address. The device that initiates the communication is called MASTER.
  • The master controls the clock signal. Whereas the device being addressed by the Master is called as SLAVE.
  • Generation of clock signals on the I2C-bus is always the responsibility of master devices; each master generates its own clock signals when transferring data on the bus.
Data Transmission through I2C Bus:
Data on the I2C bus can be transferred in three modes:
1) Standard Mode: 100kbps.
2) Fast Mode: 400kbps
3) High Speed Mode: 3.4Mbps.
 The maximum number of nodes is obviously limited by the address space, and also by the total bus capacitance of 400 pf.

  • The master begins the communication by issuing the START condition followed by 7- bit unique address/Control Byte of the device it wants to access.
  • The eighth bit after the start specifies if the slave is now to receive (0) or to transmit (1). 
  • After reciving the address all IC's on the I2C bus will compare with their own address & if the address does not match, it will wait till a STOP is received.
  • If address matches a ACKNOWLEDGE signal is generated by the Slave.

  • Following receipt of the slave’s address acknowledgment, the master continues with the data transfer. If a write operationhas been ordered, the master transmits the remaining data, with the slave acknowledging receipt of each byte.
  • If the master has ordered a read operation, it releases the data line and clocks in data sent by the slave. After each byte is received, the master generates an acknowledge condition on the bus.
  • The acknowledge is omitted following receipt of the last byte. The master terminates all operations by generating a stop condition on the bus. The master may also abort a data transfer at any time by generating a stop condition.

BOTH Data & Clock lines remain high.
A HIGH to LOW transition of SDA line while the SCL is high.
A LOW to HIGH transition of SDA line while the SCL is high.
4.DATA VALID:During Data transfer, the data on must be changed during the LOW period of the clock signal i.e. the data line must remain stable whenever the clock line is HIGH. Any change in data line while clock is HIGH will be interpreted as START or STOP condition.

Each device when addressed to has to generate an acknowledge signal after the reception of each byte. The master generated an extra clock pulse which is associated with the ACKNOWLEDGE bit. The device that acknowledges pulls down the SDA line during the acknowledge clock pulse.
Embedded System Training

Saturday, 27 June 2015


Sockets allow communication between two different processes on the same or different machines. To be more precise, it's a way to talk to other computers using standard Unix file descriptors. In Unix, every I/O action is done by writing or reading a file descriptor. A file descriptor is just an integer associated with an open file and it can be a network connection, a text file, a terminal, or something else.
To a programmer, a socket looks and behaves much like a low-level file descriptor. This is because commands such as read() and write() work with sockets in the same way they do with files and pipes.
Where is Socket Used?
A Unix Socket is used in a client-server application framework. A server is a process that performs some functions on request from a client. Most of the application-level protocols like FTP, SMTP, and POP3 make use of sockets to establish connection between client and server and then for exchanging data.
int socket(int domain, int type, int protocol)
Here., Domain refers to: Socket Family
Protocol refers to: The type of Protocol we want to use
Type refers to: Socket Service Type
Socket Service Types:
The following socket types are defined,The first two are most commonly used and the last two are rarely used.
Processes are presumed to communicate only between sockets of the same type but there is no restriction that prevents communication between sockets of different types.
  • Stream Sockets(SOCK_STREAM): Delivery in a networked environment is guaranteed. If you send through the stream socket three items "A, B, C", they will arrive in the same order - "A, B, C". These sockets use TCP (Transmission Control Protocol) for data transmission. If delivery is impossible, the sender receives an error indicator. Data records do not have any boundaries.
  • Datagram Sockets(SOCK_DGRAM): Delivery in a networked environment is not guaranteed. They're connectionless because you don't need to have an open connection as in Stream Sockets - you build a packet with the destination information and send it out. They use UDP (User Datagram Protocol).
  • Raw Sockets(SOCK_RAW): These provide users access to the underlying communication protocols, which support socket abstractions. These sockets are normally datagram oriented, though their exact characteristics are dependent on the interface provided by the protocol. Raw sockets are not intended for the general user; they have been provided mainly for those interested in developing new communication protocols, or for gaining access to some of the more cryptic facilities of an existing protocol.
  • Sequenced Packet Sockets(SOCK_SEQPACKET): They are similar to a stream socket, with the exception that record boundaries are preserved. This interface is provided only as a part of the Network Systems (NS) socket abstraction, and is very important in most serious NS applications. Sequenced-packet sockets allow the user to manipulate the Sequence Packet Protocol (SPP) or Internet Datagram Protocol (IDP) headers on a packet or a group of packets, either by writing a prototype header along with whatever data is to be sent, or by specifying a default header to be used with all outgoing data, and allows the user to receive the headers on incoming packets.
    Embedded Systems Training

Thursday, 25 June 2015

TCP/IP Protocol Architecture

TCP/IP protocols map to a four-layer conceptual model known as the DARPA model , named after the U.S. government agency that initially developed TCP/IP. The four layers of the DARPA model are: Application, Transport, Internet, and Network Interface. Each layer in the DARPA model corresponds to one or more layers of the seven-layer Open Systems Interconnection (OSI) model.

Figure 1.1 shows the TCP/IP protocol architecture.

Figure 1.1 TCP/IP Protocol Architecture
Network Interface Layer
The Network Interface layer (also called the Network Access layer) is responsible for placing TCP/IP packets on the network medium and receiving TCP/IP packets off the network medium. TCP/IP was designed to be independent of the network access method, frame format, and medium. In this way, TCP/IP can be used to connect differing network types. These include LAN technologies such as Ethernet and Token Ring and WAN technologies such as X.25 and Frame Relay. Independence from any specific network technology gives TCP/IP the ability to be adapted to new technologies such as Asynchronous Transfer Mode (ATM).
The Network Interface layer encompasses the Data Link and Physical layers of the OSI model. Note that the Internet layer does not take advantage of sequencing and acknowledgment services that might be present in the Data-Link layer. An unreliable Network Interface layer is assumed, and reliable communications through session establishment and the sequencing and acknowledgment of packets is the responsibility of the Transport layer.

Internet Layer
The Internet layer is responsible for addressing, packaging, and routing functions. The core protocols of the Internet layer are IP, ARP, ICMP, and IGMP.
  • The Internet Protocol (IP) is a routable protocol responsible for IP addressing, routing, and the fragmentation and reassembly of packets.
  • The Address Resolution Protocol (ARP) is responsible for the resolution of the Internet layer address to the Network Interface layer address such as a hardware address.
  • The Internet Control Message Protocol (ICMP) is responsible for providing diagnostic functions and reporting errors due to the unsuccessful delivery of IP packets.
  • The Internet Group Management Protocol (IGMP) is responsible for the management of IP multicast groups.
The Internet layer is analogous to the Network layer of the OSI model.

Transport Layer
The Transport layer (also known as the Host-to-Host Transport layer) is responsible for providing the Application layer with session and datagram communication services. The core protocols of the Transport layer are Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP).
  • TCP provides a one-to-one, connection-oriented, reliable communications service. TCP is responsible for the establishment of a TCP connection, the sequencing and acknowledgment of packets sent, and the recovery of packets lost during transmission.
  • UDP provides a one-to-one or one-to-many, connectionless, unreliable communications service. UDP is used when the amount of data to be transferred is small (such as the data that would fit into a single packet), when the overhead of establishing a TCP connection is not desired or when the applications or upper layer protocols provide reliable delivery.
The Transport layer encompasses the responsibilities of the OSI Transport layer and some of the responsibilities of the OSI Session layer.

Application Layer
The Application layer provides applications the ability to access the services of the other layers and defines the protocols that applications use to exchange data. There are many Application layer protocols and new protocols are always being developed.
The most widely-known Application layer protocols are those used for the exchange of user information:
  • The Hypertext Transfer Protocol (HTTP) is used to transfer files that make up the Web pages of the World Wide Web.
  • The File Transfer Protocol (FTP) is used for interactive file transfer.
  • The Simple Mail Transfer Protocol (SMTP) is used for the transfer of mail messages and attachments.
  • Telnet, a terminal emulation protocol, is used for logging on remotely to network hosts.
Additionally, the following Application layer protocols help facilitate the use and management of TCP/IP networks:
  • The Domain Name System (DNS) is used to resolve a host name to an IP address.
  • The Routing Information Protocol (RIP) is a routing protocol that routers use to exchange routing information on an IP internetwork.
  • The Simple Network Management Protocol (SNMP) is used between a network management console and network devices (routers, bridges, intelligent hubs) to collect and exchange network management information.
Examples of Application layer interfaces for TCP/IP applications are Windows Sockets and NetBIOS