A
Angel
Hi everybody,
I am new to ASP.NET, and my question might be obvious to most of you but I
do not seem to find many things about threads and ASP.NET.
I have an object(Object 1) which need some service from another
object(Object2).
Object 2 has only two methods and no members.
Load(Object1 obj, int id);
Save(Object1 obj);
I will have thousands instances from Object1, but to save memory I will only
have one instance of Object2.
I decided to create only one reference of Object2 and keep it as class
member of Object1 class.
Now if I have only one instance per class, any user logged to the
application (any session) will use the same Object2 obj2 reference.
My question is: Should I make Load() and Save() methods of Object2 thread
safe(Using Lock for example), or ASP.NET will take care of different
sessions(users) accessing this methods.
Again I do not create separate threads. I just wonder if ASP.NET make a
separate thread for any of application users (any session) or it creates a
separate process(with separate allocated memory ) per session and this
process memory area is guarded from other processes.
Thanks
I am new to ASP.NET, and my question might be obvious to most of you but I
do not seem to find many things about threads and ASP.NET.
I have an object(Object 1) which need some service from another
object(Object2).
Object 2 has only two methods and no members.
Load(Object1 obj, int id);
Save(Object1 obj);
I will have thousands instances from Object1, but to save memory I will only
have one instance of Object2.
I decided to create only one reference of Object2 and keep it as class
member of Object1 class.
Now if I have only one instance per class, any user logged to the
application (any session) will use the same Object2 obj2 reference.
My question is: Should I make Load() and Save() methods of Object2 thread
safe(Using Lock for example), or ASP.NET will take care of different
sessions(users) accessing this methods.
Again I do not create separate threads. I just wonder if ASP.NET make a
separate thread for any of application users (any session) or it creates a
separate process(with separate allocated memory ) per session and this
process memory area is guarded from other processes.
Thanks