EmbLogic's Blog

Differences between threads and processes

The major differences between threads and processes are:

Threads share the address space of the process that created it; processes have their own address space.
Threads have direct access to the data segment of its process; processes have their own copy of the data segment of the parent process.
Threads can directly communicate with other threads of its process; processes must use interprocess communication to communicate with sibling processes.
Threads have almost no overhead; processes have considerable overhead.
New threads are easily created; new processes require duplication of the parent process.
Threads can exercise considerable control over threads of the same process; processes can only exercise control over child processes.
Changes to the main thread (cancellation, priority change, etc.) may affect the behavior of the other threads of the process; changes to the parent process do not affect child processes.

Posted in Uncategorized | Leave a comment

what is volatile key word in c

The proper use of C’s volatile keyword is poorly understood by many programmers. This is not surprising, as most C texts dismiss it in a sentence or two. This article will teach you the proper way to do it.

Have you experienced any of the following in your C or C++ embedded code?

Code that works fine–until you enable compiler optimizations
Code that works fine–until interrupts are enabled
Flaky hardware drivers
RTOS tasks that work fine in isolation–until some other task is spawned
If you answered yes to any of the above, it’s likely that you didn’t use the C keyword volatile. You aren’t alone. The use of volatile is poorly understood by many programmers. Unfortunately, most books about the C programming language dismiss volatile in a sentence or two.

C’s volatile keyword is a qualifier that is applied to a variable when it is declared. It tells the compiler that the value of the variable may change at any time–without any action being taken by the code the compiler finds nearby. The implications of this are quite serious. However, before we examine them, let’s take a look at the syntax.

Syntax of C’s volatile Keyword

To declare a variable volatile, include the keyword volatile before or after the data type in the variable definition. For instance both of these declarations will declare foo to be a volatile integer:

volatile int foo;
int volatile foo;
Now, it turns out that pointers to volatile variables are very common, especially with memory-mapped I/O registers. Both of these declarations declare pReg to be a pointer to a volatile unsigned 8-bit integer:

volatile uint8_t * pReg;
uint8_t volatile * pReg;
Volatile pointers to non-volatile data are very rare (I think I’ve used them once), but I’d better go ahead and give you the syntax:

int * volatile p;
And just for completeness, if you really must have a volatile pointer to a volatile variable, you’d write:

int volatile * volatile p;
Incidentally, for a great explanation of why you have a choice of where to place volatile and why you should place it after the data type (for example, int volatile * foo), read Dan Sak’s column “Top-Level cv-Qualifiers in Function Parameters” (Embedded Systems Programming, February 2000, p. 63).

Finally, if you apply volatile to a struct or union, the entire contents of the struct/union are volatile. If you don’t want this behavior, you can apply the volatile qualifier to the individual members of the struct/union.

Proper Use of C’s volatile Keyword

A variable should be declared volatile whenever its value could change unexpectedly. In practice, only three types of variables could change:

1. Memory-mapped peripheral registers

2. Global variables modified by an interrupt service routine

3. Global variables accessed by multiple tasks within a multi-threaded application

We’ll talk about each of these cases in the sections that follow.

Peripheral Registers

Embedded systems contain real hardware, usually with sophisticated peripherals. These peripherals contain registers whose values may change asynchronously to the program flow. As a very simple example, consider an 8-bit status register that is memory mapped at address 0×1234. It is required that you poll the status register until it becomes non-zero. The naive and incorrect implementation is as follows:

uint8_t * pReg = (uint8_t *) 0×1234;

// Wait for register to become non-zero
while (*pReg == 0) { } // Do something else
This will almost certainly fail as soon as you turn compiler optimization on, since the compiler will generate assembly language that looks something like this:

mov ptr, #0×1234 mov a, @ptr

loop:
bz loop
The rationale of the optimizer is quite simple: having already read the variable’s value into the accumulator (on the second line of assembly), there is no need to reread it, since the value will always be the same. Thus, in the third line, we end up with an infinite loop. To force the compiler to do what we want, we modify the declaration to:

uint8_t volatile * pReg = (uint8_t volatile *) 0×1234;
The assembly language now looks like this:

mov ptr, #0×1234

loop:
mov a, @ptr
bz loop
The desired behavior is achieved.

Subtler problems tend to arise with registers that have special properties. For instance, a lot of peripherals contain registers that are cleared simply by reading them. Extra (or fewer) reads than you are intending can cause quite unexpected results in these cases.

