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"); 
scanf("%d",&n); 
printf("enter the size of table\n"); 
scanf("%d",&m);
for(i=1,j=1;i<=m;i++,j++) 
{ 
b[j]=(n * i); 
printf("%d X %d = %d",n,i,b[j]);
Please look more at the below link.....
http://www.epistemesoft.com/Articles.aspx

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:
Signals 
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

Definition 
• 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...
http://www.epistemesoft.com/Ariticle%20more.aspx…

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.
Syntax:
int socket(int domain, int type, int protocol)

Here., Domain refers to: Socket Family
Ex:AF_UNIX,AF_INET ,AF_NETLINK etc.
Protocol refers to: The type of Protocol we want to use
Ex:TCP,UDP,ICMP etc.
Type refers to: Socket Service Type

Socket Service Types:

The following socket types are.....
http://www.epistemesoft.com/Ariticle%20more.aspx…

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......
http://www.epistemesoft.com/Ariticle%20more.aspx…

Usage of a Pointer in C

HOW TO DECLARE A POINTER ?
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 >
OR
< 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.
Process
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
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx

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 .
Function

See More at below link
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx



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
http://www.epistemesoft.com/Articles.aspx

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.
Example:
This program is used to store and access “id, name and percentage” for 3 students. Structure array

See More at below link
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx

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

See More at below link
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx

A note on Linux Signal:
-----------------------------------------------
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.
Li

See More at below link
http://www.epistemesoft.com/Articles.aspx



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
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx


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
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx

Fork and Wait System Calls and it's Programs:
-----------------------------------------------
fork()
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
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx

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. */
‪#‎include‬
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
http://www.epistemesoft.com/Articles.aspx

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
http://www.epistemesoft.com/Articles.aspx



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.
In


See More at below link
http://www.epistemesoft.com/Articles.aspx



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


More..

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.
More...

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


More...

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

More...

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.

More...

Linux Process
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.

More...

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

More...

Please look more at below link....
http://www.epistemesoft.com/Articles.aspx