Solved

Opening a device driver from multiple application.

Posted on 2004-09-03
5
188 Views
Last Modified: 2010-04-21
I'm just curious if opening the same device driver from multiple part of the program is  considered as bad practice. So let say I have a multi threaded program which operate on the same driver. Each thread open a device descriptor to the driver and read/write to it independent of each other. Would it worth the effort to recode so we open the device once, and get all the thread to use the same descriptor?
0
Comment
Question by:1ce
5 Comments
 
LVL 23

Accepted Solution

by:
brettmjohnson earned 125 total points
ID: 11979094
As long as the device driver is reentrant and allows multiple opens, it should not
be a problem.  Consider the disk driver.  Multiple programs and multiple threads
within the same program can open files without a problem and it is indeed considered
good practice.  Some devices (such as scanners) might not allow themselves to be opened
by more than one thread or process at a time.


0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 11980075
What device are we talking about?

I don't think that the disk driver is a good example for this: You are usually not working with the disk driver directly - your program uses the read/write operations that are provided by the system library, which in turn call the read/write system calls provided by the operating system. Only the OS is then using the disk driver. So, your multiple read/writes (or open/closes) will very likely be converted to sequential events that are sent to the disk driver.
0
 
LVL 2

Expert Comment

by:mishagale
ID: 11980831
As mentioned above, it probably depends on the driver, but also on just how much you use it. If you have very large numbers of open file descriptors, then it might give better performance to just use one shared FD. If you're talking about opening it two or three times, I doubt there would be a problem.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Linux daemon 11 353
Xubuntu Remove Open Terminal Here Option from Desktop Right Click 7 302
what does "puppet agent -t" do ? 2 182
WiFi Router device supports GPON! 3 26
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now