Interrupt Service Routines

Interrupt service routines often set variables that are tested in mainline code. For example, a serial port interrupt may test each received character to see if it is an ETX character (presumably signifying the end of a message). If the character is an ETX, the ISR might set a global flag. An incorrect implementation of this might be:

int etx_rcvd = FALSE;

void main()
{

while (!ext_rcvd)
{
// Wait
}

}

interrupt void rx_isr(void)
{

if (ETX == rx_char)
{
etx_rcvd = TRUE;
}

}
With compiler optimization turned off, this code might work. However, any half decent optimizer will “break” the code. The problem is that the compiler has no idea that etx_rcvd can be changed within an ISR. As far as the compiler is concerned, the expression !ext_rcvd is always true, and, therefore, you can never exit the while loop. Consequently, all the code after the while loop may simply be removed by the optimizer. If you are lucky, your compiler will warn you about this. If you are unlucky (or you haven’t yet learned to take compiler warnings seriously), your code will fail miserably. Naturally, the blame will be placed on a “lousy optimizer.”

The solution is to declare the variable etx_rcvd to be volatile. Then all of your problems (well, some of them anyway) will disappear.

Multithreaded Applications

Despite the presence of queues, pipes, and other scheduler-aware communications mechanisms in real-time operating systems, it is still fairly common for two tasks to exchange information via a shared memory location (that is, a global). Even as you add a preemptive scheduler to your code, your compiler has no idea what a context switch is or when one might occur. Thus, another task modifying a shared global is conceptually identical to the problem of interrupt service routines discussed previously. So all shared global variables should be declared volatile. For example, this is asking for trouble:

int cntr;

void task1(void)
{
cntr = 0;

while (cntr == 0)
{
sleep(1);
}

}

void task2(void)
{

cntr++;
sleep(10);

}
This code will likely fail once the compiler’s optimizer is enabled. Declaring cntr to be volatile is the proper way to solve the problem

Posted in Uncategorized | Leave a comment

How to use GDB with BT(Backtrace)

GDB is an essential tool for programmers to debug their code.
Breakpoints are the way to tell GDB to stop or pause the program execution at certain line, or function, or address. Once the program is stopped you can examine and change the variable values, continue the program execution from that breakpoint, etc.
Similar to breakpoints, backtrace is also helpful during debugging process to view and navigate the stack frame as explained in this tutorial

This tutorial requires some basic understanding of stack frame that we discussed in our memory layout of a process article.
C Code Example for GDB Backtrace
The following C program code example will be used in this tutorial to explain GDB backtrace.

#include
void func1();
void func2();
int main() {
int i=10;
func1();
printf(“In Main(): %d\n”,i);
}
void func1() {
int n=20;
printf(“In func1(): %d\n”,n);
func2();
}
void func2() {
int n = 30;
printf(“In func2() : %d\n”,n);
}
# cc -g stack.c

In a above code, main() will call func1() which inturn calls func2(). We will show how to examine the stack at each stage.
Getting a Backtrace in GDB
In this example, we had set a breakpoint at line number 20. So, the code stopped at func2() line 20 when we use gdb.
You can get the backtrace using ‘bt’ command as shown below.

# gdb
(gdb) file ./a.out
Reading symbols from /home/lakshmanan/a.out…done.
(gdb) b 20
Breakpoint 1 at 0×400579: file stack.c, line 20.
(gdb) run
Starting program: /home/lakshmanan/./a.out
In func1(): 20
Breakpoint 1, func2 () at stack.c:20
20 printf(“In func2() : %d\n”,n);
We already discussed how we can use GDB breakpoints to pause and continue a program execution from a particular point for debugging purpose.
From the output below, we know that currently we are in func2(), which is called by func1(), which was inturn called by main().

(gdb) bt
#0 func2 () at stack.c:20
#1 0×0000000000400568 in func1 () at stack.c:15
#2 0×0000000000400525 in main () at stack.c:9

Moving from one Frame to Another
You can move between the stack frames using ‘frame [number]’ as shown below.
In the below snippet, still the func2() is not returned, but we are able to move to frame 1 (which is func1) and examine the variable n’s value which is present inside func1().

(gdb) bt
#0 func2 () at stack.c:20
#1 0×0000000000400568 in func1 () at stack.c:15
#2 0×0000000000400525 in main () at stack.c:9
(gdb) p n
$1 = 30
(gdb) frame 1
#1 0×0000000000400568 in func1 () at stack.c:15
15 func2();
(gdb) p n
$2 = 20
In the snippet below, we have executed the next 2 instructions using ‘n 2’, and func2 is returned.
Now ‘bt’ tells you that you are currently in func1() which is called from main(), and the stack frame for func2 is gone.

(gdb) n 2
In func2() : 30
func1 () at stack.c:16
16 }
(gdb) bt
#0 func1 () at stack.c:16
#1 0×0000000000400525 in main () at stack.c:9
Get Information about a Stack Frame
You can get the information about a particular frame using ‘info frame [number]’ as shown below.

(gdb) info frame 0
Stack frame at 0x7fffffffe150:
rip = 0×400568 in func1 (stack.c:16); saved rip 0×400525
called by frame at 0x7fffffffe170
source language c.
Arglist at 0x7fffffffe140, args:
Locals at 0x7fffffffe140, Previous frame’s sp is 0x7fffffffe150
Saved registers:
rbp at 0x7fffffffe140, rip at 0x7fffffffe148

Posted in Uncategorized | Leave a comment

Interprocess communication (IPC)

IPC allows to coordinate among the different processes that are running in an operating system simultaneously. There are various IPC techniques viz. PIPE, FIFO, Shared memory, Message Queue,Threads etc.

Difference between two IPC techniques i.e, Pipe and FIFO

1) Pipe uses the internal data structure for communication between processes(it does not exists physically). But FIFO is physically present in our directory.
2) Pipe can be accessed through file descriptor which it returns while using pipe system call,But FIFO having name so, we can access and load it in to memory using its file name.
3) Pipe can be accessed to the related process only(parent -child process). But FIFO can access unrelated processes too.
4) While reading the pipe, its writing end should be closed and reverse also bears the same but in case of FIFO as many process can access the same file at a time.
5) Pipe is transient in nature i.e, it exists till the process is running but FIFO exists until one deletes it from the file system.
6) As FIFO is a file so any time we can change the file properties but it is not same as in case of pipe.

Posted in Uncategorized | Leave a comment

How to create Message Queue

The msgget() system call returns the System message queue identifier associated with the value of the key argument. A new message queue is created if key has the value  IPC_PRIVATE or key isn’t IPC_PRIVATE, no message queue with the given key exists, and  IPC_CREAT is specified in msgflg. If msgflg specifies both IPC_CREAT and IPC_EXCL and a message queue already exists for key, then msgget() fails with errno set to EEXIST. This is analogous to the effect of the combination O_CREAT | O_EXCL for open.

These header files are used:

  • #include <sys/types.h>
  • #include <sys/ipc.h>
  • #include <sys/msg.h>

Syntax: int msgget(key_t key, int msgflg);

RETURN VALUE: If successful, the return value will be the message queue identifier (a nonnegative integer), otherwise -1 with errno indicating the error.

ERRORS: On failure, errno is set to one of the following values which are given below:

  • EACCES: A message queue exists for key, but the calling process does not have  permission  to  access  the  queue,  and does not have the CAP_IPC_OWNER capability.
  • EEXIST: A message  queue  exists  for  key  and  msgflg  specified  both IPC_CREAT and IPC_EXCL.
  • ENOENT: No  message  queue  exists  for  key  and msgflg did not specify IPC_CREAT.
  • ENOMEM: A message queue has to be created but the system does  not  have enough memory for the new data structure.
  • ENOSPC: A  message  queue has to be created but the system limit for the maximum number of message queues (MSGMNI) would be exceeded.
Posted in Uncategorized | Leave a comment

Diffrence between stat,fstat and lstat

DESCRIPTION

These functions return information about a file. No permissions are required on the file itself, but — in the case of stat() and lstat() — execute (search) permission is required on all of the directories in path that lead to the file.

stat() stats the file pointed to by path and fills in buf.

lstat() is identical to stat(), except that if path is a symbolic link, then the link itself is stat-ed, not the file that it refers to.

fstat() is identical to stat(), except that the file to be stat-ed is specified by the file descriptor filedes.

All of these system calls return a stat structure, which contains the following fields:

 

