Which bit of a 4k page does your program use?


This follows on from the previous post – here are the plots.

These are based on a run of the PARSEC benchmark suite x264 program – encoding 32 frames of video using 18 threads – 16 worker threads: the plots show how often each 16 byte “line” is used – whether as an instruction is read or the memory is used for read-write storage. Sixteen bytes is both the size of a typical cache line and a read from a DDR memory.

all code memonly

 

The code plot might suggest there is some pattern – between about segments 100 (offset 0x640 inside the page) and 200 (offset 0xC80) there is an increased hit rate) but my guess is that is an artefact of the particular code being used here, rather a general issue (possible explanations would be a particular library function being very heavily used): though conceivably it could be an issue with the GCC compiler or linker.

That might be worth further exploration, but not for me. From visual inspection I am concluding that the distribution of accesses inside a 4k page doesn’t justify trying to pre-cache particular 16 byte “lines”.

Enhanced by Zemanta

How much control can Microsoft exert in the development ecosystem?


It’s a long time – over a decade – since I last used a Microsoft development tool. For what it’s worth, I quite liked Visual C++ back then, but in the middle of my subscription (in 1998 if I remember correctly) Microsoft just tore up the contract and offered me something of less use. The details escape me now but it was a formative moment – I was not willing to trust them any more and suddenly the idea of using Linux had new appeal.

 

(At the same time I was teaching myself how to use Unix on the Sun OS system that hosted the Labour Party’s Excalibur EFS document system: after the 1997 general election there was nobody left in the team but me and so I went out and bought the venerable Essential System Administration: Tools and Techniques for Linux and Unix Administration: Help for UNIX System Administrators – which helped but it was still hard going to escape from the Windows monoculture. The Party’s IT staff essentially said “Unix? Does anyone still use that?” – this was truly the apogee of Microsoft’s monopolistic drive.)

 

Today the world seems very different. But if Microsoft have taken a few knocks and people are almost as likely to think of Apple and even Google as the enemies of software diversity and freedom, we should not underestimate its raw power in the market. Most desktops in most workplaces are still Windows boxes and writing for the mass market means targeting Microsoft’s operating system.

 

The Windows family tree.

Not surprisingly many, probably most, of the people who are doing that are using Microsoft’s tools and compilers. That gives the boys and girls in Redmond a lot of power and they don’t have to be acting in a malicious way to have an detrimental impact – as in their refusal to support the C99 language standard. The only mantra that C is a proper subset of C++ (which Microsoft fully support) has been dead for a few years now and there are features in C99, which is the standard in general use in the Unix/Linux development world not supported in C++11 (the current standard there which Microsoft are working to support). Microsoft do support the twenty year old C90 standard but have essentially said that they are not going to develop that any further – you can read more about this here.

 

In response to this some C++ developers have done so far as to say “C is obsolete” – perhaps reflecting a new confidence in the C++ development world, as that language has been making something of a comeback in the last couple of years (not least because Microsoft have promoted it so heavily).

 

That may or may not be the case – personally I doubt it very much. But since when did we allow tool manufacturers to make that decision for us?

 

As I did in 1998 maybe it is time for the developers to look at the alternatives. There are plenty of industrial strength compilers and editors out there that will free them from the caprice of a company which is once more demonstrating it just doesn’t get it.

 

 

A question for a C guru


English: Dada guru
Image via Wikipedia
The debugging continues, but unfortunately I have not yet been able to identify what is fundamentally broken with my file system code.

But along the way I have spotted and fixed various bugs. Here is one, I am not even sure why it compiled in the first place, so maybe a C guru could tell me…

Was:

if le16_to_cpu(((u16 *) bh->b_data)[j * VMU_DIR_RECORD_LEN16 + VMUFAT_FIRSTBLOCK_OFFSET16] == ino)

Now:

if (le16_to_cpu(((u16 *) bh->b_data)[j * VMU_DIR_RECORD_LEN16 + VMUFAT_FIRSTBLOCK_OFFSET16]) == ino)