Memory protection

  • Thread starter =?iso-8859-1?q?Ernesto_Basc=F3n?=
  • Start date
?

=?iso-8859-1?q?Ernesto_Basc=F3n?=

Hi everybody:

I am writing a C++ application that will handle several "applets"
inside of it.

Let's say an "applet" is a full independent module that will run in its
own thread inside the same underlying process. I like the idea of
"applets" because they decrease a lot the need of context switching and
the interoperability between "applets" is great.

Anyway, there are a lot of problems in this model:

* How processing exceptions or crashes inside the "applets"?
* How freeing resources (memory, opened files, etc.) if an "applet" has
crashed?
* How avoiding the danger of corrupt another "applets" if they are
running in the same address space?
* How provide easy interoperability between objects (as simple function
calls) without decreasing the security of other applets, maybe
critical?

Is there a way to overload some operators or overload some methods to
check the validity of the pointers being accessed through code? I want
this validation to be seamless for the end developer.

By example:

MyObject* obj = (MyObject*) 1434348392; //maybe wrong
obj->setName("12");

In that case, how can I overload the "->" to validate if the pointer is
going to access to some valid position?

Overloading the MyObject.operator-> just works when I declare:

MyObject obj;

and I want to work with pointers.

Please help me on this topic and give me some tips about my idea on
"applets".

Thanks in advance,


Ernesto

PDTA: Maybe using smart pointers?
 
J

Jim Langston

Ernesto Bascón said:
Hi everybody:

I am writing a C++ application that will handle several "applets"
inside of it.

Let's say an "applet" is a full independent module that will run in its
own thread inside the same underlying process. I like the idea of
"applets" because they decrease a lot the need of context switching and
the interoperability between "applets" is great.

Anyway, there are a lot of problems in this model:

* How processing exceptions or crashes inside the "applets"?
* How freeing resources (memory, opened files, etc.) if an "applet" has
crashed?
* How avoiding the danger of corrupt another "applets" if they are
running in the same address space?
* How provide easy interoperability between objects (as simple function
calls) without decreasing the security of other applets, maybe
critical?

Is there a way to overload some operators or overload some methods to
check the validity of the pointers being accessed through code? I want
this validation to be seamless for the end developer.

By example:

MyObject* obj = (MyObject*) 1434348392; //maybe wrong
obj->setName("12");

In that case, how can I overload the "->" to validate if the pointer is
going to access to some valid position?

Overloading the MyObject.operator-> just works when I declare:

MyObject obj;

and I want to work with pointers.

Please help me on this topic and give me some tips about my idea on
"applets".

Thanks in advance,


Ernesto

PDTA: Maybe using smart pointers?

Perhaps a better newsgroup for this line of questioning would be:
comp.programming.threads
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top