struct stat {
    dev_t     st_dev;     /* ID of device containing file */
    ino_t     st_ino;     /* inode number */
    mode_t    st_mode;    /* protection */
    nlink_t   st_nlink;   /* number of hard links */
    uid_t     st_uid;     /* user ID of owner */
    gid_t     st_gid;     /* group ID of owner */
    dev_t     st_rdev;    /* device ID (if special file) */
    off_t     st_size;    /* total size, in bytes */
    blksize_t st_blksize; /* blocksize for filesystem I/O */
    blkcnt_t  st_blocks;  /* number of blocks allocated */
    time_t    st_atime;   /* time of last access */
    time_t    st_mtime;   /* time of last modification */
    time_t    st_ctime;   /* time of last status change */
};

The st_dev field describes the device on which this file resides.

The st_rdev field describes the device that this file (inode) represents.

The st_size field gives the size of the file (if it is a regular file or a symbolic link) in bytes. The size of a symlink is the length of the pathname it contains, without a trailing null byte.

The st_blocks field indicates the number of blocks allocated to the file, 512-byte units. (This may be smaller than st_size/512, for example, when the file has holes.)

The st_blksize field gives the “preferred” blocksize for efficient file system I/O. (Writing to a file in smaller chunks may cause an inefficient read-modify-rewrite.)

Not all of the Linux files systems implement all of the time fields. Some file system types allow mounting in such a way that file accesses do not cause an update of the st_atime field.

The field st_atime is changed by file accesses, e.g. by execve(2), mknod(2), pipe(2), utime(2) and read(2) (of more than zero bytes). Other routines, like mmap(2), may or may not update st_atime.

The field st_mtime is changed by file modifications, e.g. by mknod(2), truncate(2), utime(2) and write(2) (of more than zero bytes). Moreover, st_mtime of a directory is changed by the creation or deletion of files in that directory. The st_mtime field is not changed for changes in owner, group, hard link count, or mode.

The field st_ctime is changed by writing or by setting inode information (i.e., owner, group, link count, mode, etc.).

Posted in Uncategorized | Leave a comment

Print hello world without using semicolon

NOTE : Use stdio.h header file

solution 1:

#include
void main()
{
if(printf(“Hello World”))
{
}
}

solution 2:

#include
void main()
{
while(!printf(“Hello World”))
{
}
}

solution 3:

#include
void main()
{
switch(printf(“Hello World”))
{
}
}

Posted in Uncategorized | Leave a comment

Socket programming based Home Automation

The main aim of this project is to implement Socket programming using Embedded linux based boards using beagle bone as server and pc as a client. The entire electrical system like home appliances are interfaced to Server (Beagle bone black) using relay electronics system.There will be authentication system for accessing the server like user id and password which will be provided by  user through client.The enhancement of authentication system will be based on shell scripts.The user can control any appliance at any time from linux terminal.The user will run application based code which is interfaced to the Client program by providing basic authentication. An acknowledgement is also provided to user to monitor the status of the Appliance by server.The protocol used here is TCP (Transmission Control protocol)Client Server model, The Client will send the request to server.The Server process takes a request from the client. After getting a request from the client, this process will perform the required processing, gather the requested information, and send it to the requester client. The user will provide some input data by command line arguments to application Client.The beagle bone Server application will be automated after initial boot power-on with the help of bashRC Scripting.

Posted in Project 03: Client Server Communication using Linux and IPC, Project 04: FTP based Client Server using Threads and Sockets, Project 6: Client Server using Inter Process Communication Mechanism, Project 9: Embedded Linux on ARM | Tagged , , , | Leave a comment

Embedded Systems and Internet of Things

 Embedded Systems and IOT

With billions of devices expected to join the IoT over the next several years, analysts expect organizations to continue this migration away from the legacy static languages that have been traditionally used. This steady integration into the IoT will have significant impact on device design (Figure 1).

People Internet vs. Device Internet

Not surprisingly, people and embedded devices use the Internet very differently.

People make use of the Internet largely through the World Wide Web — a set of applications that run on the Internet. Of course, the Web is not the entirety of the human interface for the Internet. We also use e-mail, text messages, mobile apps, and bevy of social media tools.

In the Internet of Things, by comparison, autonomous electronic devices exchange information with each other over the Internet. But these devices do not yet have the machine equivalent of Web browsers and social media. We are at the beginning of the development of these new tools and services.

TCP/IP Protocol Stack

The TCP/IP protocol stack is at the heart of the Internet. It can be represented using the OSI seven-layer reference model, as illustrated below. The top three layers are grouped together, which simplifies the model.

TCP/IP stack reference model

Physical and Data Link Layers

