Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Opening a device driver from multiple application.

Posted on 2004-09-03
5
190 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

839 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