Sam’s Network Simulation Cradle Blog

25 Feb 2006

TODO

Filed under: Network Simulation Cradle — sammydre @ 3:04 am

Fix emulate.py up — need to hack around the failed file copy from the server in the case of openbsd. Well, the file copy works, just the connection then hangs indefinitely. This problem is stopping the testing being completely automatic, which it should be now (which is pretty cool IMHO).

23 Feb 2006

How the Globaliser might modify code

Filed under: Network Simulation Cradle — sammydre @ 11:03 pm

Currently, the globaliser modifies code like so:

Before:

C:
  1. int sam;
  2.  
  3. void func()
  4. {
  5.     sam = 0;
  6. }

After:

C:
  1. int global_sam[NUM_STACKS];
  2.  
  3. void func()
  4. {
  5.     sam[get_stack_id()] = 0;
  6. }

This is fine. The problems come in when we modify unbounded arrays and create enormous amounts of symbols. And there is one problem with the above: it is entirely static.

A new dynamic approach

What if, instead, we did the following:

C:
  1. int _global_orig_sam;
  2. typedef __typeof__(_global_orig_sam) _GLOBAL_TYPE_0_sam;
  3. _GLOBAL_TYPE_0_sam * global_sam (void)
  4. {
  5.     static std::vector< _GLOBAL_TYPE_0_sam > globalised();
  6.     static int max_stack_id = 0;
  7.  
  8.     if(stack_id < max_stack_id)
  9.         return &globalised[stack_id];
  10.  
  11.     int old_size = globalised.size();
  12.     globalised.resize( stack_id + 1 );
  13.     max_stack_id = stack_id + 1;
  14.     std::fill(globalised.begin() + old_size, globalised.end(),
  15.         _global_orig_sam);
  16.  
  17.     return &globalised[stack_id];
  18. }
  19.  
  20. void func()
  21. {
  22.     (*global_sam()) = 0;
  23. }

I think that looks pretty cool. It’s dynamic! Grows as needed, doesn’t add any more linking overhead.

Unfortunately, it is just another approach that works most of the time, but there are scenarios that break it. * We can’t use a std::vector and std::vector.resize() because that means the memory of the array gets moved about. That would invalidate any pointers pointing to existing members of the array. We can’t make any assumptions about the code which uses this memory. This could be fixed by a different dynamic data structure here, perhaps. * Extra overhead of a function call to access a variable. More management stuff going on, could mean more memory used or more work to do.

It does seem to handle different types of variables ok. When we see an externed var we just do the following:

C:
  1. extern int sam[];
C:
  1. extern int _global_orig_sam[];
  2. __typeof__(_global_orig_sam) *global_sam(void);

__typeof__ means we can leave typing up to the compiler nicely, as we should.

22 Feb 2006

Window manager experiments

Filed under: Network Simulation Cradle — sammydre @ 4:59 am

I’ve been playing with the X11 window manager Ion3 today. Interesting to use, quite different to window managers I’ve used in the past.

Certainly has a few really nice things about it. I’m not quite adept yet, but I have a feeling for how it works now and I’m starting to get a bit more efficient at it. I’m using it at work: a screen that I am working on might look like this.

When it’s good, it is pretty good: I don’t fool around with positioning windows or loading up xterms just to type in a command. Nice default bindings to some of the function keys with tab completion on them. I think therein lies its best feature, probably, and that isn’t exactly complex stuff.

Having it all controlled by Lua is all well and good. I wrote a status bar plugin to show my mail from IMAP – the default one only did Maildir. Wasn’t too hard at all. And it works.

But there are all sorts of annoyances about it. Things have got a bit better since I enabled the detach.lua plugin. Now some windows which need it will be floating, which makes apps like firefox a bit nicer if they aren’t on a Float workspace. I could default to a Float workspace, but then I might as well just use fluxbox probably.

Wonder if I’ll continue using it. Will be an interesting test. I think it does do fairly well to make me pretty productive when I’m working. This is evidenced by feeling in my left hand of RSI. Surely that proves I am being much more efficient.

A bandwagon…

Filed under: Network Simulation Cradle — sammydre @ 2:35 am

My blog is worth $564.54. How much is your blog worth?

21 Feb 2006

Finally got Internet at home

Filed under: Network Simulation Cradle — sammydre @ 1:42 am

We may not have food, but we have broadband.

SPE pub is almost ready to be forwarded on to the relevant people/person to look over it. Hopefully do that later today. No hurry right now due to timezones.

Will be able to keep this blog updated again with my work now that I have Internet access. Hooray.

17 Feb 2006

Hmmm….

