问题 问答题

对下图中的事务Ti和Tj构造一个符合两阶段锁协议并且冲突等价于串行调度<Ti:Tj>的并发调度。

Ti Tj
read(C) C:=C+1
write(C) read(A)
A:=A*2 write(A)
read(A) A:=A+1
write(A) read(B)
B:=B+1 write(B)

答案

参考答案:

Ti Tj
Lock-X(C)
read (C)
C:=C+1
write(C)
-
-
-
-
-
-
-
-
-
-
-
Lock-X(B)
read(B)
B:=B+1
write(B)
unlock(A)
-
-
-
-
-
Lock-X( A)
unlock(C)
read(A)
A:=A*2
write(A)
unlock(A)
Lock-X(A)
read(A)
A:=A+1
write(A)
-
-
-
-
unlock (B)

解析: 此题考查了两阶段锁协议和可串行化调度的内容。两阶段锁协议将每个事务的执行过程分为加锁阶段和解锁阶段。在加锁阶段,事务可以申请获得数据项上的任何类型的锁,但不允许释放任何锁。在解锁阶段,事务可以释放任何数据项上的任何类型的锁,但不能再申请任何锁。每个事务开始执行后就进入了加锁阶段。当第一次释放锁后,即转入解锁阶段。如果一个并发调度冲突等价于某个串行调度,则该并发调度是冲突可串行的。

选择题
阅读理解

Well, parents, surprise! Lots of us are using Twitter and Facebook to thumb rides, and not just to school. It’s awkward to be refused when you call a friend and ask for a ride. But with Twitter, you just look for other people heading the same way.

It may sound risky, so many teens stay within their own social circles to find rides, and don’t branch out beyond friends when asking on Twitter just like me, but to some young people, especially those taking longer trips, stranger danger is less of a concern.

“I think the digital connection of young people is really key, because younger generations grew up sharing things on line, sharing files, photos, music, etc, so they’ve been very used to sharing,” said Juliet Schor, a sociology professor at Boston College.

The sharing economy got big during the recession (经济衰退), allowing people to access more goods, services using technology and even to share costs. And that technology, for me, is what the car was for my mom, a gateway to more freedom, like what my friend Earl says, “The symbol of freedom isn’t the car any more because there’s technology out there connecting you to a car.”

According to the researchers at the University of Michigan, 30 years ago, eight in ten American 18-year-olds had a driver’s license compared to six in ten today. So it’s not that surprising that on my 16th birthday I wasn’t rushing to get a license but an iPhone.

“Driving, for young people, does mean they have to disconnect from their technology, and that’s a negative. So if they could sit in the passage side and still be connected, that’s going to be a plus.” Schor continued.

To me, another plus is that ridesharing represents something, something much bigger than trying to save money. I see it as evidence that people still depend on each other. My generation shares their cars and apartments the way neighbors used to share cups of sugar. For the system to work, some of us still need our own cars. But until I get my own version of the silver Super Beetle, you can find me on Twitter.

小题1:The American teens like me, prefer to possess an iPhone as a birthday gift because _______.

A.it is most fashionable and cool

B.they are bored with driving cars

C.they are fond of being connected

D.it is much cheaper than a car小题2:We can learn from the text that _______.

A.Twitter is a website for teens to make friends and achieve goals

B.ridesharing can be seen as a sign that people still count on each other

C.driving cars for teens means a plus and connecting with technology

D.having a car and cost-sharing symbolize more freedom for the author’s mother小题3:Professor Juliet would agree that _______.

A.young people will sit waiting to be contacted by reading a passage

B.sharing economy is bound to be responsible for the recession

C.young people tend to share a car with strangers by means of Twitter

D.being connected via technology comes first for young people小题4:The best title for the passage is probably _______.

A.Twitter, an Awesome Website

B.Cars or iPhone

C.Teens Use Twitter to Thumb Rides

D.Cool Teens on the Go