logs archiveBotHelp.net / Freenode / #2f30 / 2015 / September / 17 / 2
stateless
to invalidate a lock you need to grab the write lock for the map
also when you are adding/removing from the map of course
Evil_Bob
yeah i need to remove the lock in the write-case, it would make it simpler if it wasnt :)
stateless
https://en.wikipedia.org/wiki/NextBSD
Evil_Bob
stateless: before using a lock i need to check if it exists though (read-lock), but there would be a race-condition between read unlock and write lock if the lock doesnt exist
stateless
lol there is even a wiki page now for this piece of crap
Evil_Bob, can you upgrade your read lock to a write lock?
without unlocking
after the upgrade you need to do the existence check before the upgrade could have blocked
and another thread to have created it
s/before/because/
actually no
forget what I am saying, it is wrong
Evil_Bob
Golang doesnt support upgrading it anyway i think
stateless
another writer couldn't have acquired it since you already had the read lock, so after the upgrade, there is no need to check for existence
ah right
so then
what you can do is this
readl
if it doesn't exist
readul
writel
if it doesn't exist, create it
writeul
so you only enter the writel, when you have a hint that the lock might not exist
as long as you don't care if the lock was created and destroyed between readul and writel, it should be ok
after a while I guess all the locks will be live right?
or some subset that is used will be live
Evil_Bob
hmmm yea i think it'll work thanks :)
stateless
can you initialize the locks in advance?
or can this map have an arbitrary number of keys
Evil_Bob
i cant initialize it in advance
it would be much simpler (and i would probably use channels) in that case :)
stateless
what if you break down the map in K blocks, and use K locks for all entries in the block?
so you have a constant number of locks
you can increase K until it is works well enough
sorry I mean use 1 lock for all entries in the block
not K :P
Evil_Bob
i dont understand, it would still need to write lock the unique entry
stateless
yes but you can preallocate them
in any case, this is insane
:P
lol
Evil_Bob
ah like that :)
stateless
so if N <= K you have 1 lock for 1 entry
if N > K then you have 1 lock covering potentially multiple entries
as N increases, each lock protects more and more entries
you increase K during your test runs until it is fast enough :P
double it
:P
Evil_Bob
lool
stateless
Evil_Bob, or of course, get a big ass machine, and preallocate SIZE_MAX locks
:P
heck SIZE_MAX / sizeof(lock) will do
:P
Evil_Bob
i have this test-case which spawned a million goroutines to test the race-condition, my work machine nearly crashed heh
stateless
haha
Evil_Bob
(my work machine is very sh*t though, desktop at home is way more powerful)
stateless
nice
I remember golang could do a million goroutines on a p4 or sth
not sure that is possible anymore
:P
Evil_Bob
yeah i think so, the bottleneck for my PC at work is memory, it allocates a 4k stack per goroutine or something :)
so it starts swapping
stateless
right yeah
Evil_Bob
only 4GB ram there lol
and some dual-core machine
stateless
lul
my work machine has 32G
Evil_Bob
(no SSD) ;(
stateless
:P
Evil_Bob
hah insane, yeah i remember the screenshot, 16 core or something too right?
stateless
yeah
atmc
Evil_Bob: nag your boss
we buy some number cruncher at the end of the year
Evil_Bob
atmc: yeah i will :)
stateless
atmc is eating all the flops
Evil_Bob
(Action) Wants MOAR BOGOMIPS
stateless
bogomips : 5199.98
that's mine
:P
http://sprunge.us/TLJR
Evil_Bob
fapfapfap
stateless
20MB cache per core
nice
ah no
20mb is total :P
so 2.5MB per core
Evil_Bob
hah damn, its like 1200-1400 euro still
stateless
Evil_Bob, I can build the kernel amd64 defconfig in 40 seconds or so
:P
but that's pretty stripped down
I wonder how openbsd would run on this machine
not sure if it even boots
lol
Evil_Bob
lol
stateless
Evil_Bob, https://lobste.rs/s/osuis8/system_xvi_a_replacement_for_systemd
lol
check tedu's comment haha
Evil_Bob
brb food
« prev 1 2 3 next »