The most common physical layer protocols used by embedded systems are:

  • Ethernet (10, 100, 1G)
  • WiFi (802.11b, g, n)
  • Serial with PPP (point-to-point protocol)
  • GSM, 3G, LTE, 4G

Network Layer

This is where the Internet lives. The Internet — short for Inter-Network — is named so because it provides connections between networks, between the physical layers. This is where we find the ubiquitous IP address.

Transport Layer

Above the Network layer, we find TCP and UDP, the two transport protocols.

TCP is used for most of our human interactions with the Web (e-mail, Web browsing, and so on). And so many people believe that TCP should be the only protocol used at the Transport layer. TCP provides the concept of a logical connection, acknowledgement of transmitted packets, retransmission of lost packets, and flow control.

But for an embedded system, TCP can be overkill. This is why UDP, even if it has long been relegated to network services such as DNS and DHCP, is now finding a new home in sensor acquisition and remote control.

UDP is also better suited for real-time data applications such as voice and video. The reason is that TCP’s packet acknowledgment and retransmission features are useless overhead for those applications. If a piece of data (such as a bit of spoken audio) does not arrive at its destination in time, there is no point in retransmitting the packet. It would arrive out of sequence and garble the message.

When designing your IoT device, you must consider how you will connect your local network to the Internet. You can do so via a gateway, or you can build this functionality into the device itself. Many MCUs now have an integrated Ethernet controller, which makes this an easier task.

The IoT Protocols

Can you build an IoT system with familiar Web technologies? Yes you can, although the result would not be as efficient as with the newer protocols.

HTTP(S) and Websockets are common existing standards, which can be used to deliver XML or JavaScript Object Notation (JSON) in the payload. JSON provides an abstraction layer for Web developers to create a stateful Web application with a persistent connection to a Web server.

HTTP

HTTP is the foundation of the client-server model used for the Web. The more secure method to implement HTTP is to include only a client in your IoT device, not a server. In other words, it is safer to build an IoT device that can only initiate connections, not receive. After all, you do not want to allow outside access to your local network.

WebSocket

WebSocket is a protocol that provides full-duplex communication over a single TCP connection between client and server. It is part of the HTML 5 specification. The WebSocket standard simplifies much of the complexity around bi-directional Web communication and connection management.

XMPP

XMPP (Extensible Messaging and Presence Protocol) is a good example of an existing Web technology finding new use in the IoT space.

XMPP has its roots in instant messaging and presence information. It has expanded into signaling for VoIP, collaboration, lightweight middleware, content syndication, and generalized routing of XML data. It is a contender for mass scale management of consumer white goods such as washers, dryers, refrigerators, and so on.

CoAP

Although Web protocols are available and usable for IoT devices, they are too heavy for the majority of IoT applications. The Constrained Application Protocol (CoAP) was designed by the IETF for use with low-power and constrained networks. CoAP is a RESTful protocol. It is semantically aligned with HTTP, and even has a one-to-one mapping to and from HTTP.

CoAP is a good choice of protocol for devices operating on battery or energy harvesting. Some features of CoAP:

  • CoAP uses UDP.
  • Because CoAP uses UDP, some of the TCP functions are reproduced in CoAP. For example, CoAP distinguishes between confirmable (requiring an acknowledgement) and non-confirmable messages.
  • Requests and responses are exchanged asynchronously over CoAP messages.
  • All the headers, methods and status codes are binary encoded, which reduces the protocol overhead.
  • Unlike HTTP, the ability to cache CoAP responses does not depend on the request method, but the Response Code.
  • CoAP fully addresses the need for an extremely lightweight protocol and the ability for a permanent connection. And if you have a Web background, using CoAP is relatively easy.

MQTT

MQ Telemetry Transport (MQTT) is an open source protocol for constrained devices and low-bandwidth, high-latency networks. It is a publish/subscribe messaging transport that is extremely lightweight and ideal for connecting small devices to constrained networks.

MQTT is bandwidth efficient, data agnostic, and has continuous session awareness. It helps minimize the resource requirements for your IoT device, while also attempting to ensure reliability and some degree of assurance of delivery with grades of service.

MQTT targets large networks of small devices that need to be monitored or controlled from a back-end server on the Internet. It is not designed for device-to-device transfer. Nor is it designed to “multicast” data to many receivers. MQTT is extremely simple, offering few control options.

Comparing IoT Protocols

