OS seems to hang

Mar 10, 2012 at 11:55 AM

I was using the basic os that is given upon new project creation (the one that echo's user input) but when I try to run it on a virtual machine it seems to stop working and won't take user input. I have tried this on 3 vm software (virtual pc 2007, oracle vmbox and vm ware 7) but all 3 are the same and the was no errors in compiling, thank you in advance.

Mar 10, 2012 at 7:04 PM
super_tnt wrote:

I was using the basic os that is given upon new project creation (the one that echo's user input) but when I try to run it on a virtual machine it seems to stop working and won't take user input. I have tried this on 3 vm software (virtual pc 2007, oracle vmbox and vm ware 7) but all 3 are the same and the was no errors in compiling, thank you in advance.

This is because you are running out of RAM. Lets say I do this

while (true) {

string ramkiller = "Hello World";

}

if that was all the code to the kernel, eventually after like a minute or two the os would halt. No input, nothing. Because you have ran out of RAM. So you need to program your os (RAM Friendly). I have had to do this,it can be a pain. But just make everything predefined as much as possible. Only define something when you absolutely have to, like a new window. Adding a new textbox to a window. Stuff like that is fine, but the example above isn't. Hope this helps - Matt

Mar 10, 2012 at 7:11 PM
So COSMOS doesn't have automatic garbage collection yet?
Mar 10, 2012 at 7:14 PM

Didn't think of that I have limited ram on my main machine (1gb) so my vm is about 128mb, I'll add more ram to it

Mar 10, 2012 at 7:34 PM
EagleEyeSA wrote:
So COSMOS doesn't have automatic garbage collection yet?

Nope. Not yet. - Matt

Mar 10, 2012 at 7:41 PM
super_tnt wrote:

Didn't think of that I have limited ram on my main machine (1gb) so my vm is about 128mb, I'll add more ram to it

I dont think you understand. Your os runs supper fast, I believe it updates every 2 mil or maybe 5. So lets see here you create a string every 5 mil for 3 seconds is 180 new strings. Now you may be creating 10 new things every update I dont know its your code. Even if you add more RAM you are going to still ran out no matter what you do. Unless you make you code (RAM Friendly) which means to not define something every update. Example

for (int i = 0; i < 5;i++) {

}

now that is bad, because you created i. Thats defining something, therefore using RAM.

So the way to fix it, is to predefine i and use it for every for event. Like this

public int i;

then somewhere in the same class

for (i = 0; i < 5;i++) {

}

now that is better. 

The whole point of all this is, anytime you do a string something, int something, uint something, list <> something, you are using a little bit more RAM. Since there is not garbage collector, you cant get back what you lost. So it will pile up. The only way to keep yourself safe for now, is to simply make your code RAM Friendly, and whats nice is, lets say your entire os is RAM Friendly, and Cosmos gets a garbage collector, then your OS will be using the least amount of RAM possible, which is very good. And I have found RAM Friendly code to be faster than non RAM Friendly code. So you win if you do make your code RAM Friendly. If you dont then good luck. I hate it when you try to test something and your os runs out of RAM. So get into the habbit of doing it and you'll be fine =). Hope it helps -Matt

Coordinator
Mar 10, 2012 at 7:59 PM
civilwarrock: although your main point (ram consumption) is correct, let me explain something:

- local variables ("for(int i = 0; ..." defines a local variable) are stored on the stack, and dont use any "ram": it wont cause your OS to run out of memory
- "var xTest = "Hello World";" -> this string is embedded in the image, and wont cause a new object to be created.....


On Sat, Mar 10, 2012 at 8:41 PM, civilwarrock <notifications@codeplex.com> wrote:

From: civilwarrock

super_tnt wrote:

Didn't think of that I have limited ram on my main machine (1gb) so my vm is about 128mb, I'll add more ram to it

I dont think you understand. Your os runs supper fast, I believe it updates every 2 mil or maybe 5. So lets see here you create a string every 5 mil for 3 seconds is 180 new strings. Now you may be creating 10 new things every update I dont know its your code. Even if you add more RAM you are going to still ran out no matter what you do. Unless you make you code (RAM Friendly) which means to not define something every update. Example

for (int i = 0; i < 5;i++) {

}

now that is bad, because you created i. Thats defining something, therefore using RAM.

So the way to fix it, is to predefine i and use it for every for event. Like this

public int i;

then somewhere in the same class

for (i = 0; i < 5;i++) {

}

now that is better.

The whole point of all this is, anytime you do a string something, int something, uint something, list <> something, you are using a little bit more RAM. Since there is not garbage collector, you cant get back what you lost. So it will pile up. The only way to keep yourself safe for now, is to simply make your code RAM Friendly, and whats nice is, lets say your entire os is RAM Friendly, and Cosmos gets a garbage collector, then your OS will be using the least amount of RAM possible, which is very good. And I have found RAM Friendly code to be faster than non RAM Friendly code. So you win if you do make your code RAM Friendly. If you dont then good luck. I hate it when you try to test something and your os runs out of RAM. So get into the habbit of doing it and you'll be fine =). Hope it helps -Matt

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Mar 10, 2012 at 8:03 PM

At the moment im just using the basic code that comes with the template so I don't see why I'm having trouble.

        protected override void Run()
        {
            Console.Write("Input: ");
            var input = Console.ReadLine();
            Console.Write("Text typed: ");
            Console.WriteLine(input);
        }

Mar 10, 2012 at 8:30 PM
super_tnt wrote:

At the moment im just using the basic code that comes with the template so I don't see why I'm having trouble.

 

        protected override void Run()
        {
            Console.Write("Input: ");
            var input = Console.ReadLine();
            Console.Write("Text typed: ");
            Console.WriteLine(input);
        }

 

Well the only thing I could tell what might be bad is var input = Console.ReadLine();

So heres what I would change

private var input;
protected override void Run()
        {
            Console.Write("Input: ");
            input = Console.ReadLine();
            Console.Write("Text typed: ");
            Console.WriteLine(input);
        }

Mterwoord, if what your saying is true, which I dont doubt you. Then why does the OS hang? If it is running out of RAM, then whats causing it? Cosmos Drivers? Because if his code really is RAM Friendly then whats causing the OS hang? Because if everything is prestored in the image, then what about something like this. 

I have list of a a class called control. And I have code to where if you click a image a control is created and added to the list. Now this example cannot be pre setup can it? Because in theory the control would be created if the image was clicked, and every time it is, a new one is created. So is that pre setup still? Thanks - Matt

Mar 10, 2012 at 8:55 PM

Idk if its pre setip because it's a single file and it says 1 build successful :/ The is always a problem with cosmos for me

Mar 11, 2012 at 7:26 AM
super_tnt wrote:

Idk if its pre setip because it's a single file and it says 1 build successful :/ The is always a problem with cosmos for me

Lol I had the same issue, problem after problem. And you know what I did to fix it? I Concurred Cosmos =). No just kidding, I actually did nothing. Just rewrote my code until it worked and I found the problem. And then when I did I got mad because the code I dismantled was working just fine. =). - Matt 