Filed under: Network Simulation Cradle — sammydre @ 3:39 am

Updated memprof by rasterman

16 Feb 2006

Globaliser and hidden attribute

Filed under: Network Simulation Cradle — sammydre @ 1:07 am

So with the globaliser I can use the hidden gcc attribute to minimise runtime linking cost of the shared library. This is neat. Though the cost was never the end of the world anyway. Unfortunately this does not stop the initial cost of actually linking the shared library together, which is still nasty and runs ld out of memory.

When generating an array, if the variable is non-static, I add __attribute__ ((visibility ("hidden"))) to the variables which are newly created by the globaliser.

Alternatively, I could alter the build system to have -fvisibility=hidden and then only export the stack creation function (by setting visibility to default). This would make a lot more sense and would only export the 1 function that actually matters.

Either way, the runtime cost of loading the shared library is mitigated, which is a Good Thing.

Thanks to Perry for pointing out this option to gcc.

9 Feb 2006

Trials and tribulations

Filed under: Network Simulation Cradle — sammydre @ 2:30 am

Now in Intel and I’m up and running: I have a working laptop and desktop.

Desktop was WinXP/Fedora Core, but I have “upgraded” to WinXp/Ubuntu. There is a lot of system specific stuff on linux installs here to have them work on the local network, so to get ubuntu installed I worked from some existing instructions which were created to script ubuntu installs for new machines that were setup as xen boxes. I got this all working manually, rsync-ed ubuntu across and so on, that all worked fine once I decided how to partition the machine and so on. Well, there were a couple of “gotchas”, but it didn’t take to long to finish this process.

I then changed /etc/apt/sources.list and upgraded to breezy. This took quite a few aptitude dist-upgrades, lots of downloading (which didn’t take so long due to downloading at around 3.2MB/s) and quite a bit of time setting up packages. Things seemed to work for the most part, I then selected the packages I wanted by copying the package list from another machine that was setup in ubuntu and installed those too.

At some point I rebooted and things weren’t so happy. Things timed out; turned out networking wasn’t going. After some hunting I found that dhcp wasn’t running. Huh. /etc/init.d/networking start just returned quickly. If you ran ifup eth0 you could see the error message from dhclient: there was no dhcp group to drop privileges to. I created one. That made it work, but after a couple of reboots, it would be gone. I figure this is something to do with the setup of the machine, ldap-wise or something? Not sure. I did lots of hunting about and looked at the postinst script of the dhcp3-client package. Saw that it tried to add dhcp users and groups, with the --system flag. Well, it added a user, but not a group, which looked buggy to me: and indeed, a dpkg-reconfigure actually output an error, the chown failed because the dhcp group did not exist. So I added the group again with the --system flag this time, and checked that things worked. They did. So a couple more reboots. Guess what? Gone again. Huh. Ok, whatever, need another solution.

I found that the earlier version of dhcp3-client doesn’t require the dhcp group (maybe it doesn’t drop privileges). So I put a hoary line back into my sources.list and downgraded dhcp3-client and dhcp3-common. I then added an /etc/apt/preferences file to pin the packages:

Package: dhcp3-client
Pin: version 3.0.1-1ubuntu4
Pin-Priority: 1001

Package: dhcp3-common
Pin: version 3.0.1-1ubuntu4
Pin-Priority: 1001

Looks like that works a charm!

I have a working Ubuntu Breezy desktop now. Just need to decide on what window manager to run.

3 Feb 2006

Work today

Filed under: Network Simulation Cradle — sammydre @ 3:54 am

Wrote up a script to get some information out of the globaliser. Sets NUM_STACKS to lots of different values and compiles everything, then looks at shared library sizes and .parsed.c file sizes. Oh, and times the total build. I’ve left it running on spectre. Might take some time to compile it that many times…

Put together more of my paper. Now has almost all the content I want in it. Perhaps needs a little more background research, but I don’t know about that. Next I need to look over papers from the same place and compare to see how well my current setup fits in. Then I need to read over it and make it not suck so much. But content is there!

Next: look into some more performance things, haven’t done much on that yet today, even though I said I would.

2 Feb 2006

In the UK

Filed under: Network Simulation Cradle — sammydre @ 10:43 pm

Now in the UK. Right. Back to work!

Got a basic project description for work at Intel Research Cambridge now, I start on Monday.  To start with I’ll be researching stuff in the simulation traffic generation world a bit. Well, it is more specific than that, but in that general area.

PhD-wise: I should probably be looking a bit more on the performance stuff, talk to the guys in NZ about that and add my input. Otherwise, full steam ahead on the publication I think.

Powered by WordPress