Solved

Opening a device driver from multiple application.

Posted on 2004-09-03
5
192 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
[X]
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
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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