Coordinator
Mar 11, 2012 at 8:30 AM
Console.ReadLine creates a new string. Also i think we have some interrupt handlers taking memory..

On Sun, Mar 11, 2012 at 8:27 AM, civilwarrock <notifications@codeplex.com> wrote:

From: civilwarrock

super_tnt wrote:

Idk if its pre setip because it's a single file and it says 1 build successful :/ The is always a problem with cosmos for me

Lol I had the same issue, problem after problem. And you know what I did to fix it? I Concurred Cosmos =). No just kidding, I actually did nothing. Just rewrote my code until it worked and I found the problem. And then when I did I got mad because the code I dismantled was working just fine. =). - Matt

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Mar 11, 2012 at 4:37 PM
mterwoord wrote:
Console.ReadLine creates a new string. Also i think we have some interrupt handlers taking memory..

On Sun, Mar 11, 2012 at 8:27 AM, civilwarrock <notifications@codeplex.com> wrote:

From: civilwarrock

super_tnt wrote:

Idk if its pre setip because it's a single file and it says 1 build successful :/ The is always a problem with cosmos for me

Lol I had the same issue, problem after problem. And you know what I did to fix it? I Concurred Cosmos =). No just kidding, I actually did nothing. Just rewrote my code until it worked and I found the problem. And then when I did I got mad because the code I dismantled was working just fine. =). - Matt

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


If its Console.ReadLine that is causing issue, then I would try to validate that the IRQ that handlers the keyboard interrupt is still valid in the IDT, perhaps you overwrote it on accident (it happens if you have stack corruption)? Its a shot in the dark but it might be the problem.

Coordinator
Mar 11, 2012 at 6:26 PM
there are currently no known stack corruption issues..


On Sun, Mar 11, 2012 at 4:38 PM, blackfireize <notifications@codeplex.com> wrote:

From: blackfireize

mterwoord wrote:
Console.ReadLine creates a new string. Also i think we have some interrupt handlers taking memory..

