Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / April 2008

Tip: Looking for answers? Try searching our database.

Doing real time managed software

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
obiwanjacobi - 18 Jan 2008 07:17 GMT
Is it possible? What would be the biggest problem to solve?
My guess is the Garabage Collector. You'd kind of want to be able to
tell it to stop collecting while you're in a piece of critical code.
Are there techniques to manage you're own object instances in such a
way the the GC 'never' runs. Or can you run the GC manually and will
it 'never' run automatically?

I'm investigating if it is possible to write real-time synth software
(VST) in .NET....

Thanx,
--Marc
Jon Skeet [C# MVP] - 18 Jan 2008 08:16 GMT
> Is it possible? What would be the biggest problem to solve?

Well, if you're using actual .NET, you'll be running on Windows, which
isn't a real-time operating system to start with - you just don't get
the guarantees you need for proper real time systems.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk

Vadym Stetsiak - 18 Jan 2008 08:57 GMT
Hello, obiwanjacobi!

Here is an article that can help you get additional info on doing real time
managed sofrware
http://blogs.msdn.com/ricom/archive/2006/08/22/713396.aspx

--
With best regards, Vadym Stetsiak.
Blog: http://vadmyst.blogspot.com

You wrote  on Thu, 17 Jan 2008 23:17:17 -0800 (PST):

o> Is it possible? What would be the biggest problem to solve?
o> My guess is the Garabage Collector. You'd kind of want to be able to
o> tell it to stop collecting while you're in a piece of critical code.
o> Are there techniques to manage you're own object instances in such a
o> way the the GC 'never' runs. Or can you run the GC manually and will
o> it 'never' run automatically?

o> I'm investigating if it is possible to write real-time synth software
o> (VST) in .NET....

o> Thanx, --Marc
forever.zet@gmail.com - 19 Jan 2008 12:59 GMT
> Is it possible? What would be the biggest problem to solve?
> My guess is the Garabage Collector. You'd kind of want to be able to
[quoted text clipped - 8 lines]
> Thanx,
> --Marc

Hi Marc,

I can tell you about my experience writing real-time (near real-time)
applications in C#.
We had to solve several garbage collection related problems.

The main problem is propagation of objects to the second generation.
Collecting objects in generations 0 and 1 (short living objects) is
very fast. It is performed all the time in background and has almost
no impact on performance. However collection of objects in second
generation took about 10 seconds and was performed very often (once
per several minutes), during which all other processing froze, which
was unacceptable.
Objects in second generation were primarily cached objects and objects
in queues. They lived in cache(queue) for certain time and were
deleted later.
So the shorter object lives the better it is. We had to implement
approach when an object either existed forever, or lived for a very
short time.
This can be done in many ways, like precreating objects in queues and
later assigning data to them instead of putting new objects in; or
implementing object pools.
And I think you would do the same in an environment without GC
(however there you'd like to avoid allocations, here you want to avoid
collections:) )
We didn't remove propagation into the second generation completely,
but the collection occured so rarely that we could afford it to
happen.

If you have this kind of small propagation into 2nd generation you can
run GC when it's not critical for your application to hang for some
time. Full collection shall not run by itself again until memory
finishes.

Also we got rid of short-living Large Objects (object whitch are more
that 85kb. They go into Large Object Heap and are processed
differently by garbage collector).

We had to struggle with memory consumption, because of the nature of
our application. I'm not saying that .NET uses more memory than
something else. But there are some things to keep in mind. Like that
actual memory limit for .NET application on win32 is about 1.5GB, an
object takes at least 12 bytes etc...

From the performance perspective I think purely computational programs
in C# can be written to run not slower than similar in C++. However I
don't know what you might expect from interactions of programs in C#
with other systems, like sound system.

Thanks,
Sergey Zyuzin
obiwanjacobi - 20 Jan 2008 18:23 GMT
Thanks everybody for the feedback.

@Jon Skeet: Yes, I run on Windows and I know its not a true real time
operating system. But its real-time enough to do some audio processing
and that is the domain I was talking about.

@Vadym Stetsiak: Thanks for the link, I will read it for sure.

@Sergey Zyuzin: Thanks for sharing your experience. You gave me some
great pointers!
Sergey Zyuzin - 06 Feb 2008 08:57 GMT
On Jan 19, 2:59 pm, forever....@gmail.com wrote:

> > Is it possible? What would be the biggest problem to solve?
> > My guess is the Garabage Collector. You'd kind of want to be able to
[quoted text clipped - 60 lines]
> Thanks,
> Sergey Zyuzin

I think I wasn't exactly correct saying that full collection won't run
until memory finishes. It's not documented when it runs, but usually
it occurs when 2nd generation grows significantly after previous
collection.
Jim Arnold - 11 Apr 2008 16:49 GMT
Don't know if you're still monitoring this thread, but there I wrote a C#
wrapper for the VST SDK a few years ago (works against VST 2.4, not sure
about 3.x).  It comes with some example plugins, including a reverb and a
delay.  http://code.google.com/p/noisevst/

Jim

> On Jan 19, 2:59 pm, forever....@gmail.com wrote:
> >
[quoted text clipped - 67 lines]
> it occurs when 2nd generation grows significantly after previous
> collection.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.