LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-26-2007, 07:12 AM   #1
tovis
Member
 
Registered: Jan 2007
Location: Budapest
Distribution: Debian
Posts: 74

Rep: Reputation: 15
IO multiplexing in Linux


Question is some what philosophical. I'm programming small progz, mostly for communication, data collecting on Linux more then 4 years. Before I've used windows.
In windows (NT 4.0, W2K Prof and XP) I used IO completion queue, it's with my own FiFo code (really a double linked list) allowed me to build very simple, modular interfaces to sockets, serial ports and files. Everything goes through thread safe FiFo and push/pull any packets from one channel to other seem very similar.
I can not find anything analog in Linux, my best try was using select and working thread for it. Every "channels" have their own thread and FiFo, but at this point I need signals and timers, what need driven me to use liboop which integrate all of them to me, with a more or less similar, convenient interface. But seem to be I was wrong. I can not reach appropriate modularity. Seem to be liboop does not like/support multithreading, as signal handling also could work only in main process, which also mean alarm timer have same problem.
What is the right way to build, simple, flexible and convenient interfaces for higher level prog in Linux, what is the right way?
 
Old 01-26-2007, 12:52 PM   #2
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
Have you considered aio? aio_read(), aio_write() ... are designed for what I think you are describing - multiplexing. aio calls work with any fd that write(), read(), etc. will work on including sockets.

Only caveat - Linux kernels before 2.6 don't have full POSIX support for aio.
 
Old 01-26-2007, 01:07 PM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Jim_McNamara is right - "aio_*()" is probably the way to go.

Here's a link that describes a bit more:

http://www.atnf.csiro.au/people/rgoo...io-events.html

The very best book you can get is:
"Advanced Programming in the Unix Environment", W. Richard Stevens et al
http://www.bookpool.com/sm/0201433079

'Hope that helps .. PSM
 
Old 01-26-2007, 01:25 PM   #4
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
There may be one weenie -
This
http://lse.sourceforge.net/io/aio.html
indicates that socket support defaults to non-aio behavior, but I don't know how old the information is. I don't keep up with kernel release information except on the nn.x level.
 
Old 01-26-2007, 05:31 PM   #5
tovis
Member
 
Registered: Jan 2007
Location: Budapest
Distribution: Debian
Posts: 74

Original Poster
Rep: Reputation: 15
aio used to be a multithreaded daemon in linux
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
asynchronized I/O == multiplexing I/O? George2 Programming 9 01-26-2007 07:46 AM
what is a multiplexing server good for? Thinking Programming 4 08-10-2005 02:39 PM
Bandwidth multiplexing russell Linux - Networking 3 04-14-2005 07:11 PM
Multiplexing ADSLs ? michaelsanford Linux - Networking 6 04-14-2005 05:51 PM
client/server multiplexing AquamaN Programming 1 03-25-2004 04:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:13 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration