Re: SHaring buffer from kernel to applications-help!!!
- From: "Don Burn" <burn@xxxxxxxxxxxxxxxx>
- Date: Thu, 23 Nov 2006 08:57:54 -0500
Seriously, think about this. Sharing memory is a bad idea in most cases.
Audio does not have the bandwidth to justify it, versus the standard
read/write/IOCTL calls. With shared memory you have a lot of problems:
1. No good way to get notification when the application you are
sharing with dies.
2. A number of challenges on synchronizing access to the data,
including that the sync calls can be higher overhead than doing it with the
standard calls.
3. Problems when you want to expand or contract the buffer area.
I've worked on projects where we used shared memory (delivering streaming
video at HDTV quality), and getting this stuff right was a pain in the ass.
The initial work by experienced developers was handed over to senior people
for tuning, this initial work had been deemed shippable quality. When the
senior people went through it with a full review not a single piece of the
original remained, since there were that many bugs. This was not that the
original developers were bad, but that a full scale deliver data such that
you needed shared memory is that hard.
Since that project I have twice ripped out work by other consultants who
used shared memory, and replaced it with standard calls. In each case the
code was smaller and faster than trying to get shared memory correct.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
http://www.windrvr.com
Remove StopSpam from the email to reply
<arijit.p@xxxxxxxxx> wrote in message
news:1164282758.108053.113760@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi All,
I am writing a pseudo miniport-audio driver(MSVAD samples). I need to
read audio data from application and for that my driver is allocating a
buffer and sharing it with application (outlined in
http://www.osronline.com/article.cfm?id=39). I am following the
approach outlined in the last section, sharing buffer from driver to
application. Hope I am doing the right thing. I have few more questions
in this regard:-
1) How do i create a driver name so that I can open it from my
application and read/write from the shared buffer? (when you want to
open a device, you need device name). I tried doing that using
IoCreateSymbolicLink() in DriverEntry(), but it crashed whole system.
Is this the correct approach? I heard for mini-port driver it is not
possible (in that case i hav to handle all IRPs and have to write a bus
driver). Please help.
2) Do I need to overwrite the following IRPs in DriverEntry(). Miniport
drivers(MSVAD) doesn't handle IRPs, all are being handled by port
driver (wavecyclic).
DriverObject->MajorFunction[IRP_MJ_CREATE] = DispatchCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] =
DispatchClose;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
DispatchDevCtrl;
DriverObject->MajorFunction[IRP_MJ_READ] = DispatchRead;
DriverObject->DriverUnload = Unload;
Can we do that?
3) Do you have any idea of device extensions? Can we use that for
reading and writing from application?
Please help me. I am really confused and not getting any help around.
Thanks a lot!
-paul
arijit.p@xxxxxxxxx wrote:
Hi All,
I am writing a pseudo miniport-audio driver(MSVAD samples). I need to
read audio data from application and for that my driver is allocating a
buffer and sharing it with application (outlined in
http://www.osronline.com/article.cfm?id=39). I am following the
approach outlined in the last section, sharing buffer from driver to
application. Hope I am doing the right thing. I have few more questions
in this regard:-
1) How do i create a driver name so that I can open it from my
application and read/write from the shared buffer? (when you want to
open a device, you need device name). I tried doing that using
IoCreateSymbolicLink() in DriverEntry(), but it crashed whole system.
Is this the correct approach? I heard for mini-port driver it is not
possible (in that case i hav to handle all IRPs and have to write a bus
driver). Please help.
2) Do I need to overwrite the following IRPs in DriverEntry(). Miniport
drivers(MSVAD) doesn't handle IRPs, all are being handled by port
driver (wavecyclic).
DriverObject->MajorFunction[IRP_MJ_CREATE] = DispatchCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] =
DispatchClose;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
DispatchDevCtrl;
DriverObject->MajorFunction[IRP_MJ_READ] = DispatchRead;
DriverObject->DriverUnload = Unload;
Can we do that?
3) Do you have any idea of device extensions? Can we use that for
reading and writing from application?
Please help me. I am really confused and not getting any help around.
Thanks a lot!
-paul
.
- References:
- SHaring buffer from kernel to applications-help!!!
- From: arijit.p@xxxxxxxxx
- Re: SHaring buffer from kernel to applications-help!!!
- From: arijit.p@xxxxxxxxx
- SHaring buffer from kernel to applications-help!!!
- Prev by Date: Re: Don't receive IRP_MJ_CREATE on a CreateFile
- Next by Date: Re: virtual network interface over PCI
- Previous by thread: Re: SHaring buffer from kernel to applications-help!!!
- Next by thread: Re: SHaring buffer from kernel to applications-help!!!
- Index(es):
Relevant Pages
|