LRU queue strangeness


Prinzipdarstellung der Arbeitsweise einer MMU
(Photo credit: Wikipedia)

For the last week or so I have been writing and then debugging (and so mainly debugging) a least-recently-used (LRU) page replacement system on my Microblaze simulation.

Perhaps I shouldn’t have bothered – I had a working first-in-first-out (FIFO) system after all. But no one seriously uses FIFO, so I had to write some LRU code.

I thought I had it working tonight – it ran through the target exercise in about 6 million instructions (as the MMU in a Microblaze is crude, memory gets loaded in and out ‘by hand’ and so the instruction count measures time/efficiency) when the system had 32 4k local pages and in about 10.5 million instructions when it had 24 4k pages available locally – all seems fine: less pages means more time is required.

But then things started to get weird – testing the system with 28 pages took about 9 million instructions, but when I tried to use 26 pages I had to break the code after it had executed 14 trillion instructions.

Indeed it seems to only work for a very limited number of page counts. How odd – though a typically debuggers story. A week in, finally thinking I’d cracked it when some really strange behaviour manifests itself.

Update: It appears to be an unaligned data exeception issue. Somewhere along the line a piece of code relies on the LRU queue to be a multiple of 4 in length would be my guess…

There is no such thing as “alternative medicine”


There is no such thing as “alternative medicine” – any more than there is “alternative mathematics”.

Yes, there are different ways to practise medicine, just as there are different ways of calculating the value of pi – but the fundamental remains: something is either medically valid or it is not. If it is not – and that means if it cannot prove its efficacy – then it is not any sort of medicine.

I am move to write this by two things – firstly what appears to be a major outbreak of measles in the United States that has been brought about not by a failure of medicine but by a cold and deliberate attempt to undermine medicine, and secondly by the current vogue in the UK of otherwise rational people saying they would support the Green Party – a party dedicated, amongst other things to the promotion of anti-science in medicine.

The US measles outbreak is not just because of the “irresponsible and dishonest” work of Andrew Wakefield – a man who manipulated research findings in a way that stood to bring substantial financial benefits to lots of people he was associated with. Wakefield has been thoroughly discredited by anyone with the remotest concern for scientific credibility.

What has fuelled the outbreak is the belief by some – too many – that somehow they know better than science that their “alternative” medicine is better. In fact they are putting the lives of their children at risk through their refusal to accept medicine. If you want a contemporary example of “shouting fire in a crowded theatre” then this, surely, is it.

As for the Green Party – which were reported to be as high as 11% in one opinion poll last week and which have also won the right to appear in leaders’ debates on UK television – at least they are no longer explicitly describing homoeopathy (also known as “water”) as “natural medicine”) and they have also seemingly distanced themselves from past demands that scientific research only follow government-approved routes (Lysenko-ism anybody?). But they still state this on their policy website:

Current theory and practice place too much emphasis on interventions at the biochemical and individual levels, too little on the social and ecological.

Of course, perhaps that is just a meaningless left-over from their past days as new age hippies – but it has a distinct anti-science tone to my ears, especially as it is followed up with the statement that their aim is to:

…develop a new public health consciousness, which, through individual and collective action, will challenge vested interests and promote the personal, social and political changes needed to achieve improved states of health.

Wouldn’t actually some new “biochemical interventions” also be a good idea? I certainly think so, but if health is all about lifestyle you might feel otherwise.

Then there is this “aim”:

To develop health services which place as much emphasis on illness prevention, health promotion and the development of individual and community self-reliance as on the treatment and cure of disease. Such services will of necessity be empowering, participatory and democratic and their development will be guided by users’ own perceptions of their health needs.

By now I am beginning to feel distinctly uncomfortable – to me the above statement is seriously anti-scientific in tone and intent: truth, after all, is not democratic.

And, then, under policies we have this:

We will work to reduce the number of interventions in childbirth, and change the culture of the NHS so that birth is treated as a normal and non-medical event, in which mothers are empowered and able to be in control.

(Shades here of the Soviet approach – and the claim that pain was all in the mind of the mother – as described in Red Plenty. Most mothers I know were very glad of medical help at birth, especially in the form of pain relief. Is the Green Party’s policy really to “change the culture” of the NHS to limit access to that?)

And this…

The safety and regulation of medicines will be controled by a single agency. This agency will ensure that medicines meet minimum safety standards, provide clear labelling of both ingredients and side-effects. The agency will cover existing synthetic medicines as well as those considered as natural or alternative medicines.

Considered by whom to be “alternative” medicines? It’s not a purely rhetorical question as the Green’s current sole MP, Caroline Lucas, has a disappointing record as an advocate of “alternative” medicine campaigns funded by commercial interests in this field.

