January 2008 - Posts
Just a quick note, and most is self explanatory (download CPUSS here). I'll talk about the code after.
using System;
using System.Collections.Generic;
using Cpuss;
using Cpuss.Strategies;
namespace ConsoleApplication1
{
class Program
{
static void Main()
{
Runner runner = new Runner(20, 10, 65, new Sjf());
runner.Completed += (o, e) => Console.WriteLine("Simulation Time: {0}ns Total No. Processes: {1}\n\n", e.TotalTime, e.ProcessCount);
runner.Run();
Console.WriteLine("Process Metrics:\n\n");
foreach (KeyValuePair<int, Process> process in runner.Metrics)
{
Process p = process.Value;
Console.WriteLine("PID: {0} Arrival Time: {1} Start Time: {2} Completion Time: {3}",
p.Id, p.ArrivalTime, p.StartTime, p.CompletionTime);
}
}
}
}
First of all in this case I am creating a simulation using 20 small , 10 medium, 65 large processes (I explained the bounds of the burst time values in this post). The Completed event is pretty self explanatory, this is raised when the simulation has finished executing, i.e. there are no more processes in the ready queue to execute. To start the simulation you need only call the Run method on the Runner instance.
Following the simulation I print out a few of the property values of the metrics gathered throughout the course of the simulation:
- Id (synonymous with PID)
- Arrival Time
- Start Time
- Completion Time
I could of included Burst Time as well, but for this demo to make the screen shot look more civilised and less busy (and I understand the console is not the best UI choice to present such data which will be resolved in later releases).
That's it.
Download CPUSS.
I have an interest in CPU scheduling strategies so I thought I would make a framework (CPUSS) by which you could use standard strategies (first-come-first-served, shortest job first, round robin, priority etc) and also create your own and gather metrics from the strategies execution given n processes over T units of time (simulated time, simulated processes).
Download CPUSS 0.1 (or download later after you have read my summary of what is included in this release).
At the moment the features are fairly limited and the framework by which you can plug into to create your own strategies could be better, but remember this is the first early release.
Things to note about this release:
- Simulates single core execution (multi-core/processor simulation is something that may be introduced depending on popularity, but would be interesting)
- Two strategies ship with the bits at the moment:
- FCFS
- SJF
- More in CPUSS 0.1 this release was primarily built around getting something released pretty quickly and seeing if the simulation environment could hold for various strategies
- Metrics are gathered for free when using library strategies
- If you create your own you must register a call to a single method, I won't bore you with the details as the documentation explains everything you need to know
- Events exist so you can hook into the simulation, currently:
- Runner.Started
- Runner.Completed
- Runner.ProcessStarted
- Runner.ProcessCompleted
- A preempted event will get added in the next release
- Metrics that are gathered for every process include:
- PID
- Burst Time
- Arrival Time
- Start Time
- Completion Time
- At the moment I've done nothing that requires a process to have a priority but strategies will be introduced in CPUSS 0.2 that will require this.
- Auto generation of process "loads" based on the principle that you define processes of varying properties, i.e. small, medium and large processes. The arrival time, and PID of the processes is auto generated. This feature will be particularly useful when testing custom strategies with varying scenarios to gain more balanced and comprehensive data to analyse further.
- Small - 1ms - 40ms
- Medium - 41ms - 100ms
- Large - 101ms - 250ms
I think I have summarized up the main features. Any feedback is gracefully encouraged.
Download CPUSS 0.1
Let me first say that I really like that fact that the F# compiler comes with an easy way to generate HTML documentation without going the XML route, but the HTML produced is not particularly helpful when you are dealing with a large code base.
There is a particularly great project that runs inline for Haskell called Haddock which produces some really great HTML documentation. GHC uses Haddock.
I would love to see some investment into the HTML docs, even if it is just presentation fixes and more intuitive navigation.
I have been sent a few books from Addison-Wesley and I think this one is the best of them all, but generally all have been excellent. The book covers in great detail the various aspects to consider when creating portable C++ code, from GUI's to the actual process used to create the software.
One of the interesting things about the book is a decent overview of XUL which is a cross platform GUI toolkit that uses XML (like WPF) to describe the visual components - this technology can be used on various OS's. I found this particularly interesting as I had not really read much about XUL for a few years since I first came across it and it was really nice to see that it has developed into a fairly robust framework.
The book is written by Syd Logan who worked on the Netscape team, the book is riddled with short stories of times he had personally and his team had encountered cross-platform issues and the solutions that they used, as well as possible alternatives.
This book was an awesome read, and one that provided great insight into the particular area - if you are interested in this then Syd's book will give you a general overview of everything to consider as well as a few technologies to use (or that he in his experience found incredibly useful) from Bugzilla, to make files, management, NSPR, Installers etc.
Highly recommended.
I love this tool from the CodePlex guys! I mentioned a while ago that I was having some issues with the various TFS clients available and this one seems to of come up trumps! Admittedly there is no feature to close work item's with a check-in, nor add/edit them but that aside this is really something!
A long time ago I used Subversion and TortoiseSvn a lot and then suddenly started using TFS related clients because of the server technology.
The only thing I would raise is that the actions seem to be quite slow when transferring small files to the TFS server, however when transferring large files the transfer rate seems to increase exponentially after a few seconds - this is not the case with their smaller counterparts.
So far I have not looked back since moving to the said tools.
Finally.
Follow Shawn's steps.

Over the last few months I have had two source control clients give me nothing but grief! The suspects are the TFS Client for VS 2008 and the other is Teamprise Explorer that well seems to behave very oddly!
The TFS client drops the bindings for my solution whenever it wants - I can't tell you how much this has annoyed me, you open up the project the first time and everything is fine, open it a second time and it doesn't know that it's source controlled :-(
Teamprise Explorer, my ex-favourite client. Works fine, but the UI breaks down and crashes a lot so much so that it has become a choir to work with.
So now I only have one more solution, or rather one more thing I've not tried and that is the CodePlex client - command line. I've yet to use it but I can see the fact that I can't associate work items with check-in's being very annoying.
Has anyone else suffered problems with the first two clients? I'm sort of left high and dry here wondering whether I can be bothered to look at the CodePlex client which seems to of ceased development and never achieved a proper release and that somewhat scares me.
Times like this when I just wish that CodePlex used subversion - at least then things would be simple.
Anyone else been a victim?
Note: I am aware of SvnBridge, looks promising going to give it a try now. Needless to say my hopes are not very high given my previous experiences...
Just one really in my opinion -> smart break points.
Almost brings a tear to my eye watching people manually step through code several times to get to that volatile spot.
I'm not talking specifically about the condition smart breakpoint but the other stuff too like hit count, filter etc.
I find the maintenance of breakpoints is also well served using the breakpoint window which few seem to use as well which I think is excellent.
Hope everyone has a great 2008!
More Posts