Saturday, May 12, 2012

Why the justice system sometimes wants more crime and what to do about it

The political posturing side of being "tougher on crime" than the other guy is obvious. However, one should also look at other aspects of the incentive system surrounding "justice" in the US.

Prison builders and prison guards' unions income is determined by the aggregate number of prisoners, not by the outcome of the correctional process. An obvious outgrowth of this is their lobbying for longer sentences for crimes, violent or otherwise. A less obvious aspect is that they are de facto rewarded for higher crime rates and recidivism. Economically, there is a disincentive to effectively rehabilitate those who have been incarcerated. The prison industry can also be seen to benefit from employment discrimination against those who have been convicted of a crime, thereby providing them with fewer legitimate means for seeking income. 

There are many other issues contributing to this as well, some of which are: 
  •  Only 3% of cases go to trial at the federal level and 4% at the state level, the remainder being resolved by means of "plea bargains" which frequently amount to coerced confessions. Consequently, the absolute number of trials is less than it was 30 years ago in spite of the number of inmates having increased by more than 1000%.
  • Prosecutorial and judicial accountability has been steadily eroded since the 60s - Nifong and the judges in the "kids for cash" were unique more in that they were held to account than in the actual nature of their conduct. 
  • Americans fundamentally view their fellow citizens as disposable. There is a deeply entrenched notion that "people don't change" that becomes evident when they come in contact with members of other cultures and discuss reform. Accept it or not, the "throw-away" society doesn't just describe Americans' consumer habits. Hence less and less emphasis is placed on reforming behavior and more and more on punishment. 
  • There is a great deal of money invested in the status quo and no voter interest in change. Newspaper readers want to read news that reinforces their existing views of the "justness" of the justice system and thus it is the reporters' job to report on stories that support that view as opposed to presenting a more representative view of the actual functioning of the system as a whole.
 Now that many of the largest states like New York and California are essentially insolvent, they are having to enact reforms to a system that, had it been run ethically and transparently, by actually providing defendants with the due process that we were all taught about in civics class, they never could have afforded in the best of times. It would behoove them to examine the re-integration practices of more advanced countries to minimize the increases in crime now that will result from them no longer being able to hold as many people off the street.

There are stories of abuse and de facto corruption in justice systems throughout the world. Frequently, the response of a state needing convictions is to weaken protections. In Germany in the 20s juries acquitted too often, so trial by jury was eliminated. Starting at some point in the 60s the UK made jurors commit to perpetual secrecy on jury deliberations, thereby preventing any later oversight of the prosecutor's or the judge's handling of the case. The US courts have continually diminished the rights of juries, mentioning "jury nullification" or the sentences entailed by the charges which a defendant is being tried for is illegal. In recent events HR. 5652 which would cap punitive damages at 2x economic damages or 250,000$, also states: "The jury shall not be informed about the maximum award for non-economic damages." Yet in spite of these curtailments state courts only try roughly one in twenty five cases.

Inevitably with as many things being subject to criminal sanction as there are today in the US it is a lottery as to how and whether they are enforced. I often like to say it is like playing Russian roulette, what varies from country to country is the number of chambers with a bullet in them. 

Although Italy isn't the paragon of governments, their justice system has a number of checks on the extent to which individuals can abuse their power: 
  • Selective prosecution is illegal e.g. in a case in which the plaintiffs who had all engaged in some sort of fraud or another against the defendant would all have to have been prosecuted. This prevents DA's offices from effectively being used, inadvertently or deliberately, to advance criminal interests. 
  • If the total sentence for the charges exceeds 5 years then the case has to go to trial. This limits the extent to which prosecutors can cheaply rack up "convictions" by coercing confessions through overcharging (it is common in the US for a prosecutor to give a defendant a dozen charges and then offer a plea for one - putting a very high penalty on losing at trial). 
  • In Italy prosecutors are actually charged and prosecuted for misconduct. In the US a prosecutor typically has to have numerous instances of alleged misconduct over the course of decades before a state bar will do anything. Nifong's case was extremely unusual - not in what he did, but in that the defendants had the money for truly independent counsel (I'll discuss further in a later post how most defense attorney's are not sufficiently independent to adequately defend their charges) and the PR muscle to get him removed. 
  • In Italy the appeals courts look at the actual merits of the case as opposed to simply the legal basis on which the case was tried and consequently actually overturn a statistically significant number of convictions. In the US an appeals court that does this is rebuked for "second guessing the jury". It is sad, recognizing the fallibility of individuals used to be regarded as oversight, not "second guessing". 
