≡ Menu

C Programming

Sometimes while programming, we stumble upon a condition where we want to use a value or a small piece of code many times in a code. Also there is a possibility that the in future, the piece of code or value would change. Then changing the value all over the code does not make any [...]

{ 18 comments }

While developing a program, the programmer has to keep several things in mind like the code should not be complex ie it should be maintainable, portability is another area that is to be kept in mind. So we see that there are some good practices that the programmer should follow in order to produce a [...]

{ 6 comments }

UNIX / Linux Processes: C fork() Function

Every running instance of a program is known as a process. The concept of processes is fundamental to the UNIX / Linux operating systems. A process has its own identity in form of a PID or a process ID. This PID for each process is unique across the whole operating system. Also, each process has its [...]

{ 23 comments }

In the Linux threads series, we discussed on the ways in which a thread can terminate and how the return status is passed on from the terminating thread to its parent thread. In this article we will throw some light on an important aspect known as thread synchronization. Linux Threads Series: part 1, part 2, [...]

{ 44 comments }

How to Create Linux Proc Files in C Program using LKM

Proc file system reflects the current state of Linux kernel. The current state of kernel could represent various information like the processes running on it, the hardware information, the network information etc. So this system is designed in a way that all this information can easily be accessed by the user level processes. We also [...]

{ 8 comments }

In the part-II (Thread creation and Identification) of the Linux Thread series, we discussed about thread IDs, how to compare two thread IDs and how to create a thread. In this article we will mainly focus on how a thread is terminated. Linux Threads Series: part 1, part 2, part 3 (this article). C Thread [...]

{ 18 comments }

In the part I of the Linux Threads series, we discussed various aspects related to threads in Linux. In this article we will focus on how a thread is created and identified. We will also present a working C program example that will explain how to do basic threaded programming. Linux Threads Series: part 1, [...]

{ 18 comments }

File locking is a mechanism which allows only one process to access a file at any specific time. By using file locking mechanism, many processes can read/write a single file in a safer way. In this article we’ll explore the different types of Linux file locking and understand their differences using an example program. We [...]

{ 7 comments }