LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
LinkBack Search this Thread
Old 11-17-2009, 07:26 AM   #1
Manishcse113
LQ Newbie
 
Registered: Nov 2009
Posts: 2

Rep: Reputation: 0
Question Proc file vs Device file (performance comparision)


Hi,

I want to share the data from the kernel to a process and from a processs to kernel. At this time I have two choices
a) to create a /proc file from the kernel module and access it for reading and writting from the process.
b) to create a device file from the kernel module and access it for reading and writting from the process.

However, I am not sure, which will give me a better performance.
Do we get any advantage in using the one over the other?

Thanks and regards,
Manish
 
Old 11-17-2009, 08:29 AM   #2
pixellany
Guru
 
Registered: Nov 2005
Location: Pasadena, CA
Distribution: Arch+KDE
Posts: 16,552

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
<<I am not a programmer...>>

It is not clear what you are trying to do.

First, "files" in /proc are really just windows into the kernel data structures in memory. You normally do not want to write to anything in /proc.

Second, a device file (in /dev) is meant to be as the interface to a specific hardware element.

Tell us more about the overall problem.
 
Old 11-18-2009, 03:22 AM   #3
Manishcse113
LQ Newbie
 
Registered: Nov 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Hi,

It is a programming query.
Both these type of files can be used for sending data from process to kernel using the write or ioctl function.
In the similar way, process can read data from kernel by using write function which can be implemnted in kernel module for both of these file types.

My query is that is there any advantage in terms of performance in using /dev file type over /proc files.

Thanks and regards,
Manish
 
Old 11-18-2009, 08:19 AM   #4
sundialsvcs
Senior Member
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 3,422

Rep: Reputation: 245Reputation: 245Reputation: 245
Please re-read the previous post. Neither one is appropriate for what you are trying to do.

Read up on "named pipes" and "shared memory segments."

And... "let 'performance' b'dammed." In other words, " performance... who cares about 'performance.'" No matter what you do these days, it will 'perform.'
 
Old 11-18-2009, 09:17 AM   #5
johnsfine
Senior Member
 
Registered: Dec 2007
Distribution: Mepis, Centos
Posts: 3,837

Rep: Reputation: 685Reputation: 685Reputation: 685Reputation: 685Reputation: 685Reputation: 685
Quote:
Originally Posted by sundialsvcs View Post
Please re-read the previous post. Neither one is appropriate for what you are trying to do.
Do you really think you understand what the OP is trying to do?

I thought it was an interesting question when I first saw this thread (would have answered if I knew the answer). I was annoyed (I expect not as much as the OP) each time someone else who didn't know the answer replied.

Hopefully the clutter in the thread (including my post) won't discourage someone who does know the answer from posting.
 
Old 11-19-2009, 04:42 AM   #6
cladisch
Member
 
Registered: Oct 2008
Location: Earth
Distribution: Slackware
Posts: 225

Rep: Reputation: 54
Quote:
I want to share the data from the kernel to a process and from a processs to kernel. At this time I have two choices
a) to create a /proc file from the kernel module and access it for reading and writting from the process.
b) to create a device file from the kernel module and access it for reading and writting from the process.

However, I am not sure, which will give me a better performance.
The difference between /proc and /dev is more in how the files relate to the rest to kernel; if you have your own read/write/ioctl callbacks, the implementation is exactly the same, so there is no performance difference at all.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Script for CSV file comparision aravind_balan Programming 1 02-17-2009 04:33 AM
change file permission of a mouse device file permanently alexandre_fs Linux - General 5 01-09-2007 07:30 AM
LXer: Cluster File Systems Attains World Leadership Position In High Performance File System LXer Syndicated Linux News 0 07-14-2006 07:21 AM
Which File Functions Can Be Used On /proc File? cranium2004 Programming 1 03-06-2005 12:11 PM
use of proc file system in linux device driver amitchakote Linux - Software 0 06-20-2004 12:27 PM


All times are GMT -5. The time now is 01:48 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration