Semester 1, Year 2

GD Star Rating
loading...

Semester 1 of Year 2 has been really hard work, hence, the lack of blog posts. I think to this date, we’ve had about 12 courseworks. And then there’s the January exams. Still… don’t panic. Also, I think it’s also reasonable to expect that a degree at a world-leading institute such as ECS would be at least *slightly* difficult!

One of our courseworks was for the Operating Systems module; we had to implement a memory allocator in C. I think at first, everyone was a bit scared it was going to be massively difficult, I mean, this is like asking you to reinvent the wheel. After a bit of research, it suddenly became straightforward and it was ‘obvious’ what was a good and a bad solution. I’d just like to add that ECS STACS was of great help for providing valuable tips and hints, including how to track down the source of a segmentation fault.

For testing our memory allocator, we were given a test harness which had an integer array of size 1,000,000. A random number generator (and a seed) would then arbritrarily assign memory using this ‘heap’. My team’s efficiency result was 13473 allocations out of a possible 14235 allocations, giving 94.6% memory efficiency in 0.25s [1], which we were very pleased about. We also achieved thread-safety using a pthread mutex lock and stored this in our heap using some clever pointer-casting (we were not allowed to use global variables for this exercise). We decided to use a first-fit algorithm (for speed) with a singly-linked list and coalescing on freeing memory. The array held in index 0, the size of the array, and in index 1, the index of the first free memory node. Each memory node only needed one integer to store metadata as we decided to use bitfields and then encode all the data 😉 Sneaky.

I am pleased to say I am now a part-time web developer sub-contracting for Buckle Consulting, a local web-development company in Southampton. I am on the back-end development team for Escape the City, a website dedicated to advertising interesting jobs worldwide to graduates and the like. Its two directors have offered to put me on the guest list for their winter party in London, but unfortunately, it’s slap-bang in the middle of January exams so it’s unlikely I’ll be able to go. C’est la vie.

Stay tuned for some of my thoughts and reflection of this semester so far..

[1] – We did compile with gcc Level 2 optimisation which shaved off about 0.5secs approx.

GD Star Rating
loading...

Leave a Reply

Your email address will not be published. Required fields are marked *