|| at Oct 19, 2012 at 8:29 am
On Oct 19, 2012 1:32 PM, wrote:
So the runtime "master" scheduler Sched maintains a monotonically
incrementing counter int32 goidgen which value is assigned to the goid
member for each process spawned. Now, what happens when goidgen overflows?
New processes might get assigned the same goid as existing processes, which
seems like a potential problem. Am I just crazy or missing something?
this is a valid concern (note about terminology,
it is goroutine, not process). but i think it's not fatal.
1. goid is not exposed, so no user level damage if it has some duplicates.
2. goid is maintained mainly for traceback and race detector.
for the first usage, i don't think it has any impact.
for the race detector, before int32 overflows, you'd
probably lose your patience first ;-)
if we want to fix it, we need to maintain a bitmap of allocated
goids, which seems overkill. if we use int64, the problem of
overflow still remains but 64-bit atomic operation will slow
some 32-bit hosts down with no clear profit.