在SQL Server中,需要对数据操作进行先SELECT 之后UPDATE,对于这样的操作,如果出现高并发,可能导致脏读情况的发生.不能保证数据的同步. 解决方案是在事物中对表进行加更新锁: 事务一: begin tran select @count as count1 waitfor delay '00:00:30' commit tran select * from tb_name 事务二: begin tran select @count as count2 commit tran se
一.golang的代码 package main import ( "fmt" "time" ) func Text_goroute(a int, b int) { sum := a + b fmt.Println(sum) } func main() { start:=time.Now() for i:=0;i<1000;i++{ go Text_goroute(i,i+1) } end:=time.Since(start) fmt.Println(end)