Where does the Kmalloc/Vmalloc/get_free_pages/malloc Allocates memory?
Can any one help me and clarrify the below points:
1) Where does the Kmalloc/Vmalloc/get_free_pages/malloc Allocates memory in which space is it Kernel/User? 2) Coming to Hardware Point of View is where Kernel/User Space Memory Allocates is it in RAM or any.? 3) In Device Drivers, how Open Call get to know whether the hardware is connected/not? Thanks in Adavance... |
1) kmalloc/vmalloc/get_free_pages are used in module programming and allocate memory from kernel space where as malloc is used in application programming and hence allocates memory in user space.
2) Yes all the memory allocation happens in RAM. 3) All the devices that are connected to the system get listed in /dev so the driver can open only devices that are listed in /dev . |
how /dev have the entries of devices connected
Hi bsat thanx for the reply...
as you told that 'All the devices that are connected to the system get listed in /dev so the driver can open only devices that are listed in /dev' *(might this sounds like stupid but i want to clarify that) how even that /dev have the entries of devices connected... |
Quote:
The kernel does that. |
You can create entries in /dev manually using the command "mknod" or kernel does the creation dynamically when it detects a device.
|
hey bsat, if I want to mknod to create entries, where do I get the major and minor nos. needed from?
|
@resetreset Once you insmod the module, it should appear in /proc/devices. So if you
cat /proc/device | cat "module name" ( name used in the call alloc_chrdev_region) The first column should give you the major number. The minor numbers generally start from "0" in increasing order as you connect more devices to be controlled by the driver. |
All times are GMT -5. The time now is 12:29 AM. |