In short, the Italian legal system recognizes that prosecutors and judges are fallible people just like the defendants themselves. The US justice system with fewer than 3% of cases going to trial at the federal level and fewer than 4% of cases going to trial at the state level and virtually no oversight over prosecutors or judges presupposes that members of the justice system are vastly more ethical than the man on the street. Without stooping to name calling, I'd like to point out that by definition judges are all, not just lawyers, but political lawyers.

Monday, March 5, 2012

The extremes of prosecutorial discretion and its abuse

Addendum on "domestic violence" laws: I believe that the reason that domestic violence laws exist as a separate class from assault is that it allows the prosecutor to circumvent marital privilege enabling them to force the aggrieved party to testify or prosecute even if no physical injuries were inflicted. The essential premise is that the state understands the alleged victim's interests better than the alleged victim him or herself. One thing that isn't clear to much of the public is the extent to which investigations and prosecutions are almost entirely discretionary. An exaggerated but useful contrast is provided comparing Jacob Appelbaum's experience with mine. When his father died in San Francisco in 2004, their home was robbed, he felt he had evidence of serious wrongdoing, tantamount to murder. When he approached the police about it, they threatened him with arrest in his own home for turning in what he considered to be evidence. The response of the officer on duty? "Kid, no one cares about dead junkies. Give up." The other extreme being, when attorney Stephen Collier, part of the powerful Tenderloin Housing Clinic, got frustrated at having the counterparty to a suit refuse to tender his case to the counterparty's insurance company, but didn't want to file for a default judgement because he knew that the judgement would be a fraction of what he would get at trial or from an insurance shakedown, he took a dramatized version of his complaint to the DA's office. The line prosecutor, without having even initiated an investigation, committed to prosecuting the case for Mr. Collier.

Ross Mirkarimi and the abuse of the Justice System for political and financial ends

Although I have never been all that fond of Mirkarimi as a politician, I have been absolutely appalled by what has been taking place in San Francisco Superior Court. I'm sure that it affords him little consolation, but having experienced much worse abuses myself I felt compelled to reach out and support him.

Hi Ross,

Although I admit we were never exactly big political advocates of
yours as a member of the Board of Supervisors even before Tenderloin
Housing Clinic backed Russ Giuntini and the local tabloid that the
SFDA's office funnels its sealed affidavits through decided to dub us
"the landlords from hell" thus ousting us from polite society, it
makes us furious what you're being put through. One simply doesn't
treat people like that. Besides the fact that domestic violence as a
separate act shouldn't exist - it should either be prosecuted as
assault or nothing, and besides the fact that it is essentially
victimising the woman again in several ways: a) threatening her
welfare by threatening yours b) stripping her of the right to
self-determination by prosecuting the case against her will c)
stripping her of her privacy by putting everything she has said or
done on the front cover of the paper, this is fundamentally an effort
to subvert the democratic process. You evidently made the mistake of
running a successful campaign against the person being supported by
the in-crowd. This recurring abuse of the "justice system" to foster
the financial or political advancement of the more politically
connected is, for lack of a better word, disgusting.

Lacking the deep pockets to provide a balanced viewpoint and
accountability in the court we had little choice but to leave after
having watched the judges break the law one too many times. With your
future welfare tied to local politics and the comparative financial
cost of defending your case being much less than mine was, it is in
part easier for you to fight it out and you have much more reason to
do so. I hope you are able to endure the emotional tribulations and
not bow down or make any concessions. Furthermore, I hope that,
regardless of the outcome, you will not turn the other cheek, but
instead find a way to discourage this sort of behaviour in the future.

And perhaps once it is all over you can find out for me why it isn't
fraud for a prosecutor to prevent the exoneration of 500,000$ bond on
the grounds that "he intends to extradite" when he clearly has no
intention to do so. Enriching the city's coffers is no more part of
his mandate than help making sure the "right person" is sheriff.

Once upon a time the US was a guiding light for the world, but looking
around at how Italy and Switzerland handle re-integration and
re-socialization of those who have been in their correctional systems,
and seeing some of the checks that they have on feral prosecutors, it
is clear that the US has fallen far behind the rest of the developed
world. I hope that you will learn from what you have been put through
and at least in some small part make an effort at reforms for the sake
of others.

Best Wishes,
Kip Macy

Please see my follow up on domestic violence prosecution and prosecutorial discretion.

Tuesday, January 31, 2012

In honor of the NDAA and our great HOPE

In honour of the passage of the NDAA I thought I'd pass on this inspiring campaign poster.

Tuesday, January 5, 2010