The table below contains a summary of the IoT protocol landscape.

 
Protocol CoAP XMPP RESTful HTTP MQTT
Transport UDP TCP TCP TCP
Messaging Request/Response Publish/Subscribe Request/Response Request/Response Publish/Subscribe Request/Response
2G, 3G, 4G Suitability (1000s nodes) Excellent Excellent Excellent Excellent
LLN Suitability (1000s nodes) Excellent Fair Fair Fair
Compute Resources 10Ks RAM/Flash 10Ks RAM/Flash 10Ks RAM/Flash 10Ks RAM/Flash
Success Stories Utility Field Area Networks Remote management of consumer white goods Smart Energy Profile 2 (premise energy management, home services) Extending enterprise messaging into IoT applications

These Internet-specific IoT protocols have been developed to meet the requirements of devices with small amounts of memory, and networks with low bandwidth and high latency.

div
»
h3
Word count: 1233 Draft saved at 5:18:17 pm.
Draft Edit Edit status
Visibility: Public Edit Edit visibility
Publish immediately Edit Edit date and time

Separate tags with commas

Choose from the most used tags

Comparison of Web and IoT protocol stacks

 

Posted in Uncategorized | Leave a comment

floating point number

why the floating point number initialising with f in postfix……….

e.g.

if we take two floating point number

f1 = 0.5f;

f2 = 0.3f;

and if we print, then two different result

if( f1 == 0.5f )

{

printf(“f1 = %f\n”,f1);

printf(“True”);

}

else

printf(“False”);

//case 2

if( f2 == 0.3f )

{

printf(“f2 = %f\n”,f2);

printf(“True”);

}

else

printf(“False”);

 

the above two if case give two different result…….

understand if no just wait for next  ……

Posted in Uncategorized | Leave a comment

Hard Disk Partitioning.

Partitioning in hard disk is  of two types:

a) MBR

b) GPT

MBR refers to master boot record and is knowledge of the first sector of any hard disk that identifies how and where an operating system is located so that it can be boot (loaded) into the computer’s main storage or random access memory.

GPT refers to GUID Partition Table  is a standard for the layout of the partition table on a physical storage device used in a desktop or server PC, such as a hard disk drive or solid-state drive, using globally unique identifiers (GUID).

GPTs use logical blocking address (LBA) in place of the historical cylinder-head-sector (CHS) addressing. In a GPT, the first sector of the disk is reserved for a “protective MBR” such that booting a BIOS-based computer from a GPT disk is supported, but the bootloader and operating system must both be GPT-aware. Regardless of the sector size, the GPT header begins on the second logical block of the device

Posted in Uncategorized | Leave a comment

Head Mounted Display

Head mounted display is one of the new gadget that has taken the electronic market with a surprise .A head-mounted display (or helmet-mounted display, for aviation applications), both abbreviated HMD, is a display device, worn on the head or as part of a helmet, that has a small display optic in front of one (monocular HMD) or each eye (binocular HMD).

for eg : samsung VR headset ,oculus VR , google cardbox.

A binocular head-mounted display (HMD). A professional head-mounted display (HMD). A man controls Google Glass, a type of Optical head-mounted display, using the touchpad built into the side of the device. The Oculus Rift virtual reality headset. A HTC Vive headset.
An optical head-mounted display (OHMD) is a wearable device that has the capability of reflecting projected images as well as allowing the user to see through it that is augmented reality.
Posted in Uncategorized | Leave a comment

Installation of GCC on Windows

To install GCC on Windows, you need to install MinGW. To install MinGW, go to the MinGW
homepage, www.mingw.org, and follow the link to the MinGW download page. Download
the latest version of the MinGW installation program, which should be named MinGW-
<version>.exe.
While installing MinWG, at a minimum, you must install gcc-core, gcc-g++, binutils, and
the MinGW runtime, but you may wish to install more.
Add the bin subdirectory of your MinGW installation to your PATH environment variable,
so that you can specify these tools on the command line by their simple names.
When the installation is complete, you will be able to run gcc, g++.

Posted in Uncategorized | Leave a comment

Creating threads

We can create threads using this function:

int pthread_create(pthread_t *thread, pthread_attr_t *attr,
void*(*start_routine)(void *),
void *arg);

*thread is a pointer to new thread, it points to a location where id of new thread will be written when the thread will be created. From now on, this thread id will be used for referring to new thread.

Posted in Uncategorized | Leave a comment

GCC compilation process

14207779_240254269705421_8807735637512378221_o 14124261_240254573038724_1213731613264927479_o

Posted in Uncategorized | Leave a comment