DEVICE DRIVER ::A device driver is a software, it’s not a hardware. A driver is a code which is completely specific to a hardware device and brings all the functionality to it. Without a driver in OS environment an application … Continue reading
The CPU is connected to memory and various other I/O devices through strips of wires called buses. These buses just take the data, address and control signals from one place to another. There are three types of buses :- #1 … Continue reading
What is the difference b/w concurrent execution and sequential execution??? I have the idea abt the sequential execution ie applications are sequentially executed.. But how Kernel modules are concurrent in execution ?? Plz elaborate.
int scull_trim(struct scull_dev *dev) -> Iterate through scull_qsets -> for(*s_q=s_d->data;s_q;s_q=next) -> In every iteration -> Free the quantums -> Finaly free the qset array -> Make pointer to qset as NULL -> Free scull_qset -> Finally initialize the default values
#define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr – offsetof(type,member) );})
When we used : register_chrdev(unsigned int major, const char *name, struct file_operations *fops); We never initialized struct cdev. Still we were very much able to call all the functions mapped in the file_operatins structure using fop. Why we have to … Continue reading
In int register_chrdev_region(dev_t first, unsigned int count,char *name); if we make count large what can go wrong.
INSTALL_DIR=modules ifneq (${KERNELRELEASE},) obj-m := new.o new_mod-objs := new.o else KERNELDIR ?= /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) default: $(MAKE) -C $(KERNELDIR) M=$(PWD) modules @rm -rf ${INSTALL_DIR} @mkdir ${INSTALL_DIR} @mv -f *.o *.ko *.mod.c .*.cmd ${INSTALL_DIR} clean: rm -rf … Continue reading
// Function To allocate bytes . // Test function for writing write operation. #include<stdio.h> #include<stdlib.h> #define SIZE 1000 char arr[SIZE]; char *p=arr; char * allocate(unsigned char ); char * allocate(unsigned char j) { if(arr+SIZE-p>j) { p=p+j; return p-j; } else … Continue reading
# The memory management algos vary from primitive bare-machine to paging and segmentation strategies. # Memory contains large array of words and bytes each having its own address. # The computer fetches the instructions from the cpu , according to … Continue reading
Today there are so many computer languages that we use, it has been long since we are using the C language. But with new languages being developed , is it that C has eventually become out dated, or there are … Continue reading