ZFS, ARC, page cache, and 1970s buffer tuning

Some time ago Pawel Dawidek ported Sun's ZFS to FreeBSD. ZFS has many interesting features.

One of the more problematic features on general purpose systems is the disk block caching in the ARC (Adjustable Replacement Cache). The way FreeBSD's native file system do caching is by storing a file's pages at the appropriate offset in the file's vnode's associated vm object. Typically, unless a page is actively being written to or read from disk, i.e. it is associated with a buf, it can be taken away from the vm object by the pagedaemon to be used somewhere else in the system. In ZFS' ARC disk blocks are cached by their DVA (oversimplifying, but effectively their block offset on disk). I won't go in to the rationale for this design choice, but this precludes us from using the existing mechanism for coupling file caching with the VM system. ARC buffers are allocated from "wired" memory, meaning that the pagedaemon cannot evict them and it has no information about their usage relative to other pages in the system (i.e. the buffer can be released and the memory re-allocated to some other service).

As a result of this, the VM does not have the ability to determine how "hot" a ZFS buffer is vis a vis other ZFS buffers or other parts of memory. The VM can only influence the overall usage  of the ARC by calling the lowmem handler to free some number of buffers. However, it has no way of determining relative priority of ZFS memory usage versus user applications. A system administrator is left to deciding a priori what the minimum ARC size is (the size below which memory pressure and the lowmem handler will not shrink it) and what the maximum size is (the ARC memory above which the ARC will not allocate further buffers). On a dedicated system one can set a large arc_max and arc_min, however, none of this yields graceful management of resources under mixed workloads.

Ideally one could keep the default ARC settings small but still use all of memory for block caching if it isn't in use by other applications.

To this end I've added a caching layer in between the memory allocation functions (zio_buf_alloc and zio_buf_free) and their consumers. Caching of buffer pages is limited by ZFS' rather idiosyncratic allocation patterns. Thus, the bulk of allocations by allocation count are still malloc backed (not eligible for page caching). Only the 128k buffer allocations all tend be size aligned with worst alignment I've seen in practice being 32k aligned and thus practical to track by their alignment on disk. Unfortunately, the block offset isn't usually available at allocation time so I allocate 128k buffers using the anonymous allocation function, geteblk(), and then synchronize with the vm object when I/O is done using the buffer.

All I/O traverses zio_create, thus if a read or write is being done to a top level logical device the I/O is synchronized with cache in the new function zio_sync_cache(...)

more later ...


Its been a while. Flowtable support made it by default in to 8.0. One oversight that come up shortly afterwards is that it adversely impacts performance for systems with many routing prefixes to a greater degree than I had expected. I should probably have it automatically be disabled if there are more than a handful of prefixes in use on a system.

Sunday, November 23, 2008

per-cpu flow caching in FreeBSD

Along with some other experimental work (multiple transmit queues - which have just now made it in to HEAD) I now have per-cpu flow caches in a personal svn branch:

Interestingly enough, with small numbers of connections with TSO enabled there is little measurable benefit for normal frames or 9k frames. Evidently TSO does a sufficiently good job of coalescing calls down in to ip_output that the reduction in lock contention or lookup time doesn't measurably impact performance. However, with an MTU of 1500 bytes and TSO disabled there is a clear impact. Below, "current" is flow caching disabled and using a single transmit queue and "multiflow" is flow caching and multiple transmit queues enabled.Measurements are in Gbps using Robert Watson's tcpp:

./tcpp -c -p 4 -t 100 -m 100 -b 10000000

This connects to with 4 processes, each process creates a 100 connections and pushes 10MB across each connection before closing.

ministat -c 90 -w 74 current multiflow
x current
+ multiflow
| xx + |
|x x xxx + + |
|x x xx x xxxx ++ + ++ + + +++ + +|
| |____A__M_| |________AM_______| |
N Min Max Median Avg Stddev
x 19 1.886103 2.457827 2.388812 2.2664012 0.20140299
+ 15 3.476315 4.744577 4.153121 4.1130334 0.35428067
Difference at 90.0% confidence
1.84663 +/- 0.163126
81.4786% +/- 7.19758%
(Student's t, pooled s = 0.2788)

As you can see from ministat, there is an 81% increase in throughput over the default implementation for 400 connections spread over 4 processes. Interestingly, there is a 30% increase in performance even for single connections. This would appear to indicate that rtentry and ARP lookup are fairly expensive.

I took these measurements a week ago. I've managed to substantially further improve aggregate throughput since then. However, I'll talk about that another time.