Solved

Opening a device driver from multiple application.

Posted on 2004-09-03
5
187 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
install command in linux 1 43
Identify Linux loader 67 158
incorrect file reading in bash 7 49
Linux: disable vim auto-comment 7 62
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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