Fastest IPC Mechanism & How to choose b/w User Mode and Kernel Mode

Fastest IPC Mechanism & How to choose b/w User Mode and Kernel Mode

Post by Sateesh Kalid » Thu, 14 Nov 2002 22:25:32



Hi,
  I am fairly new to Embedded Linux. I have 2 questions ?

1.I would like to know which is the fastest and best IPC mechanism in
2.4.18.
  My linux application would go into an Embedded Device.

2.How to chose b/w Kerenel Mode and User Mode implementation. Eg. I am
trying to implement a Registration Service. Based on what paramaters
should I decide whether it should be implemented as User Space Process
OR System Call
Thnx
Sateesh K

 
 
 

Fastest IPC Mechanism & How to choose b/w User Mode and Kernel Mode

Post by Steven Rosted » Fri, 15 Nov 2002 01:15:13



> 1.I would like to know which is the fastest and best IPC mechanism in
> 2.4.18.

Shared memory is the fastest IPC in all unix.

Quote:> 2.How to chose b/w Kerenel Mode and User Mode implementation. Eg. I am
> trying to implement a Registration Service. Based on what paramaters
> should I decide whether it should be implemented as User Space Process
> OR System Call

It's best to stay in usermode, since a kernel module can compromise the
stability of the entire system. Not to mention that it is much easier to
debug a user mode app then a kernel module.

-- Steve

 
 
 

Fastest IPC Mechanism & How to choose b/w User Mode and Kernel Mode

Post by Grant Taylo » Fri, 15 Nov 2002 01:28:43



> I would like to know which is the fastest and best IPC mechanism in
> 2.4.18.  

Fastest?  That would be shared memory.  Best?  That depends entirely
on your application.  Tell us something about what tasks will be
communicating what.

Quote:> My linux application would go into an Embedded Device.

"Embedded Device" is a bit vague.  It's also mostly irrelevant to a
discussion of how to implement IPC for some application.

Quote:> How to chose b/w Kerenel Mode and User Mode implementation. Eg. I am
> trying to implement a Registration Service. Based on what paramaters
> should I decide whether it should be implemented as User Space
> Process OR System Call

Well, what are you registering with your service, and how frequently?

It's rather unlikely that you should implement this (or any) part of
your application in the kernel.  Few applications require it, and few
experienced implementors would want to.

I suggest coming up with a basic plan for implementing your thing in
userspace, and only if you can then definitively state why some part
of it must be in the kernel* should you consider moving code into
kernelspace.

* Typical reasons include "standard syscall interface for Foo has
  performance issue", "this is a high-volume networking protocol",
  "this is a device driver for a device with interrupts", etc.  Even
  these cases can be handled with only a smidge of kernel work to
  better support userspace code.

--
Grant Taylor - gtaylor<at>picante.com - http://www.picante.com/~gtaylor/
 Linux Printing Website and HOWTO:  http://www.linuxprinting.org/
 News, Discussion Forums, Support Database, Software, and more...

 
 
 

Fastest IPC Mechanism & How to choose b/w User Mode and Kernel Mode

Post by Sateesh Kalid » Fri, 15 Nov 2002 15:32:20


Hi,
  Let me explain "Embedded Device" in my context, I am giving out an
OS w/ Power Management a  feature, so I would not know who is actually
going to use this OS ( Linux 2.4.18).
  Could you please give me some pointers on how to implement
Registration Service in User Mode.
   One implementation I am thinking is to use Message Queues b/w
Server Application and Client. My server would wait on a Message
Queue, which will be ppopulated by my client application . As soon as
I get an entry in my Message Q, I would get the pid of the client
along w/ some parameters and Append to a linked list.
  If you can think of a better implementation ,let me know.
Thanks,Bye
Sateesh K

> Hi,
>   I am fairly new to Embedded Linux. I have 2 questions ?

> 1.I would like to know which is the fastest and best IPC mechanism in
> 2.4.18.
>   My linux application would go into an Embedded Device.

> 2.How to chose b/w Kerenel Mode and User Mode implementation. Eg. I am
> trying to implement a Registration Service. Based on what paramaters
> should I decide whether it should be implemented as User Space Process
> OR System Call
> Thnx
> Sateesh K

 
 
 

Fastest IPC Mechanism & How to choose b/w User Mode and Kernel Mode

Post by Gianandrea Gobb » Fri, 15 Nov 2002 19:55:33



Quote:> Hi,
>   Let me explain "Embedded Device" in my context, I am giving out an
> OS w/ Power Management a  feature, so I would not know who is actually
> going to use this OS ( Linux 2.4.18).
>   Could you please give me some pointers on how to implement
> Registration Service in User Mode.
>    One implementation I am thinking is to use Message Queues b/w
> Server Application and Client. My server would wait on a Message
> Queue, which will be ppopulated by my client application . As soon as
> I get an entry in my Message Q, I would get the pid of the client
> along w/ some parameters and Append to a linked list.
>   If you can think of a better implementation ,let me know.
> Thanks,Bye
> Sateesh K

I have to build something similar: I have an application which is split in 3
layers:

kernel mode device drivers (basic device I/O)
 |
 |
user mode drivers (protocol and basic app,logic)
 |
 |
Main logic application

Now I'm thinking how to make the last 2 layer communicate, and whist I agree
that shared memory is the fastest I think that named pipers (FIFO) are very good
candidates.
Anyone with flip sides of pipes?
G.

 
 
 

Fastest IPC Mechanism & How to choose b/w User Mode and Kernel Mode

Post by Michael Brenn » Sun, 17 Nov 2002 23:27:49


Be careful of named pipes. Not sure about current Linux, but in SVR4 once
named pipe reached a threshold data was spooled to disk.

How about using a socket. Assume you have an event loop somewhere can  
more easily set up a select call (if that is your approach).

--mikeb





>> Hi,
>>   Let me explain "Embedded Device" in my context, I am giving out an
>> OS w/ Power Management a  feature, so I would not know who is actually
>> going to use this OS ( Linux 2.4.18).
>>   Could you please give me some pointers on how to implement
>> Registration Service in User Mode.
>>    One implementation I am thinking is to use Message Queues b/w
>> Server Application and Client. My server would wait on a Message
>> Queue, which will be ppopulated by my client application . As soon as
>> I get an entry in my Message Q, I would get the pid of the client
>> along w/ some parameters and Append to a linked list.
>>   If you can think of a better implementation ,let me know.
>> Thanks,Bye
>> Sateesh K

>I have to build something similar: I have an application which is split in 3
>layers:

>kernel mode device drivers (basic device I/O)
> |
> |
>user mode drivers (protocol and basic app,logic)
> |
> |
>Main logic application

>Now I'm thinking how to make the last 2 layer communicate, and whist I agree
>that shared memory is the fastest I think that named pipers (FIFO) are very good
>candidates.
>Anyone with flip sides of pipes?
>G.