问题 单项选择题

下面是一个并发进程的程序代码,正确的是()。

 

A.进程不会死锁,也不会“饥饿”

B.进程不会死锁,但是会“饥饿”

C.进程会死锁,但是不会“饥饿”

D.进程会死锁,也会“饥饿”

答案

参考答案:B

解析:

仔细考察程序代码,可以看出是一个扩展的单行线问题。也就是说,某单行线只允许单方向的车辆通过,在单行线的入口设置信号量y,在告示牌上的车辆数量必须互斥进行,为此设置信号量x1和x2。若某方向的车辆需要通过时,首先要将该方向来车数量c1或c2增加1,并查看自己是否是第一个进入单行线的车辆,若是,则获取单行线的信号量y,并进入单行线。通过此路段以后驶出单行线时,将该方向的车辆数c1或c2减1(当然是利用x1或x2来互斥修改),并查看自己是否是最后一辆车,若是,则释放单行线的互斥量y,否则保留信号量y,让后继车辆继续通过。双方的操作如出一辙。考虑出现一个极端情况,即当某方向的车辆首先占据单行线且后来者络绎不绝时,另一个方向的车辆就再没有机会通过该单行线了。从而造成“饥饿”。由于有信号量的控制,死锁的可能性没有了(即双方同时进入单行线,在中间相遇,造成双方均无法通过的情景)。

单项选择题
单项选择题

Who is poor in America This is a hard question to answer. Despite poverty’s messiness, we’ve measured progress against it by a single statistic: the federal poverty line. In 2008, the poverty threshold was $ 21,834 for a four-member family with two children under 18. By 1his measure, we haven’t made much progress. Except for recessions, when the poverty rate can rise to 15 percent, it’s stayed in a narrow range for decades. In 2007—the peak of the last business cycle—the poverty rate was 12.5 percent; one out of eight Americans was "poor. " In 1969, another business-cycle peak, the poverty rate was 12.1 percent. But the apparent lack of progress is misleading for two reasons.

First, it ignores immigration. Many immigrants are poor and low skilled. They add to the poor. From 1989 to 2007, about three quarters of the increase in the poverty population occurred among Hispanics—mostly immigrants, their children, and grandchildren. The poverty rate for blacks fell during this period, though it was still much too high (24.5 percent in 2007). Poverty "experts" don’t dwell on immigration, because it implies that more restrictive policies might reduce U.S. poverty.

Second, the poor’s material well-being has improved. The official poverty measure obscures this by counting only pretax cash income and ignoring other sources of support. These include the earned-income tax credit (a rebate to low-income workers), food stamps, health insurance (Medicaid), and housing subsidies. Although many poor live hand to mouth, they’ve participated in rising living standards. In 2005, 91 percent had microwaves, 79 percent air-conditioning, and 48 percent cell phones.

The existing poverty line could be improved by adding some income sources and subtracting some expenses (example: child care). Unfortunately, the administration’s proposal for a "supplemental poverty measure" in 2011—to complement, not replace, the existing poverty line—goes beyond that. The new poverty number would compound public confusion. It also raises questions about whether the statistic is tailored to favor a political agenda.

The "supplemental measure" ties the poverty threshold to what the poorest third of Americans spend on food, housing, clothing, and utilities. The actual threshold not yet calculated—will probably be higher than today’s poverty line. Moreover, this definition has strange consequences. Suppose that all Americans doubled their income tomorrow, and suppose that their spending on food, clothing, housing, and utilities also doubled. That would seem to signify less poverty—but not by the new poverty measure. It wouldn’t decline, because the poverty threshold would go up as spending went up. Many Americans would find this weird., people get richer, but "poverty" stays stuck.

What produces this outcome is a different view of poverty. The present concept is an absolute one: the poverty threshold reflects the amount estimated to meet basic needs. By contrast, the new measure embraces a relative notion of poverty: people are automatically poor if they’re a given distance from the top, even if their incomes are increasing.

The author thinks the existing poverty line()

A. is a faithful measure of poverty

B. is not adequate as a measure

C. is not as good as the supplemental measure

D. should have been discarded long ago