|
DevJournal - Moving Forward Again...Finally |
| Print |
|
|
Written by Akiba
|
|
Saturday, 31 May 2008 |
A bizarre thing happened to me this morning. I was going to the international ATM near where I lived to get money to pay my rent. My bank is an American one so I can't use the standard Japanese ATMs and that was the only machine within cycling distance from my apartment. The international ATM is located in the basement of a department store, and the department store spans about 11 floors.
As I was walking towards the ATM, I noticed a lot of people crowded in the area in front of it. As I approached closer, I was shocked to see somebody lying face down on the tile floor. Somebody had committed suicide by jumping from one of the upper floors and I had to pass by their dead body to get to the ATM. What would drive someone to such despair that they would waste their life like that and why did they have to do it in front of the only international ATM in the area? It was such a horrible experience that it put me in a bad mood the whole day. Japan has one of the highest suicide rates in the world, but its one thing to read about it in the paper and another to experience it right in front of you.
It was not the best way to start the day.
Anyways, I've been putting a lot of hours into the stack these past couple of days. The simulator is up and wheezing along so I've been able to run some basic tests with two nodes.
The first day I got the simulator up, I ran into a pretty nasty problem. There was an errant pointer that was messing up the whole stack. I kept on getting core dumps, but couldn't find out where they were happening. I finally used the "process of elimination" to isolate the problem and found that I had made a mistake in how I declared one of the timers in Contiki. The timer structure was declared locally, but the problem is that the structure contains a linked list pointer to the next timer structure. After the function ended, the timer struct went out of scope (it was freed from the memory stack) so the link to the next timer ended up pointing to some random place in memory. That really sucked. After I located it, it was a one-liner fix, but it would have been bad to debug that in hardware. After that, things went pretty smoothly. After fixing a couple of stack initialization parameters, I was able to get the first node up and have it form the network. I then added another node and had it join the newly formed network. Overall, those two first steps went pretty quickly, probably because I had already tested those functions out in the old test fixture. I realized that there was a lot of typing going on to add nodes, setup the network and basically control things microscopically. I decided that typing in all the commands each time was for losers so I tried to write a script parser to do everything automatically. I spent about a day and a half on it but it went horribly. The problem with the scripting is that you need to have a way to synchronize the processes and indicate when a command was finished. Otherwise, the parser would just execute each command from the script sequentially without waiting for the previous command to finish. So if I had one node form a network and the other node join it, they would both do it simultaneously. The network would only be halfway through the formation when the other node would try to join it and it basically failed. I figure that I might need to implement some kind of semaphore to deal with this issue since it spans multiple processes. Right now, it’s a pretty low priority so I'm gonna shelve it for now. I figure a bit of carpal tunnel never hurt anyone. I also noticed that printing out debug statements in a multi-process program really sucks. The processes keep on stepping over each other to print to the terminal so it's really hard to read the logs. I checked on the internet and it looks like it’s a pretty common occurrence and again, the only way to get around it is to put a semaphore on stdout. So it looks like I'm gonna be reading up on my POSIX semaphores for a bit to get around this. That's pretty much where things stand right now. Things look like they're moving forward again so I'm pretty satisfied with the progress. After I fix the debug printing, then I'm gonna try and form a larger network to see how that goes. Once I get through that, then the fun begins. I'm going to start trying data transfers and also testing the routing. I'm sure I'm going to find a lot of problems there. Tonight, I'm positive that it's Friday (technically Saturday in Tokyo) so I'm going to drink up. It's been a pretty long week and I'm still kind of rattled from seeing that body today. G'night.
Trackback(0)
|
No Comments.