Virtual memory is a memory management technique that enables programs to operate under the assumption that they have access to a large, contiguous block of memory, even though physical memory may be …
Merge sort in C is a divide-and-conquer algorithm that sorts arrays by recursively dividing them into halves, sorting each half, and then merging them in a sorted manner, offering efficient and stabl…
In the complex ecosystem of the Linux operating system, drivers play a pivotal role in facilitating communication between hardware devices and the Kernel. Within the Linux Kernel, drivers can be inco…
Certainly! Below is a step-by-step flow for bringing up Raspberry Pi for Embedded Systems:
Step 1: Download Raspberry Pi Linux Source CodeVisit the official Raspberry Pi GitHub repository: git clone …
1. When a variable is preceded with the keyword static, it becomes a part of the Data Segment in the Process Context. Since the data segment is itself divided into the initialized data section and un…
The kernel plays an important role in managing USB device connections in Linux. Here's a simplified overview of the process:
1. Hardware Connection:USB device (e.g., pen drive) connects to the U…
When we aim to abstract a base class in a manner that prevents any public member function of the base class from being accessed by objects of its derived class, we use a virtual function. In a virtua…
Basically Storage class are Part of declaration Specifier that control the Linkage, Storage Duration and Memory Location.
There are basically four type of storage classautoexternregisterstaticAs all…
This is an example of code that uses the friend function to make the (d3 = 10.1 + d1) '+' operator overloading permissible.
#include
class MyClass {private: double value;
public: MyC…
A virtual function is a member function declared in a base class and redefined (overridden) by a derived class. When referencing a derived class object using a pointer or reference to the base class,…
Pipe :
Purpose: Inter-process communication (IPC) within the same system.Functionality: Unidirectional data flow, like a virtual pipeline.Descriptors: Two file descriptors, one for reading and one fo…
NULL is a macro, which is typically defined as (void *(0)), and it is used to represent a null pointer by assigning the literal 0. However, one drawback of using NULL is that it is not type-safe. In …
After converting adder() into thread function, followed by reading the request from pipe, I have to release the thread semaphore created inside the auxiliary shared memory using the sem_post but I am…
In C++, we can use references to pass and return values from functions. Let's explore this concept with an example:#include using namespace std;int& fun(int &a){ cout
Race Condition: A race condition is realized when more than one thread tries to write to the same variable simultaneously. Since we don't know which thread will access the variable first, we ca…
Let us try to understand that why we need Smart Pointers...
Consider the following codes given below :
Code-1 (Using Raw Pointer):
#include
void allocateMemory(int*& rawPtr){ // Allocate mem…
Ioctl refers to input output control, in driver we have created a routine for different ioctl command, which involve operations such as : DEVRESET, GETREGSIZE, GETDEVICESIZE, GETDATASIZE .
When we execute an elf (executable and linkable format) file which is stored in secondary storage, it is brought into the main memory (RAM) by an OS component called Loader. When a program comes into…
Why I am getting this error while opening the file in vim editor?
E325: ATTENTIONFound a swap file by the name ".long.c.swp"
owned by: akash dated: Thu Jul 13 23:15:20 2023
…
warning: implicit declaration of function ‘firstArray’; did you mean ‘getArray’? [-Wimplicit-function-declaration] 9 | ptr1=firstArray(); | ^~~~~~~~~~
what this warning …
Q- What is process context? Describe it and associated task structure in detail.Ans- Process context consists of 4 segments mainly which are:-The process starts from a low address (greater than NULL)…
Q- What is process context? Describe it and associated task structure in detail.Ans- Process context consists of 4 segments mainly which are:-
The process starts from a low address (greater than NUL…
This is the error encountered:-parameterisedConstructor.cpp: In constructor ‘Time::Time(int, int, int, int, int, int)’:
parameterisedConstructor.cpp:3:62: error: expected ‘(’ before ‘.’ token
3 |…
Iam getting this error while using cast:-
const_cast.cpp: In function ‘int main()’:
const_cast.cpp:6:15: error: expected ‘’ before ‘(’ token
const_cast.cpp:8:20: error: expected ‘’ before ‘(’ token
T…
I was executing a code given in the notes, but I thinke there's some more to add into it:-define _GNU_SOURCE
#include
#include
#include
#include
#include
#define CHILD 1
#define PARENT 2
#define…
A zombie process is created when the parent process gets executed much longer than the child, resulting in abnormal termination of child by the process having PID 1 or the init . Zombie processes mus…
Copy on write,basically implies that when a fork is done, it is assumed that the parent's VAS is copied to the process, but it is not the actual case, as if it was like that, it would be creatin…
I am working on c++ assignment 5, and am getting infinite loop there:-,here is the code for main:-#include"headers.h"
#include"declarations.h"
int main(){
Convert c1;
Convert c2(…
I was trying to convert uppercase to lowercase, but am encountering segmentation fault while executing the codeBElow is the code:-#include
#include
#include
int main(){
char a[10];
int i;
printf(&q…
printf prints to screen
when we close fd(1) - standard output
after we duplicate fd for file
how to write into duplicated fd using printf
pls suggest soln.
Process context :
Process context consists of following:
Command line arguement: This block accepts all the values passed by the programmer. It also contains environment variables.
Stack: Used for st…
Hello everyone, I was working on this code, but am not getting the desired output:-Here's the code:-getArray.c
#include"headers.h"
#include"declarations.h"
int** getArray(){
…
my code is:
-----> dataStructures.h
typedef struct node
{
int info;
struct node *next;
}Node;
------> createLL.c : // create a Linked List
#include "headers.h&…
Guys,
for using RCS
The integrity lies in the sequence of execution of these 3 steps1. ci filename (checkin filename)2. co filename (checkout filename)
3. co -l filename (checkout filename with lock)…
Iam trying running this code and though its running, but macro isn't being called.Here is the code:-void* mainMenu(void *arg)
{
int i;
#ifdef DEBUG
printf("%s: Begin.\n",__fun…
Hi everyone, Iam having an error while executing this code:-The error is:-/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/crt1.o: in function `_start':
(.text+0x24): undefined…
Iam getting this error :- /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld r…
I was trying to compile the code given in a document, which is not compiling,Here is the code:-#include
#include
typedef struct
{
int day;
int month;
int year;
}Date;
//struct date Dob;
void printDat…
Iam unable to compile my makefile, though according to me, I have entered the correct code. IF anyone can point out what Iam doing wrong,please do point out, your help will be appreciated.This is my …
Please help me with algorithms of count frequency of each elements in an array.
I am using two loop and first is store the array elements and second is compare the each elements one by one
Process context:
Process is a active
entity, it needs certain resources- including CPU time, memory files and I/O devices to accomplish its task.
Each processor
stored suffi…
@page { size: 21cm 29.7cm; margin: 2cm }
p { margin-bottom: 0.25cm; line-height: 115%; background: transparent }
Errors
in programming with C
Error
1
Because
start of no…
In a c program to replace each tab by \t , each backspace by \b , and each backslash by \\ . When press tab & backslash, it shows \t & \\ but, whenever I press backspace, it doesn't show…
In C++ sessions there was an example in which an array was resized at runtime to hold realtime data of undefined iterations, without creating any new array with bigger size and replacing as done in v…
INTRODUCTION TO SOCKET
SOCKET : It is a communication technique like pipe which has file descriptor at one end and network connections at other end .Socket is basically the first tool through which …
struct node { int val; struct node *next;}
void ReverseLinklist(struct node* start) //argument is first node pointer as start{ struct node* first,*prev; first =…
command:
tar -cvf name.tar directoryname name.tar is the name you want to choose for your compressed tar file
for untar of the tar filecommand :
tar -xvf file.tar
Sample code for Simple Alarm Here you can set timings for a Alarm [ just for fun ] you will hear a ringtone, here is the code for that
#include"headers,h" // include , , , void make_c…
#include#include#include#include#include#includetypedef struct message{ long int msg_type; char Message[100];}message;int main(){ char mymsg[] = "this is a message"; …
The gcc compiler is a portable compiler,today it runs on different platforms .its wide use going on programming.
programming in c
here are different 4 stages compilation of a program:
1.Preprocessin…
Issue:When I am trying to insert a driver module in the kernel using 'insmod' command then it failed to insert.Command Pattern: insmod char_mod.koError: insmod: Failed to load char_mod.k…
We give some arguments in called function. But is it necessary to describe those arguments in function decralation too?I mean, even without specifying the arguments in function declaration, the funct…
Hi All,
Now you can get access of all documents available on Emblogic portal on your android device
You just need to download puffin browser from google play store
i try to install the eclipse eclipse-cpp-oxygen-3a-linux-gtk-x86_64.tar.gz file and create the eclipse executable at given path using the touch commands touch /usr/bin/eclipse and also change the mo…