Not fit to hold public office


John Mason, Scottish National Party MSP for Glasgow Shettleston, has (today) tabled the following motion in the Scottish Parliament:

That the Parliament notes that South Lanarkshire Council has issued guidance concerning the appointment and input of chaplains and religious organisations in schools; understands that some people believe that God created the world in six days, some people believe that God created the world over a longer period of time and some people believe that the world came about without anyone creating it; considers that none of these positions can be proved or disproved by science and all are valid beliefs for people to hold, and further considers that children in Scotland’s schools should be aware of all of these different belief systems.

Nobody has proved P=NP


Which are the world’s fastest computers?

The answer is not to be found, I’d guess, in the Top500 list. Instead they are surely to be found somewhere in the US National Security Administration or maybe even in the UK’s Government Communications HQ.

So the fact that David Cameron is calling for the banning of all internet encryption (yes, I know that’s crazy, but he’s said it), tells us that neither of these agencies (which co-operate very closely) has managed to prove P=NP and so reverse the “one way” functions on which internet encryption depends.

It has been suggested that proving P=NP would not, for most of us, make much difference – as although there might be an algorithm available to crack the problems it might be so complex that it’s not much use – but that is where the huge computing power available to the national communications agencies would matter – and so Cameron’s remarks do point even more strongly to no P=NP breakthrough.

The limits of university power


Keyser Quadrangle in Spring at the Johns Hopki...
Keyser Quadrangle in Spring at the Johns Hopkins University (Photo credit: Wikipedia)

I am writing this from a hotel room in Washington DC, but this afternoon was spent in Baltimore, watching the Ravens play their last home game this season.

(The eldest daughter being a big Ravens fan this was a must. It was not a great game, though the atmosphere improved dramatically in the final quarter as the Ravens went ahead.)

One lasting impression is going to be of the depressed nature of Baltimore – this really does seem to be a city that was dying on its feet. For sure, I had faithfully watched every last episode of The Wire but it was still a surprise to see a city that only appeared run-down (one daylight rail journey, one taxi journey and one light rail trip are hardly comprehensive, but it is still remarkable that nowhere seemed to shine with prosperity).

But one thing struck me more than anything else – and that was that Baltimore appears to be the living rebuttal of the idea that high quality higher education could and should be at the core of urban economic growth and renewal.

Baltimore houses what is undoubtedly one of the world’s greatest scientific universities – Johns Hopkins – and travelling from Penn Station to the Ravens’ stadium also took us past buildings of Baltimore University and the University of Maryland. What there was not was the sense that Baltimore was a city thriving on the scientific and medical spin-offs and the thriving cultural and knowledge economies that we should expect.

 

The death of Dr Dobb’s


It seems that Dr Dobb’s has come to the end of its useful life – and is to be, in effect, placed in an online casket.

To be honest it is some time since I read it – I used to like the magazines as they were something that you could take out at any time and flick through – you just cannot do that with online media.

Like Byte before it Dr Dobbs was a magazine for those who had an interest in computing that stretched beyond what one operating system on one sort of computer could do. And like Byte before it, it seems it has been brought to its knees by the disruptive technology it for so long championed.

The statement about the “sunset” of Dr Dobb’s contains a warning for all those who say that publications should just face the facts and go online:

four years ago, when I came to Dr. Dobb’s, we had healthy profits and revenue, almost all of it from advertising. Despite our excellent growth on the editorial side, our revenue declined such that today it’s barely 30% of what it was when I started. While some of this drop is undoubtedly due to turnover in our sales staff, even if the staff had been stable and executed perfectly, revenue would be much the same and future prospects would surely point to upcoming losses. This is because in the last 18 months, there has been a marked shift in how vendors value website advertising. They’ve come to realize that website ads tend to be less effective than they once were. Given that I’ve never bought a single item by clicking on an ad on a website, this conclusion seems correct in the small.

Simulating global and local memory on OVP


The Simons' BASIC start-up screen
The Simons’ BASIC start-up screen (Photo credit: Wikipedia)

Had a good meeting with my PhD supervisor today: he was in London – I didn’t have to make a flying visit to York.

So the next steps with my OVPsim Microblaze code is to model global and local memory – by default OVPsim treats all memory as local, mapping the full 32-bit address space and sparsely filling that as needed. I have imposed an additional constraint of only mapping a few pages, but these are still all “local”: so while the code takes time to execute, what is in effect, a FIFO page replacement algorithm, there is no time for page loads.

The way round this seems to be to build my global memory as a memory-mapped peripheral device – I can then impose time delays on reads and writes.

But I suppose I am writing this blog instead of writing that code…

Follow

Get every new post delivered to your Inbox.

Join 1,057 other followers

%d bloggers like this: