Archive for September, 2010

The Town

Ben Affleck has directed a second movie with a real sense of place in Boston, The Town. Since I grew up outside of Boston, it’s really nice to see a movie which is set in Boston and has characters whom one can believe actually grew up there. Plus it has several scenes in Cambridge, where I grew up, and they were actually shot in Cambridge.

The only slightly discordant note was that it was hard to believe that the Rebecca Hall character would actually live in Charlestown. She looked and acted entirely South End to me. I know people who have lived in a lot of different neighborhoods in Boston and the surrounding cities and towns, but I’ve never known anybody who lived in Charlestown who didn’t grow up there. Still, I suppose there must be a few.

It was also a good movie apart from the setting, by the way. Ben Affleck seems to be heading toward Clint Eastwood territory, which is probably a good thing for him to try considering the number of horrible movies he’s been in.

I also recently saw a movie which completely failed to have a sense of place, although it was essential to the plot. Going the Distance is about a long-distance romance between Drew Barrymoore in San Francisco and Justin Long in New York. The movie was adequate, but for me it was really damaged by the fact that despite the plot hinging on where the characters lived, the San Francisco scenes were very obviously not shot in San Francisco.

Comments (2)

School Testing

I always did extremely well on standardized tests in school, which convinces me that the standardized tests are almost completely useless for assessing knowledge or intelligence or the skills of one’s teacher. Success at standardized tests does not require general intelligence, it requires the particular ability to think like the people who create the tests. Where my friends would sometimes get hung up on issues like trying to figure out the right answer to a question, my approach was instead to figure out which answer the test writers were looking for. This approach only works for multiple choice tests, but in that limited arena it was highly effective.

I still recall my moment of realization in high school. There was a pair of math tests which were the leadin to selecting the members of the U.S. team for the International Math Olympiad. The first test was multiple choice, I think 100 questions, and I did very well as usual. I placed third in the state or something, at any rate good enough to go on to the next level. The second test was a series of five or so math problems. You had three or four hours to solve them. The questions were essays, and so were the answers—no multiple choice. I scored a zero. I could understand the questions, but I had no idea whatsoever how to actually solve them. A good friend of mine, on the other hand, did know how to solve them, and in fact went on to be a member of the U.S. team.

My conclusion is that standardized tests tell you something, but they don’t tell you what you really want to know: a good a student is operating in the real world. The big school reforms which are based on using standardized tests to assess students, like Bush’s No Child Left Behind or Obama’s Race to the Top, are thus based on an invalid premise. And when you start to judge teachers based on how well their students do on standardized tests, you are creating a perverse incentive: you are rewarding them if they produce students who do well on tests rather than producing students who do well in the real world.

I do agree that assessing students is important: you need to know how well your student body is doing. And standardized tests are the best mechanism I know for doing so: they are easy to hand out, easy to grade, and if they are carefully written (which is very hard) they can results which can be compared across socio-economic gaps. But you must always be deeply aware of the shortcomings of these tests. They are telling you something, but they are not telling you everything or even most of what is important.

When tests are used to assess the quality of teachers, you are falling deep into the measurement problem: you are judging people based not on what they are achieving, but based on what you can measure.

And all that said, I do agree that it is important to assess teachers, because there are bad teachers out there. I had some of them myself. There has to be some way to get them out of schools and into some place where they can stop holding children back. It’s just that standardized testing is not that way. Just because there is something we need to do, and there is something else that we can measure, we should not start to think that the thing we can measure will tell us what we need to do.

Comments (12)

School Balance

Both Cambridge, Massachusetts and Berkeley, California have made efforts to balance the public elementary schools by family income. They do this by dropping the idea of the neighborhood school and instead sending some children to schools across the city, in order to get the average family income roughly equal at every elementary school. They do because some research has shown that when schools mainly have children have poor families, the children do less well than they do when the school has more of a mix of families. The same research shows that the middle-income children continue to do OK in that scenario (of course all sorts of caveats apply, but you have to go with what you have).

As a public goal, this seems laudable. However, it has an unintended yet predictable consequence. There is a strong attraction to a neighborhood school at all income levels. Besides being close by, it means that your kid’s friends will live close by. Once your kid has been assigned to some remote school, those advantages disappear. At that point, families who can afford it start to consider their options. They consider that the private schools are no farther, and will have student bodies more like their own kids. They cost a lot, but maybe it’s worth it.

That is, one effect of these systems is to push the wealthier families out of the public school system entirely, thus lowering the average income and partially frustrating the purpose of the move in the first place. It would be interesting to know how strong this effect is: how many people switch to private school when they are unable to send their kids to the neighborhood public school.

Comments (1)

STT_GNU_IFUNC

I recently added support for STT_GNU_IFUNC to gold.

As you can tell by the name, STT_GNU_IFUNC is a GNU specific ELF symbol type. It is defined in the range reserved for operating system specific types. A symbol with type STT_GNU_IFUNC is a function, but the symbol does not provide the address of the function as usual. Instead, the symbol provides the address of a function which returns a pointer to the actual function. The idea is that this lets a program use a version of a function which is customized for a particular system. A typical example would be memcpy; the program would choose a version of memcpy optimized for the current CPU. This is in fact what happens in the mainline version of glibc.

STT_GNU_IFUNC is implemented with a little bit of support in the compiler and assembler, basically just enough to set the symbol type. The rest of the implementation is in the linker and the dynamic linker. Here I’ll discuss the support required in the linker.

An STT_GNU_IFUNC symbol always uses a PLT entry, and all references to the symbol go through the PLT. This is true even for a local symbol, although local symbols normally do not require PLT entries. The PLT entry will refer to a GOT entry as usual. The GOT entry will be given an IRELATIVE reloc (a new reloc type) rather than the usual JUMP_SLOT reloc. For a normal PLT entry the GOT entry is initialized to point to the PLT entry, in a way that causes the PLT entry to initialize itself the first time it is called. For an STT_GNU_IFUNC PLT entry, the GOT entry instead points to the symbol’s value, which is the function to call to get the real function address.

Normally, when we need a GOT entry for a function because position independent code takes its address, and we know the value of the function because we are, say, linking the executable, we can set the GOT entry to the value of the symbol. But for an STT_GNU_IFUNC symbol, that would mean that calling the function pointer would return the function to call, rather than calling the actual function. So instead we set the GOT entry to point to the offset in the PLT.

When a global or static variable in a position independent executable is initialized to the address of a local function, we would normally use a RELATIVE reloc. For an STT_GNU_IFUNC symbol, we instead use an IRELATIVE reloc. That will match the address seen in a shared library.

A statically linked executable normally does not have any dynamic relocs. In order to make the IRELATIVE relocs work in a static executable, they are grouped together with symbols to mark the begin and end of the group. The glibc startup code then uses those symbols to resolve all IRELATIVE relocs when the program starts. The symbols are __rel_iplt_start and __rel_iplt_end. For a target which uses SHT_RELA relocs, the symbol names use rela instead of rel.

That is pretty much it for the linker support.

Ideally this would permit STT_GNU_IFUNC symbols to be initialized lazily: the first time the function is called, the PLT entry would jump to the function which returns the real function address to use, and that would be stored into the corresponding GOT entry for future calls through the PLT. However, there is no code there to actually update the PLT entry. Normal PLT initialization calls into the dynamic linker; this process would not. It might be possible to make this work, but the current glibc dynamic linker does not try. Instead, all the IRELATIVE relocs are processed when the program starts up, even if they are in the set of relocs which are normally resolved lazily.

That is all a bit of pain, but overall it’s not too hard to implement. Is it really worth it? Calling an STT_GNU_IFUNC function will jump to the PLT entry, which will load a value from the GOT and jump to it. On x86 this is a single jump indirect instruction. For the CPU this requires loading the jump indirection instruction, loading the actual address, and executing the jump.

An alternative to all this linker stuff would be a variable holding a function pointer. The function could then be written in assembler to do the indirect jump. The variable would be initialized at program startup time. The efficiency would be the same. The address of the function would be the address of the indirect jump, so function pointers would compare consistently. Of course it wouldn’t be quite so automatic, but on the other hand it wouldn’t require special support in the compiler, assembler, linker, and dynamic linker. I’m not sure why that approach was not taken. There may be a good reason.

Comments (3)

Inception

I enjoyed watching Inception, and as far as I could tell it was a consistent if complex story for the world that it set up. But that world was a very weird one. If my subconscious mind wanted to get rid of some outside influence within the context of a shared dream, it certainly would not resort to people with guns. There would be a massive tidal wave, or everybody would be swimming through jello, or something equally odd. I don’t remember many of my dreams, but the ones that I do remember are nothing at all like the scenes in Inception. And if I were dreaming the Cillian Murphy role when he finally confronted his father, I’d like to think that even my subconscious would be a bit suspicious, and just see the scene as an example of wish fulfillment.

Still the movie is certainly worth seeing.

Comments (1)

« Previous entries Next Page » Next Page »