February 2008 - Posts
One of the more used strategies in general irrespective of CPU scheduling is the round robin strategy that allows you to define some time quantum that each process will execute for unless within that time it voluntarily releases the CPU, if it doesn't finish within that time quantum then it gets put back into a queue.
Perhaps the hardest part of using the round robin, or certainly the most effective use is gained through appropriate selection of the time quantum. It tends to hold that the best time quantum to use is one that is greater than 80% of all CPU burst times.
Emulating a load scenario using the round robin strategy with CPUSS is dead easy.
1 using Cpuss;
2 using Cpuss.Strategies;
3
4 namespace PerfApp
5 {
6 class Program
7 {
8 static void Main()
9 {
10 Runner runner = new Runner(20, 30, 10, new RoundRobin(60));
11 runner.Run();
12 }
13 }
14 }
Easy. Obviously you will want to perform some analysis on the metrics gathered for each process and so on but I won't go into that here. Also disregard the time quantum I have used (60ns) it was just chosen for demonstration purposes.
Download CPUSS.
I missed this but last Friday the VC blog guys put up some slide decks on the "new" stuff in TR1, I enclose new in quotations because if you've used Boost before then its not new, rather its just the native support for those features - which is a good thing.
http://blogs.msdn.com/vcblog/archive/2008/02/22/tr1-slide-decks.aspx
These are great additions to the language, but if you don't want to use the Beta for fear of breaking something then just download the Boost source and go from there.
Here is the link for the VC++ 2008 Feature Pack Beta (TR1 and MFC).
I've recently been playing with a few scientific tools to find a free replacement for MATLAB, a tool which I think prays too much on the fact that its in a lot of academic facilities throughout the world, I have an issue with the student version...but I won't go into that now.
At the moment I am finding it hard to choose my replacement, on one hand you have Scilab which is really fast, and on the other you have Octave which has an amazingly active community. At present I am dodging in and out of each on my machine but I am heading more towards the Octave camp than the Scilab camp purely for the community.
If you are in a similar position as me then go check them out and if you find anything particularly great about either let me know!
The latest version of the Data Structures and Algorithms (DSA) library is out!
Download DSA 0.4
This latest release contains the following additions:
- QuickSort<T>
- UnorderedSet<T>
- Heap<T>
- ShellSort<T>
- InsertionSort<T>
- RepeatedWordCount
- ToBaseN (Binary, Octal, Hex)
Download DSA 0.4
The documentation has also had a facelift.
DSA 0.5 features will be finalized in the next few days.
Thank you to everyone who has downloaded DSA so far and the feedback provided, so far DSA has been received very well by the community and I hope this latest release will build on that.
For more details on what is in DSA 0.4 please view this page.
Thanks
I just wanted to reiterate briefly that the future releases of CPUSS will be mainly geared towards the development of experimental CPU scheduling strategies.
The main focus will be in both expert rule systems and fuzzy logic when defining new strategies. The aim is to see whether either approach can improve scheduling in certain scenarios. As you will know the reality is that several strategies are actually used in a real system, each one invoked depending on the current context to help attain greater throughput or minimal wait time and so on - these strategies will be created with that in mind.
Note: I have created a new tag for all posts now related to CPUSS so that if you are not interested in receiving project updates and posts on CPU scheduling in general then you have the option to opt out, I know that to many it can be seen as a dry topic thus I provide this option.
...well there still is none.
I seem to be pressing commands in VS 2008 Win32 projects which would invoke pretty basic refactoring tools in C# and VB.NET but yet C++ has nothing! Now I know the VC guys are working on a parser that will help with the intellisense in VS C++ projects (yep lonnnng time off yet) - if like me you don't even waste time with intellisense in C++ projects as its just a disappointment when you are there hitting ctrl + space waiting for something (yep, ctrl + space because intellisense never comes up on its own in C++ projects does it?!) that never quite arrives, the result is that you just wasted 5 seconds - you could of typed it by then.
For about 18 months I used to have C# intellisense turned off by default, yes I know you are thinking why and that I'm an absolute plonker, but honestly I just enjoyed having the freedom of typing whatever the heck I wanted and then sorting it out seconds later rather than battling with intellisense trying to tell me what I meant to do was this. Ctrl + space is your friend, needless to say I do have it turned back on in C# now.
Anyway I digress, what I would really, really love to see is primitive help with mundane boring tasks like extracting methods, renaming with a snazzy live preview of everything that I am affecting, who knows maybe even reorder some parameters?
I know VS 2008 launch parties haven't kicked off yet, but I have to say roll on VS vNext.
This release includes a few new scheduling strategies including:
- Priority First (PF)
- Round Robin (varying time quantum)
Download CPUSS 0.2
As you might expect in CPUSS 0.1 the Process type had no notion of a priority and by default all processes unless stated otherwise have a medium priority.
RR - few words of warning. If you decide to use a time quantum of 1 then you should be aware that you are in effect giving each process in the ready queue 1/n of the CPU where n is the number of processes in the ready queue so it looks like each process has its own CPU, each of which of course is running at 1/n speed of the main CPU. It's somewhat a general rule that the time quantum used should be greater than 80% of CPU bursts (this will reduce the number of context switches).
A custom strategy devised by me was meant to hit this release but I've not had time to properly evaluate the equation I've produced so that will unfortunately have to wait until CPUSS 0.3. The majority of strategies here on in will be those created by me, they may take properties from other established strategies but with various other preconditions and behaviours etc in the hope of creating a "better" strategy for particular scenarios.
There are a few other features I want to add to the actual CPUSS framework in future releases including metrics for preemption, and some events to hook into for that. Quite a few other little features as well would be nice but I'll postpone them to a latter release. Like I mentioned earlier the emphasis for future releases is on the creation of new scheduling strategies using various techniques, e.g. expert rules (this will be in CPUSS 0.3) and fuzzy logic (latter releases).
Download CPUSS 0.2
For some reason I found myself traversing the various tech radio shows and I was on DotNetRocks and I started sifting through all the previous shows and saw that last month Simon Peyton Jones was on the show.
Now, with relation to functional programming Peyton Jones is really a very well known person in the functional space, probably for the main part due to the Glasgow Haskell Compiler (GHC) and more recently (perhaps you have heard of it?) software transactional memory (STM).
The reason I raise this is that there have as of late been people popping up on various media where they are talking about F#, and I appreciate that a lot of these shows are very Microsoft orientated, but it is important to like anything look at the broader range of technologies - Haskell for me is an amazing language, and I prefer this still over F# although F# has that wow factor of being able to pull in imperative stuff like that in the BCL, and interop with managed code etc.
I really feel strongly about this, people should embrace varying languages in the functional space - just because F# is a product of MS doesn't mean that it is the best, both Haskell and F# have their good and bad points. Haskell has stood the test of time and is a leader in the functional space, it has many implementations most notable GHC and Hugs.
I would like to see the developer community in a whole work with a varied amount of technologies before proclaiming that technology X is greater than technology Y. I'll give you an example, people have been heralding Silverlight as of late, however if you question a lot of the people that use such a technology and ask them why it is better than other technologies like Flash they give you the same response that they were told by the MS marketing people - you should make up your own mind based on exploration with the said technologies.
This directly applies to the wave of popularity storming the web with F#, do not proclaim superiority before looking at the other options available.
I just feel that too many people in the MS community have this blind notion that if it comes from MS then if must be the best thing to use, people should educate themselves about the alternatives and their benefits.
Note: I am not implying that Haskell is better than F# or vice versa, rather that each brings a great wealth to that space and should be explored accordingly.
More Posts