Process scheduler assignment

This is a fairly quick and fun (for me, at least) blogpost about something I have to consider for a university assignment.

The assignment revolves around developing a scheduler in C++ that could theoretically be applied as a process scheduling algorithm for an operating system. We were given a code spec to conform to, which consists of class and functions definitions for a integer Stack, Queue and Scheduler. The assignment mandates that we make all three paradigms operational (no surprise). Implementing the first two things was easy, but building a scheduler requires a lot of thinking. Thanks to the specification and the assignment briefing, we are shown that the scheduler operates with 10 priority levels (0 – lowest, 10 – highest) and it bares some relation (inheritance) to the Queue functionality.

You might be thinking: “Woah there Khalid, lot more thinking? Processing tasks based on priority levels is easy ’cause you just select the highest priority items first and go from there…”. Well in theory, that is an easy concept to understand. BUT with that specific approach, you could experience one of the most breaking problems in scheduling.

Blocking.

Blocking (which is the phenomenon where low priority tasks are ‘blocked’ from being processed by high priority tasks) could effectively break the integrity of a system that is supposed to take on more and more tasks whilst operating (like our process scheduler). Whilst those low priority tasks are supposed to be… well… low priority, they are not irrelevant and will need processing eventually. Even in scenarios where tasks are not added during operation (schedulers that have a predefined task list to complete), sequentially processing items from highest to lowest could result in the lower ones never being touched (at least until after an unreasonable amount of  time) since there could be a huge amount of set items!

Imagine we have a system that has a million high priority tasks but just one low priority task. If the scheduler is processing sequentially, it will take a huge amount of time to reach that one low priority task. Surely, there has to be a better way?

With the use of some more processing power, there is. But you’re gonna have to wait to find out! I’m currently having an interesting time trying to select an appropriate method. I’ll likely report my findings after the assessment is submitted (because I do not want to give the answer away).

Advertisements

An interesting term!

As of last Friday, I’m now off university for a few weeks. I thought it might be neat if I make a post about what I have done these last few weeks for university, so here goes!

“Project FallingStar”
…is the single biggest thing I have been involved with this term. For the Professionalism module, we were put into groups (four, five (as it is for ours) or six people) and tasked with planning and building a 3D game from scratch whilst still learning the engine we have to use (Unity). I am pleased to say I have thoroughly enjoyed the project so far! The idea for our game is that the player builds modular space probes to send out on exploration and defence missions in the solar system. Despite initial doubts that our idea was too ambitious for a bunch of UNI students, our team (designated Team 1) is working well and our recent demo was well-received! My main contributions to the team have been physics programming (producing the gravity model) and leadership (defacto, since it was something that I naturally slipped into rather than being designated).

20171219_fallingstar.png
“A little peak”

OpenGL coursework
This coursework was also fun. In the Computer Graphics module, we have been learning the basics of OpenGL and the assessment was to compile a 2D OpenGL scene that makes use of advanced OpenGL features (compared to just using immediate mode rendering) such as Vector Buffer Objects (and Vertex Array Objects), hierarchical modelling, and transformations. Whilst I have to wait for my grade, the demonstration I have to my lecturer was well-received!

Python + Pygame
This coursework was interesting ’cause I both did and did not enjoy it. The coursework was split into two tasks; building a missile command game clone with Pygame and then developing a small physics sim “Marble Madness” with a lecturer-created engine. Both tasks had their merits, which for me was mainly the fun of programming. What I did not like was that we could only develop the second part on Linux since the engine (PGE) is Linux-only. Whilst I have Linux at home nor is Linux THE problem, there is really only one computer lab in the university (where I work better at than home) that has Linux. This meant I could not always be guaranteed a computer since the lab was in high demand. I was even asked to leave for another class on two occassions, with can really be inconveniencing!

So yeah, that’s what I have been up to academically! In my spare time, I am continuing the development of Path to 2265 as another personal priority. I’ve recently made some huge underlying changes that I’ll be posting about this week!

Enjoy your day!

 

Being a course rep, St Fagans, personal website

It has been quite a while since I did one of these summary update posts (at least half a year now), so let’s get into this!