On Sun, Mar 11, 2012 at 8:27 AM, civilwarrock <notifications@codeplex.com> wrote:

From: civilwarrock

super_tnt wrote:

Idk if its pre setip because it's a single file and it says 1 build successful :/ The is always a problem with cosmos for me

Lol I had the same issue, problem after problem. And you know what I did to fix it? I Concurred Cosmos =). No just kidding, I actually did nothing. Just rewrote my code until it worked and I found the problem. And then when I did I got mad because the code I dismantled was working just fine. =). - Matt

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


If its Console.ReadLine that is causing issue, then I would try to validate that the IRQ that handlers the keyboard interrupt is still valid in the IDT, perhaps you overwrote it on accident (it happens if you have stack corruption)? Its a shot in the dark but it might be the problem.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Mar 11, 2012 at 7:47 PM

I did have problems re-installing cosmos as I had to install over a previous version instead of removing it. I'm on windows xp and it says I can;t remove it because my windows isn't compatible. Could this be the problem? (If so I am sorry and stupid)

Mar 13, 2012 at 10:59 PM
super_tnt wrote:

I did have problems re-installing cosmos as I had to install over a previous version instead of removing it. I'm on windows xp and it says I can;t remove it because my windows isn't compatible. Could this be the problem? (If so I am sorry and stupid)

No your not stupid at all. If I was you I would download the current source compile it and run the installer. Let it install and then try your OS again. If it continues to do it, then it must be something with Cosmos. Hope it helps - Matt

Mar 14, 2012 at 5:44 PM

Don't I need to remove the old one before I do that also is the a guide for compiling the source on express?

Mar 14, 2012 at 5:53 PM
super_tnt wrote:

Don't I need to remove the old one before I do that also is the a guide for compiling the source on express?

It would probably help you if you did uninstall Cosmos User Kit, otherwise you get two versions of Cosmos fighting. For guides, try http://cosmos-tutorials.webs.com/getstarted.html and http://cosmos.codeplex.com/wikipage?title=Building%20Dev%20Kit

Mar 14, 2012 at 5:53 PM
Edited Mar 14, 2012 at 5:54 PM
Oops, double post
Mar 16, 2012 at 7:12 PM
Aurora01 wrote:
super_tnt wrote:

Don't I need to remove the old one before I do that also is the a guide for compiling the source on express?

It would probably help you if you did uninstall Cosmos User Kit, otherwise you get two versions of Cosmos fighting. For guides, try http://cosmos-tutorials.webs.com/getstarted.html and http://cosmos.codeplex.com/wikipage?title=Building%20Dev%20Kit

I dont really agree with that. Even I cannot uninstall the user kit, so I just overwrite it with a new version and I never have any problems. Because the new one overwrites the old ones files, so therefore it cant fight. =) - Matt

Mar 16, 2012 at 7:28 PM
civilwarrock wrote:
Aurora01 wrote:
super_tnt wrote:

Don't I need to remove the old one before I do that also is the a guide for compiling the source on express?

It would probably help you if you did uninstall Cosmos User Kit, otherwise you get two versions of Cosmos fighting. For guides, try http://cosmos-tutorials.webs.com/getstarted.html and http://cosmos.codeplex.com/wikipage?title=Building%20Dev%20Kit

I dont really agree with that. Even I cannot uninstall the user kit, so I just overwrite it with a new version and I never have any problems. Because the new one overwrites the old ones files, so therefore it cant fight. =) - Matt

However, it is possible, so I would advise doing so

Coordinator
Mar 17, 2012 at 9:39 AM
civilwarrock: it can fight due to old registry keys not being removed..

super_tnt: what old version did you have installed?


On Fri, Mar 16, 2012 at 7:28 PM, Aurora01 <notifications@codeplex.com> wrote:

From: Aurora01

civilwarrock wrote:
Aurora01 wrote:
super_tnt wrote:

Don't I need to remove the old one before I do that also is the a guide for compiling the source on express?

It would probably help you if you did uninstall Cosmos User Kit, otherwise you get two versions of Cosmos fighting. For guides, try http://cosmos-tutorials.webs.com/getstarted.html and http://cosmos.codeplex.com/wikipage?title=Building%20Dev%20Kit

I dont really agree with that. Even I cannot uninstall the user kit, so I just overwrite it with a new version and I never have any problems. Because the new one overwrites the old ones files, so therefore it cant fight. =) - Matt

However, it is possible, so I would advise doing so

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Mar 17, 2012 at 7:09 PM

It might of been ms4 but I'm not sure :/ I've had this problem with all versions though.