Kicking this post off; for this year of studies, I decided that it was time for me to take a more active role with responsibility at my university. Since Wednesday 22nd November 2017, I am now functioning as one of three course representatives for Year 2 Computer Games Development. Basically, I’m here as the first layer of the “student academic representation network” (there are then student voice reps (SVRs) and full-time student officers above me). I am here to represent all students in my year group – they can come to me with feedback that I can then bring up at meetings with other course reps and the course leaders to improve the quality of the course. Since getting into the role, I have taken part in an initial training event thingy, a course rep assembly (involving course reps across the University), and a course rep meeting (just Game Dev and Computer Science course reps and leaders). So far, it feels great to be part of this and I hope I can be an effective and contributing course rep!

This Saturday, I went to St Fagans with my parents! They went mainly for the bread, Bara Birth, since it is literally the best bread ever! I took some photos in the subsequent walk and tried to play around with them when I got home, doing the best I can with just a mid-range smartphone camera. Some came out pretty nice, although a lot of the finer details were somewhat ruined by JPEG compression. I did some post-processing on a few of them in Photoshop to improve them as much as I can. One thing notable about this trip was that the place has changed quite a bit since the last time I went. The front museum part has been modernised and expanded, and it looks great! And they also added this cafe/workshop (pictured below) building outside too!

 

Finally, my personal website is online! See it here at http://khalidali.co.uk. It will serve as my online portfolio and general hub. It’s source code is essentially a fork of Starfleet’s Path to 2265.

First week back to UNI!

So, it begins. Another year of work towards my future. My first impressions of the Year 2 (technically year 3 out of 4 considering my foundation year) modules are good. I am looking forward to all of them. I’m happy! 🙂

So, the modules.

Data Structure & Algorithms with Object-Orientated Programming is mainly C++, so who can complain? The Professionalism module ultimately involves building a game with the Unity engine in a group. We were put into teams based on our performance last year (apparently heavily weighted towards programming). I was put into Team 1 and so far the team seems great to work with! Tool Development for Computer Games (using Python and C#) and Computer Graphics (OpenGL-based) are great. Operating Systems Concepts, which focusing on how operating systems work, is interesting. The math module Computational Mathematics, unlike last year, actually involves some programming later on, so it is a welcomed change from the very static and boring maths module last year.

Coupled with all these modules, I have given myself a new weekly schedule that commands that I study certain topics for (at least) a set amount of time. These additional study periods are fully welcomed – I enjoy studying, and I feel it is a necessity that will allow me to continue the development and maintenance of my skills. I also needed something to fill out my Monday (which is completely free of lectures and tutorials) and days that I finish UNI early etc. Most of these scheduled study times are in 4-hour blocks, and exclusively involve C#, C++, Unity, Python, Website Development, OpenGL and “language of the week/month”. Most of these relate to what I do in a module that involves the subject, but Website Development is independent and currently dedicated towards my Starfleet’s Path to 2265 website, and “language of the week/month” is dedicated for me to explore a new programming language. For the next few weeks, this will be Java. Lua and Haskell are next!

Hopefully I will get back into the routine of personal blogposts again, since it has all been about my Star Trek-themed website for the last few weeks (posts about Starfleet’s Path to 2265 will be confined to Thursdays). I do want to document my progress throughout university more closely and share my academic experiences! 🙂

Saturday was great!

Llywn-on reservoir. It is the largest of the three reservoirs in the Taff Fawr valley, Brecon Beacons National Park.

I have now revisited all three of them this year with my parents. The last time I went to these places was about a decade ago, and whilst my life has changed considerably since then, these places are as nice as I remember them. Each are large volumes of flat and relatively calm water with a ‘rangingly’ different surrounding.

Some phone photos of Llwyn-on Reservoir:

This one had a lot of forrestation around it. Whereas the first one I went to this year, the Beacons Reservoir (photos below), was mostly walled with a few interesting structures around it, and the Loops & Links path. The second one I do not have photos of, but it was similar to Llwyn-on.

Beacons Reservoir:

So if you’re in town and want a nice place to a spend a few hours or so with ranging scenes, I recommend these three reservoirs and the area surrounding them!

Compassion

It is something that seems to exist in little quantity throughout most of the world. But thankfully, it exists for me.

About an hour ago, I was lying in bed on the verge of falling asleep when I felt a sharp pain in my shoulder. Not knowing what caused it, I turned my nightlight on and realised it was a wasp that stung me.

This is the first time I have been stung (or bitten) by an apocrita (the suborder of insects that includes ants, bees and wasps). To that end, I was unsure if I was allergic to the wasp’s venom. My first reaction was to knock John’s door and ask him if there were any signs of an allergic reaction since this was on the back of my shoulder. I am glad to say that the impact seems to be minimal, and it is not hurting much now. I can also still breathe, so I assume I am not allergic.

When my attention turned back to the wasp, I realised he or she was injured.

My guess is that whilst I was still in the half-sleeping state, I must have tried to remove whatever was pricking me with my fingers. The wasp could not fly, and was trying to flee across my bed. John suggested that I either remove it or kill it.

Killing it was not an option for me. Even if I had an allergic reaction, that would not justify taking fatal action against a creature that was likely threatened by my presence. So even before I went to clean the penetration spot out to ensure no venom was left in that part of my skin, I got a piece of tissue and relocated the wasp out of my room to a place that is safer for little dude.

I truly do not know if he or she will survive, but I made sure that I gave it the best chances of survival. In the previous instances of me accidentally causing harm to insects and spiders, I have typically reacted with a lot of regret and self-loathing. This time I think I was a little more mature about it and just simply got on with trying to do what I can to make things right. Even if the wasp dies, I can rest knowing I tried.

And I am glad I reacted as such though – my thoughts were focused on trying to save the little fella above all else.

One of the most amazing things about this planet is its wildlife. And I am not just talking about the ‘desirable’ mammals like cats and dogs, but species like wasps, spiders, snakes, sharks, scorpions… They all deserve to live, even if you think that they are annoying or you are scared of them. We are currently in the middle of one of Earth’s largest extinction-level events (known as the Holocene extinction). I would be damned if I gave up on trying (where possible) to not be a contributing factor of it. As impossible that may seem in this day and age.

Coursework, Relaxing & Daffodils

After three lots coursework in the last week or so, today has been my small break from working my *** off.

They were all programming related; C++ Programming, Computer Systems Concepts and Information Management, Assurance and Security. The C++ assignment involved me developing a hare and tortoise race simulator, which was quite fun if a little non-challenging if I might add. My result was 81% due to some small mistakes on my part, but it is still a First-class result! The Computer Systems Concepts assignment was writing a summary report and analysis on the ‘Little Man Computer’ (LMC) architecture and writing some Assembly code for a program that runs off the LMC’s limited instruction set. (The LMC is essentially an educative demonstrator for a Von Neumann-based computer, if you do not know). The final assignment was developing a database system with SQL and writing a few queries – with Microsoft Access… Urgh.

There was also an earlier assignment for Information Management blah blah blah, which was designing an ER diagram as a group that would later help us this SQL assignment. I have not discussed it until now since any mention would of turned into a rant back when it happened. Basically, the group made a basic diagram that was missing a lot and I had to spend the night before the day it was due completely redesigning it with logical assumptions to bring it to a passable standard since most members of the group neglected to help and suggest ideas for it when I asked in a FB Messenger group-chat for some (I had to take charge of the entire thing since nothing was happening after that basic ‘diagram’ was completed).

It will be a while until I get the results back for those two assignments. But yeah, I can now finally take a small rest this weekend. I say small since by the end of the month, I will have three more assignments due! Yay!

Today I decided to spend some time on campus, sitting down on a bench for a few hours or so. I also ended up spending some of the time taking photos of the daffodils around campus and messaging a friend for a while as well. I have attached one of the best photos on this blogpost! I originally opted not to go for a walk as part of my ‘complete chilling’ strategy for the day, although I ended up going food shopping at Sainsbury’s anyway.

Other than that, not much else to report!

IMG_20170311_150026_729.jpg
Copyright Khalid Ali